Skip to content

Commit

Permalink
Merge pull request #41 from mmacata/gunicorn-optimization
Browse files Browse the repository at this point in the history
optimize gunicorn startup options
  • Loading branch information
mmacata authored Oct 31, 2019
2 parents e1d358f + 988cd61 commit 0984bec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ For actinia_core development, run and enter the running container (in a separate
```
docker-compose run --rm --entrypoint /bin/bash -v $HOME/repos/actinia_core/src:/src/actinia_core/src actinia-core
docker-compose -f docker-compose-dev.yml run --rm --entrypoint /bin/bash -v $HOME/repos/actinia/actinia_core/src:/src/actinia_core/src -v $HOME/repos/actinia/actinia_core/scripts:/src/actinia_core/scripts actinia-core
docker-compose -f docker-compose-dev.yml run --rm --entrypoint /bin/bash -v $HOME/repos/actinia/actinia_core/src:/src/actinia_core/src -v $HOME/repos/actinia/actinia_core/scripts:/src/actinia_core/scripts actinia-core```
```

Inside the container, you can run GRASS GIS with:
Expand Down Expand Up @@ -71,7 +71,7 @@ python3 setup.py install
bash /src/start-dev.sh
# python3 -m actinia_core.main
gunicorn -b 0.0.0.0:8088 -w 1 actinia_core.main:flask_app
gunicorn -b 0.0.0.0:8088 -w 1 --access-logfile=- -k gthread actinia_core.main:flask_app
```
If you have problems with cache, run
Expand Down
4 changes: 3 additions & 1 deletion docker/actinia-core-prod/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ grass -text -e -c 'EPSG:4326' /actinia_core/grassdb/latlong_wgs84
# created here, because set in sample config as default location
grass -text -e -c 'EPSG:3358' /actinia_core/grassdb/nc_spm_08

gunicorn -b 0.0.0.0:8088 -w 1 actinia_core.main:flask_app
# optimized gunicorn settings (http://docs.gunicorn.org/en/stable/design.html) # recommended num of workers is (2 x $num_cores) + 1, here minimum is assumed.
# If deployed with 8 replicas, each will run with 3 workers.
gunicorn -b 0.0.0.0:8088 -w 3 --access-logfile=- -k gthread actinia_core.main:flask_app
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start actinia_core/main.py: $status"
Expand Down
4 changes: 3 additions & 1 deletion docker/actinia-core/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ if [ $status -ne 0 ]; then
exit $status
fi

gunicorn -b 0.0.0.0:8088 -w 1 actinia_core.main:flask_app
# optimized gunicorn settings (http://docs.gunicorn.org/en/stable/design.html) # run only 1 worker for debugging reasons. This is overwritten for production
# deployment.
gunicorn -b 0.0.0.0:8088 -w 1 --access-logfile=- -k gthread actinia_core.main:flask_app
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start actinia_core/main.py: $status"
Expand Down

0 comments on commit 0984bec

Please sign in to comment.