diff --git a/gunicorn.conf.py b/gunicorn.conf.py index 8a5a9a986432b9d1232943229a7b666451b28df2..1dcc784778b5a54a47c3d8650fbdcc4859f7ef8a 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -4,12 +4,10 @@ import os chdir = f'{os.environ["INSTALL_DIR"]}/pvs_instance/' bind = ':80' -# workers -workers = 8 +# workers (see also ./run-httpd.sh for dynamic configs) max_requests = 10 max_requests_jitter = 3 worker_class = 'sync' -timeout = 120 # logging accesslog = '-' diff --git a/run-httpd.sh b/run-httpd.sh index 851eacc31e329f0c80bc8425a67266def03d400a..b2b31fe5e9c68806dd857b55167dc70b86a83b06 100755 --- a/run-httpd.sh +++ b/run-httpd.sh @@ -2,6 +2,8 @@ DEBUG=${DEBUG:="false"} +WORKERS=${WORKERS:=8} +WORKER_TIMEOUT=${WORKER_TIMEOUT:=120} if [[ "$DEBUG" = true ]] ; then @@ -9,5 +11,10 @@ if [[ "$DEBUG" = true ]] ; then python3 /var/www/pvs/dev/pvs_instance/manage.py runserver 0.0.0.0:80 else echo "Running gunicorn" - exec gunicorn --config /opt/core/gunicorn.conf.py pvs_instance.wsgi:application 2>&1 + exec \ + gunicorn \ + --config /opt/core/gunicorn.conf.py pvs_instance.wsgi:application \ + --timeout "${WORKER_TIMEOUT}" \ + --workers "${$WORKERS}" \ + 2>&1 fi