diff --git a/README.md b/README.md index 20116fb164a29fe824770dd2f183fc6e34b16874..34f0fa70ed32d91856f26682e5f1b1c955719ac9 100644 --- a/README.md +++ b/README.md @@ -155,3 +155,50 @@ see new service in #7 see #9 # Usage + +## Test locally using docker swarm + +Initialize swarm & stack: + +```bash +docker swarm init # initialize swarm +# build images + docker build core/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_core -t registry.gitlab.eox.at/esa/prism/vs/pvs_core + docker build cache/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_cache -t registry.gitlab.eox.at/esa/prism/vs/pvs_cache + docker build preprocessor/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor -t registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor + docker build client/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_client -t registry.gitlab.eox.at/esa/prism/vs/pvs_client +#or + docker login -u {DOCKER_USER} -p {DOCKER_PASSWORD} registry.gitlab.eox.at + docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_core + docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_cache + docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor + docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_client +docker stack deploy -c docker-compose.vhr18.yml -c docker-compose.vhr18.dev.yml vhr18-pvs # start VHR_IMAGE_2018 stack in dev mode, for example to use local sources +docker stack deploy -c docker-compose.emg.yml -c docker-compose.emg.dev.yml emg-pvs # start Emergency stack in dev mode, for example to use local sources + +docker exec -it $(docker ps -qf "name=vhr18-pvs_renderer") /bin/bash +cd /var/www/pvs/dev/pvs_instance +python manage.py runserver 0.0.0.0:8080 + +``` +Tear town stack including data: + +```bash +docker stack rm vhr18-pvs # stop stack +docker volume rm vhr18-pvs_db-data # delete volumes +docker volume rm vhr18-pvs_redis-data +docker volume rm vhr18-pvs_traefik-data +docker volume rm vhr18-pvs_cache-db +``` + +Generate mapcache.sqlite + +```bash +docker exec -it $(docker ps -qf "name=vhr18-pvs_renderer") python3 /var/www/pvs/dev/pvs_instance/manage.py mapcache sync -f +docker exec -it $(docker ps -qf "name=vhr18-pvs_renderer") mv VHR_IMAGE_2018.sqlite /cache-db/vhr18_mapcache_cache.sqlite + +docker exec -it $(docker ps -qf "name=emg-pvs_renderer") python3 /var/www/pvs/dev/pvs_instance/manage.py mapcache sync -f +docker exec -it $(docker ps -qf "name=emg-pvs_renderer") mv Emergency.sqlite /cache-db/emg_mapcache_cache.sqlite +``` + + diff --git a/core/run-httpd.sh b/core/run-httpd.sh index cf381e95de02940f056813c7fa3b5ad76690eafa..281a063d57c95e1a33354315249c6694438865bd 100644 --- a/core/run-httpd.sh +++ b/core/run-httpd.sh @@ -2,4 +2,4 @@ echo "Running gunicorn" -exec gunicorn --chdir ${INSTALL_DIR}/pvs_instance/ --bind :80 pvs_instance.wsgi:application --workers 8 --timeout 600 --access-logfile - --error-logfile - --log-level warning --disable-redirect-access-to-syslog +exec gunicorn --chdir ${INSTALL_DIR}/pvs_instance/ --bind :80 pvs_instance.wsgi:application --workers 8 --worker-class sync --timeout 600 --access-logfile - --error-logfile - --log-level warning --disable-redirect-access-to-syslog