diff --git a/docker/Dockerfile b/docker/Dockerfile index 04d85184bd..d3517b1a05 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -84,4 +84,7 @@ RUN mkdir /home/inventree/media /home/inventree/static /home/inventree/log /home # Copy supervisor file COPY docker/supervisor.conf /etc/supervisord.conf +# Copy gunicorn config file +COPY docker/gunicorn.conf.py /home/inventree/gunicorn.conf.py + CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] diff --git a/docker/gunicorn.conf.py b/docker/gunicorn.conf.py new file mode 100644 index 0000000000..1071c2d745 --- /dev/null +++ b/docker/gunicorn.conf.py @@ -0,0 +1,6 @@ +import multiprocessing + +workers = multiprocessing.cpu_count() * 2 + 1 + +max_requests = 1000 +max_requests_jitter = 50 diff --git a/docker/supervisor.conf b/docker/supervisor.conf index 72609e5bac..47eeaf6c28 100644 --- a/docker/supervisor.conf +++ b/docker/supervisor.conf @@ -18,7 +18,7 @@ nodaemon=true [program:inventree-server] user=inventree directory=/home/inventree/src/InvenTree -command=/home/inventree/env/bin/gunicorn -c gunicorn.conf.py InvenTree.wsgi -b 0.0.0.0:%(INVENTREE_PORT)s +command=/home/inventree/env/bin/gunicorn -c /home/inventree/gunicorn.conf.py InvenTree.wsgi -b 0.0.0.0:%(ENV_INVENTREE_PORT)s startsecs=10 autostart=true autorestart=true