version: "3.7" services: ############# External services {% if ACTIVATE_MEMCACHED %} memcached: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MEMCACHED }} restart: unless-stopped {% endif %} {% if ACTIVATE_MONGODB %} mongodb: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MONGODB }} # Use WiredTiger in all environments, just like at edx.org command: mongod --smallfiles --nojournal --storageEngine wiredTiger restart: unless-stopped volumes: - ../../data/mongodb:/data/db {% endif %} {% if ACTIVATE_MYSQL %} mysql: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MYSQL }} command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci restart: unless-stopped volumes: - ../../data/mysql:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: "{{ MYSQL_ROOT_PASSWORD }}" {% endif %} {% if ACTIVATE_ELASTICSEARCH %} elasticsearch: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_ELASTICSEARCH }} command: ["elasticsearch", "-Xms{{ ELASTICSEARCH_HEAP_SIZE }}", "-Xmx{{ ELASTICSEARCH_HEAP_SIZE }}", "--cluster.name=openedx", "--bootstrap.mlockall=true"] ulimits: memlock: soft: -1 hard: -1 restart: unless-stopped volumes: - ../../data/elasticsearch:/usr/share/elasticsearch/data {% endif %} openedx-assets: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_OPENEDX }} volumes: - ../../data/openedx:/var/www/openedx command: sh -c "rm -rf /var/www/openedx/staticfiles && cp -r /openedx/staticfiles/ /var/www/openedx/" nginx: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_NGINX }} restart: unless-stopped ports: - "{{ NGINX_HTTP_PORT }}:80" - "{{ NGINX_HTTPS_PORT }}:443" networks: default: aliases: [{{ patch("local-docker-compose-nginx-aliases", separator=", ") }}] volumes: - ../apps/nginx:/etc/nginx/conf.d/:ro - ../../data/openedx:/var/www/openedx:ro - ../../data/openedx-media:/var/www/openedx-media:ro {% if ACTIVATE_HTTPS %}- ../../data/letsencrypt:/etc/letsencrypt/:ro{% endif %} {{ patch("local-docker-compose-nginx-volumes")|indent(6) }} depends_on: {{ [("lms", ACTIVATE_LMS), ("cms", ACTIVATE_CMS)]|list_if }} {% if ACTIVATE_RABBITMQ %} rabbitmq: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_RABBITMQ }} volumes: - ../../data/rabbitmq:/var/lib/rabbitmq restart: unless-stopped {% endif %} {% if ACTIVATE_SMTP %} smtp: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_SMTP }} restart: unless-stopped {% endif %} ############# Forum {% if ACTIVATE_FORUM %} forum: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_FORUM }} environment: SEARCH_SERVER: "{{ ELASTICSEARCH_SCHEME }}://{{ ELASTICSEARCH_HOST }}:{{ ELASTICSEARCH_PORT }}" MONGODB_AUTH: "{% if MONGODB_USERNAME and MONGODB_PASSWORD %}{{ MONGODB_USERNAME}}:{{ MONGODB_PASSWORD }}@{% endif %}" MONGODB_HOST: "{{ MONGODB_HOST }}" MONGODB_PORT: "{{ MONGODB_PORT }}" restart: unless-stopped depends_on: {{ [("elasticsearch", ACTIVATE_ELASTICSEARCH), ("mongodb", ACTIVATE_MONGODB)]|list_if }} {% endif %} ############# LMS and CMS {% if ACTIVATE_LMS %} lms: 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: - ../apps/openedx/settings/lms/:/openedx/edx-platform/lms/envs/tutor/ - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/lms:/openedx/data - ../../data/openedx-media:/openedx/media depends_on: - mysql {% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %} {% if ACTIVATE_FORUM %}- forum{% endif %} {% if ACTIVATE_MEMCACHED %}- memcached{% endif %} {% if ACTIVATE_MONGODB %}- mongodb{% endif %} {% if ACTIVATE_RABBITMQ %}- rabbitmq{% endif %} {% if ACTIVATE_SMTP %}- smtp{% endif %} {{ patch("local-docker-compose-lms-dependencies")|indent(6) }} {% endif %} {% if ACTIVATE_CMS %} cms: 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: - ../apps/openedx/settings/lms/:/openedx/edx-platform/lms/envs/tutor/ - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/cms:/openedx/data - ../../data/openedx-media:/openedx/media depends_on: - mysql {% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %} {% if ACTIVATE_MEMCACHED %}- memcached{% endif %} {% if ACTIVATE_MONGODB %}- mongodb{% endif %} {% if ACTIVATE_RABBITMQ %}- rabbitmq{% endif %} {% if ACTIVATE_SMTP %}- smtp{% endif %} {{ patch("local-docker-compose-cms-dependencies")|indent(6) }} {% endif %} ############# LMS and CMS workers {% if ACTIVATE_LMS %} lms-worker: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_OPENEDX }} environment: SERVICE_VARIANT: lms SETTINGS: ${EDX_PLATFORM_SETTINGS:-tutor.production} C_FORCE_ROOT: "1" # run celery tasks as root #nofear command: ./manage.py lms celery worker --loglevel=info --hostname=edx.lms.core.default.%%h --maxtasksperchild 100 restart: unless-stopped volumes: - ../apps/openedx/settings/lms/:/openedx/edx-platform/lms/envs/tutor/ - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/lms:/openedx/data - ../../data/openedx-media:/openedx/media depends_on: - lms {% endif %} {% if ACTIVATE_CMS %} cms-worker: image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_OPENEDX }} environment: SERVICE_VARIANT: cms SETTINGS: ${EDX_PLATFORM_SETTINGS:-tutor.production} C_FORCE_ROOT: "1" # run celery tasks as root #nofear command: ./manage.py cms celery worker --loglevel=info --hostname=edx.cms.core.default.%%h --maxtasksperchild 100 restart: unless-stopped volumes: - ../apps/openedx/settings/lms/:/openedx/edx-platform/lms/envs/tutor/ - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/cms:/openedx/data - ../../data/openedx-media:/openedx/media depends_on: - cms {% endif %} {{ patch("local-docker-compose-services")|indent(2) }}