From 8659b6e7ac9b7654720637f7ba48d4ecae50a993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 19 Sep 2019 15:39:18 +0200 Subject: [PATCH] Added config values for #gunicorn workers --- CHANGELOG.md | 4 ++++ docs/configuration.rst | 8 ++++++++ tutor/templates/build/openedx/Dockerfile | 9 +++++---- tutor/templates/config.yml | 2 ++ tutor/templates/local/docker-compose.yml | 2 ++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdabbed..f5b7b2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Note: Breaking changes between versions are indicated by "💥". +## Unreleased + +- [Improvement] Added configuration values to limit the number of gunicorn workers for the LMS and CMS. + ## 3.7.0 (2019-09-03) - 💥[Improvement] Get rid of mysql-client container diff --git a/docs/configuration.rst b/docs/configuration.rst index 3fe3ddc..fd6bf31 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -76,6 +76,14 @@ You may want to pull/push images from/to a custom docker registry. For instance, (the trailing ``/`` is important) +Open edX customisation +~~~~~~~~~~~~~~~~~~~~~~ + +- ``OPENEDX_CMS_GUNICORN_WORKERS`` (default: ``2``) +- ``OPENEDX_LMS_GUNICORN_WORKERS`` (default: ``2``) + +By default there are 2 `gunicorn worker processes `__ to serve requests for the LMS and the CMS. However, each workers requires upwards of 500 Mb of RAM. You should reduce this value to 1 if your computer/server does not have enough memory. + Vendor services ~~~~~~~~~~~~~~~ diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index 4f062d9..9137dd4 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -38,9 +38,7 @@ RUN cd /tmp \ && mv openedx-i18n-hawthorn/edx-platform/locale/ /openedx/locale/ \ && rm -rf openedx-i18n* -# Install python requirements (clone source repos in a separate dir, otherwise -# they will be overwritten when we mount edx-platform) -ENV NO_PYTHON_UNINSTALL 1 +# Install python requirements in a virtualenv RUN virtualenv /openedx/venv ENV PATH /openedx/venv/bin:${PATH} ENV VIRTUAL_ENV /openedx/venv/ @@ -65,7 +63,9 @@ ENV PATH ./node_modules/.bin:${PATH} # Install private requirements: this is useful for installing custom xblocks. COPY ./requirements/ /openedx/requirements -RUN cd /openedx/requirements/ && pip install -r ./private.txt +RUN cd /openedx/requirements/ \ + && touch ./private.txt \ + && pip install -r ./private.txt # Create folder that will store *.env.json and *.auth.json files, as well as # the tutor-specific settings files. @@ -88,6 +88,7 @@ ENV PATH /openedx/bin:${PATH} # and requires a complex settings file. Instead, we decompose the commands # and run each one individually to collect the production static assets to # /openedx/staticfiles. +ENV NO_PYTHON_UNINSTALL 1 RUN openedx-assets xmodule \ && openedx-assets npm \ && openedx-assets webpack --env=prod \ diff --git a/tutor/templates/config.yml b/tutor/templates/config.yml index bec3be6..9d0d75a 100644 --- a/tutor/templates/config.yml +++ b/tutor/templates/config.yml @@ -54,6 +54,8 @@ MONGODB_DATABASE: "openedx" MONGODB_PORT: 27017 MONGODB_USERNAME: "" MONGODB_PASSWORD: "" +OPENEDX_CMS_GUNICORN_WORKERS: 2 +OPENEDX_LMS_GUNICORN_WORKERS: 2 OPENEDX_MYSQL_DATABASE: "openedx" OPENEDX_MYSQL_USERNAME: "openedx" MYSQL_HOST: "mysql" diff --git a/tutor/templates/local/docker-compose.yml b/tutor/templates/local/docker-compose.yml index d730cf7..f35d4dd 100644 --- a/tutor/templates/local/docker-compose.yml +++ b/tutor/templates/local/docker-compose.yml @@ -110,6 +110,7 @@ services: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_OPENEDX }} environment: SERVICE_VARIANT: lms + GUNICORN_WORKERS: {{ OPENEDX_LMS_GUNICORN_WORKERS }} SETTINGS: ${EDX_PLATFORM_SETTINGS:-tutor.production} restart: unless-stopped volumes: @@ -134,6 +135,7 @@ services: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_OPENEDX }} environment: SERVICE_VARIANT: cms + GUNICORN_WORKERS: {{ OPENEDX_CMS_GUNICORN_WORKERS }} SETTINGS: ${EDX_PLATFORM_SETTINGS:-tutor.production} restart: unless-stopped volumes: