mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-07 16:04:02 +00:00
refactor: get rid of the openedx Docker entrypoint
The entrypoint in the "openedx" Docker image was used only to define the DJANGO_SETTINGS_MODULE environment variable, based on SERVICE_VARIANT and SETTINGS. We ditch SETTINGS in favour of defining explicitely DJANGO_SETTINGS_MODULE. The problem with the Docker entrypoint is that it was bypassed whenever we ran `tutor local exec` or `tutor k8s exec`. By removing it we make it simpler for end-users to run manage.py commands in kubernetes.
This commit is contained in:
parent
5de7bec029
commit
d5a790d5d0
@ -4,10 +4,11 @@ Note: Breaking changes between versions are indicated by "💥".
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- 💥[Improvement] Make it possible to run `tutor k8s exec <command with multiple arguments>` (#636). As a consequence, it is no longer possible to run quoted commands: `tutor k8s exec "<some command>"`. Instead, you should remove the quotes: `tutor k8s exec <some command>`.
|
||||||
|
- 💥[Deprecation] Drop support for the `TUTOR_EDX_PLATFORM_SETTINGS` environment variable. It is now recommended to create a plugin instead.
|
||||||
- 💥[Improvement] Complete overhaul of the plugin extension mechanism. Tutor now has a hook-based Python API: actions can be triggered at different points of the application life cycle and data can be modified thanks to custom filters. The v0 plugin API is still supported, for backward compatibility, but plugin developers are encouraged to migrate their plugins to the new API. See the new plugin tutorial for more information.
|
- 💥[Improvement] Complete overhaul of the plugin extension mechanism. Tutor now has a hook-based Python API: actions can be triggered at different points of the application life cycle and data can be modified thanks to custom filters. The v0 plugin API is still supported, for backward compatibility, but plugin developers are encouraged to migrate their plugins to the new API. See the new plugin tutorial for more information.
|
||||||
- [Improvement] Improved the output of `tutor plugins list`.
|
- [Improvement] Improved the output of `tutor plugins list`.
|
||||||
- [Feature] Add `tutor [dev|local|k8s] status` command, which provides basic information about the platform's status.
|
- [Feature] Add `tutor [dev|local|k8s] status` command, which provides basic information about the platform's status.
|
||||||
- 💥[Improvement] Make it possible to run `tutor k8s exec <command with multiple arguments>` (#636). As a consequence, it is no longer possible to run quoted commands: `tutor k8s exec "<some command>"`. Instead, you should remove the quotes: `tutor k8s exec <some command>`.
|
|
||||||
|
|
||||||
## v13.1.11 (2022-04-12)
|
## v13.1.11 (2022-04-12)
|
||||||
|
|
||||||
|
@ -78,9 +78,7 @@ class JobsTests(unittest.TestCase):
|
|||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
commands.group(2)
|
commands.group(2)
|
||||||
.strip()
|
.strip()
|
||||||
.startswith(
|
.startswith('echo "Loading settings $DJANGO_SETTINGS_MODULE"')
|
||||||
"export DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_get_all_openedx_domains(self) -> None:
|
def test_get_all_openedx_domains(self) -> None:
|
||||||
|
@ -4,7 +4,6 @@ from tutor import env, fmt, hooks
|
|||||||
from tutor.types import Config, get_typed
|
from tutor.types import Config, get_typed
|
||||||
|
|
||||||
BASE_OPENEDX_COMMAND = """
|
BASE_OPENEDX_COMMAND = """
|
||||||
export DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS
|
|
||||||
echo "Loading settings $DJANGO_SETTINGS_MODULE"
|
echo "Loading settings $DJANGO_SETTINGS_MODULE"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -203,12 +203,10 @@ RUN mkdir /openedx/data
|
|||||||
|
|
||||||
# service variant is "lms" or "cms"
|
# service variant is "lms" or "cms"
|
||||||
ENV SERVICE_VARIANT lms
|
ENV SERVICE_VARIANT lms
|
||||||
ENV SETTINGS tutor.production
|
ENV DJANGO_SETTINGS_MODULE lms.envs.tutor.production
|
||||||
|
|
||||||
{{ patch("openedx-dockerfile") }}
|
{{ patch("openedx-dockerfile") }}
|
||||||
|
|
||||||
# Entrypoint will set right environment variables
|
|
||||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
###### Intermediate image with dev/test dependencies
|
###### Intermediate image with dev/test dependencies
|
||||||
@ -235,7 +233,7 @@ RUN rm -r /openedx/staticfiles && \
|
|||||||
{{ patch("openedx-dev-dockerfile-post-python-requirements") }}
|
{{ patch("openedx-dev-dockerfile-post-python-requirements") }}
|
||||||
|
|
||||||
# Default django settings
|
# Default django settings
|
||||||
ENV SETTINGS tutor.development
|
ENV DJANGO_SETTINGS_MODULE lms.envs.tutor.development
|
||||||
|
|
||||||
CMD ./manage.py $SERVICE_VARIANT runserver 0.0.0.0:8000
|
CMD ./manage.py $SERVICE_VARIANT runserver 0.0.0.0:8000
|
||||||
|
|
||||||
@ -252,4 +250,4 @@ CMD uwsgi \
|
|||||||
--enable-threads \
|
--enable-threads \
|
||||||
--processes=${UWSGI_WORKERS:-2} \
|
--processes=${UWSGI_WORKERS:-2} \
|
||||||
--buffer-size=8192 \
|
--buffer-size=8192 \
|
||||||
--wsgi-file ${SERVICE_VARIANT}/wsgi.py
|
--wsgi-file $SERVICE_VARIANT/wsgi.py
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh -e
|
|
||||||
export DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS
|
|
||||||
exec "$@"
|
|
@ -60,7 +60,7 @@ def main():
|
|||||||
collect.add_argument(
|
collect.add_argument(
|
||||||
"-s",
|
"-s",
|
||||||
"--settings",
|
"--settings",
|
||||||
default=os.environ.get("SETTINGS"),
|
default="tutor.assets",
|
||||||
help="Django settings module",
|
help="Django settings module",
|
||||||
)
|
)
|
||||||
collect.add_argument(
|
collect.add_argument(
|
||||||
|
@ -8,8 +8,6 @@ x-openedx-service:
|
|||||||
target: development
|
target: development
|
||||||
args:
|
args:
|
||||||
APP_USER_ID: "{{ HOST_USER_ID }}"
|
APP_USER_ID: "{{ HOST_USER_ID }}"
|
||||||
environment:
|
|
||||||
SETTINGS: tutor.development
|
|
||||||
volumes:
|
volumes:
|
||||||
# Settings & config
|
# Settings & config
|
||||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||||
@ -30,6 +28,8 @@ services:
|
|||||||
lms:
|
lms:
|
||||||
<<: *openedx-service
|
<<: *openedx-service
|
||||||
command: ./manage.py lms runserver 0.0.0.0:8000
|
command: ./manage.py lms runserver 0.0.0.0:8000
|
||||||
|
environment:
|
||||||
|
DJANGO_SETTINGS_MODULE: lms.envs.tutor.development
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
networks:
|
networks:
|
||||||
@ -40,6 +40,8 @@ services:
|
|||||||
cms:
|
cms:
|
||||||
<<: *openedx-service
|
<<: *openedx-service
|
||||||
command: ./manage.py cms runserver 0.0.0.0:8000
|
command: ./manage.py cms runserver 0.0.0.0:8000
|
||||||
|
environment:
|
||||||
|
DJANGO_SETTINGS_MODULE: lms.envs.tutor.development
|
||||||
ports:
|
ports:
|
||||||
- "8001:8000"
|
- "8001:8000"
|
||||||
|
|
||||||
|
@ -67,6 +67,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: SERVICE_VARIANT
|
- name: SERVICE_VARIANT
|
||||||
value: cms
|
value: cms
|
||||||
|
- name: DJANGO_SETTINGS_MODULE
|
||||||
|
value: cms.envs.tutor.production
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@ -117,6 +119,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: SERVICE_VARIANT
|
- name: SERVICE_VARIANT
|
||||||
value: cms
|
value: cms
|
||||||
|
- name: DJANGO_SETTINGS_MODULE
|
||||||
|
value: cms.envs.tutor.production
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||||
name: settings-lms
|
name: settings-lms
|
||||||
@ -160,6 +164,11 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: lms
|
- name: lms
|
||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
|
env:
|
||||||
|
- name: SERVICE_VARIANT
|
||||||
|
value: lms
|
||||||
|
- name: DJANGO_SETTINGS_MODULE
|
||||||
|
value: lms.envs.tutor.production
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@ -210,6 +219,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: SERVICE_VARIANT
|
- name: SERVICE_VARIANT
|
||||||
value: lms
|
value: lms
|
||||||
|
- name: DJANGO_SETTINGS_MODULE
|
||||||
|
value: lms.envs.tutor.production
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||||
name: settings-lms
|
name: settings-lms
|
||||||
|
@ -12,6 +12,11 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: lms
|
- name: lms
|
||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
|
env:
|
||||||
|
- name: SERVICE_VARIANT
|
||||||
|
value: lms
|
||||||
|
- name: DJANGO_SETTINGS_MODULE
|
||||||
|
value: lms.envs.tutor.production
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||||
name: settings-lms
|
name: settings-lms
|
||||||
@ -46,6 +51,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: SERVICE_VARIANT
|
- name: SERVICE_VARIANT
|
||||||
value: cms
|
value: cms
|
||||||
|
- name: DJANGO_SETTINGS_MODULE
|
||||||
|
value: cms.envs.tutor.production
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||||
name: settings-lms
|
name: settings-lms
|
||||||
|
@ -9,7 +9,7 @@ services:
|
|||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
environment:
|
environment:
|
||||||
SERVICE_VARIANT: lms
|
SERVICE_VARIANT: lms
|
||||||
SETTINGS: tutor.production
|
DJANGO_SETTINGS_MODULE: lms.envs.tutor.production
|
||||||
volumes:
|
volumes:
|
||||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||||
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
|
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
|
||||||
@ -20,7 +20,7 @@ services:
|
|||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
environment:
|
environment:
|
||||||
SERVICE_VARIANT: cms
|
SERVICE_VARIANT: cms
|
||||||
SETTINGS: tutor.production
|
DJANGO_SETTINGS_MODULE: cms.envs.tutor.production
|
||||||
volumes:
|
volumes:
|
||||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||||
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
|
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
|
||||||
|
@ -104,8 +104,8 @@ services:
|
|||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
environment:
|
environment:
|
||||||
SERVICE_VARIANT: lms
|
SERVICE_VARIANT: lms
|
||||||
|
DJANGO_SETTINGS_MODULE: lms.envs.tutor.production
|
||||||
UWSGI_WORKERS: {{ OPENEDX_LMS_UWSGI_WORKERS }}
|
UWSGI_WORKERS: {{ OPENEDX_LMS_UWSGI_WORKERS }}
|
||||||
SETTINGS: tutor.production
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||||
@ -135,8 +135,8 @@ services:
|
|||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
environment:
|
environment:
|
||||||
SERVICE_VARIANT: cms
|
SERVICE_VARIANT: cms
|
||||||
|
DJANGO_SETTINGS_MODULE: cms.envs.tutor.production
|
||||||
UWSGI_WORKERS: {{ OPENEDX_CMS_UWSGI_WORKERS }}
|
UWSGI_WORKERS: {{ OPENEDX_CMS_UWSGI_WORKERS }}
|
||||||
SETTINGS: tutor.production
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||||
@ -169,7 +169,7 @@ services:
|
|||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
environment:
|
environment:
|
||||||
SERVICE_VARIANT: lms
|
SERVICE_VARIANT: lms
|
||||||
SETTINGS: tutor.production
|
DJANGO_SETTINGS_MODULE: lms.envs.tutor.production
|
||||||
command: celery worker --app=lms.celery --loglevel=info --hostname=edx.lms.core.default.%%h --maxtasksperchild=100 --exclude-queues=edx.cms.core.default
|
command: celery worker --app=lms.celery --loglevel=info --hostname=edx.lms.core.default.%%h --maxtasksperchild=100 --exclude-queues=edx.cms.core.default
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
@ -187,7 +187,7 @@ services:
|
|||||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||||
environment:
|
environment:
|
||||||
SERVICE_VARIANT: cms
|
SERVICE_VARIANT: cms
|
||||||
SETTINGS: tutor.production
|
DJANGO_SETTINGS_MODULE: cms.envs.tutor.production
|
||||||
command: celery worker --app=cms.celery --loglevel=info --hostname=edx.cms.core.default.%%h --maxtasksperchild 100 --exclude-queues=edx.lms.core.default
|
command: celery worker --app=cms.celery --loglevel=info --hostname=edx.cms.core.default.%%h --maxtasksperchild 100 --exclude-queues=edx.lms.core.default
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
|
Loading…
Reference in New Issue
Block a user