diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index 303b3dd..c222c2a 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -89,6 +89,9 @@ ENV SETTINGS tutor.production # Entrypoint will fix permissions of all files and run commands as openedx ENTRYPOINT ["docker-entrypoint.sh"] +# Copy gunicorn settings file +COPY gunicorn_conf.py /openedx/gunicorn_conf.py + # Run server EXPOSE 8000 -CMD gunicorn --name ${SERVICE_VARIANT} --bind=0.0.0.0:8000 --max-requests=1000 ${SERVICE_VARIANT}.wsgi:application +CMD gunicorn -c file:/openedx/gunicorn_conf.py --name ${SERVICE_VARIANT} --bind=0.0.0.0:8000 --max-requests=1000 ${SERVICE_VARIANT}.wsgi:application diff --git a/tutor/templates/build/openedx/gunicorn_conf.py b/tutor/templates/build/openedx/gunicorn_conf.py new file mode 100644 index 0000000..2a2532e --- /dev/null +++ b/tutor/templates/build/openedx/gunicorn_conf.py @@ -0,0 +1,5 @@ +import multiprocessing + +# The recommended number of workers is twice the +# CPU count plus one +workers = (multiprocessing.cpu_count()-1) * 2 + 2