6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2025-01-07 07:54:03 +00:00

Tell openedx gunicorn to fork workers based on CPU count

This commit is contained in:
Silvio Tomatis 2019-04-16 17:55:43 +02:00 committed by Régis Behmo
parent d2f6783306
commit f812ed7dc3
2 changed files with 9 additions and 1 deletions

View File

@ -89,6 +89,9 @@ ENV SETTINGS tutor.production
# Entrypoint will fix permissions of all files and run commands as openedx # Entrypoint will fix permissions of all files and run commands as openedx
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
# Copy gunicorn settings file
COPY gunicorn_conf.py /openedx/gunicorn_conf.py
# Run server # Run server
EXPOSE 8000 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

View File

@ -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