mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-06 07:30:40 +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
|
||||
|
||||
- 💥[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] Improved the output of `tutor plugins list`.
|
||||
- [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)
|
||||
|
||||
|
@ -78,9 +78,7 @@ class JobsTests(unittest.TestCase):
|
||||
self.assertTrue(
|
||||
commands.group(2)
|
||||
.strip()
|
||||
.startswith(
|
||||
"export DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS"
|
||||
)
|
||||
.startswith('echo "Loading settings $DJANGO_SETTINGS_MODULE"')
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
BASE_OPENEDX_COMMAND = """
|
||||
export DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS
|
||||
echo "Loading settings $DJANGO_SETTINGS_MODULE"
|
||||
"""
|
||||
|
||||
|
@ -203,12 +203,10 @@ RUN mkdir /openedx/data
|
||||
|
||||
# service variant is "lms" or "cms"
|
||||
ENV SERVICE_VARIANT lms
|
||||
ENV SETTINGS tutor.production
|
||||
ENV DJANGO_SETTINGS_MODULE lms.envs.tutor.production
|
||||
|
||||
{{ patch("openedx-dockerfile") }}
|
||||
|
||||
# Entrypoint will set right environment variables
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
EXPOSE 8000
|
||||
|
||||
###### Intermediate image with dev/test dependencies
|
||||
@ -235,7 +233,7 @@ RUN rm -r /openedx/staticfiles && \
|
||||
{{ patch("openedx-dev-dockerfile-post-python-requirements") }}
|
||||
|
||||
# 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
|
||||
|
||||
@ -252,4 +250,4 @@ CMD uwsgi \
|
||||
--enable-threads \
|
||||
--processes=${UWSGI_WORKERS:-2} \
|
||||
--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(
|
||||
"-s",
|
||||
"--settings",
|
||||
default=os.environ.get("SETTINGS"),
|
||||
default="tutor.assets",
|
||||
help="Django settings module",
|
||||
)
|
||||
collect.add_argument(
|
||||
|
@ -8,8 +8,6 @@ x-openedx-service:
|
||||
target: development
|
||||
args:
|
||||
APP_USER_ID: "{{ HOST_USER_ID }}"
|
||||
environment:
|
||||
SETTINGS: tutor.development
|
||||
volumes:
|
||||
# Settings & config
|
||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||
@ -30,6 +28,8 @@ services:
|
||||
lms:
|
||||
<<: *openedx-service
|
||||
command: ./manage.py lms runserver 0.0.0.0:8000
|
||||
environment:
|
||||
DJANGO_SETTINGS_MODULE: lms.envs.tutor.development
|
||||
ports:
|
||||
- "8000:8000"
|
||||
networks:
|
||||
@ -40,6 +40,8 @@ services:
|
||||
cms:
|
||||
<<: *openedx-service
|
||||
command: ./manage.py cms runserver 0.0.0.0:8000
|
||||
environment:
|
||||
DJANGO_SETTINGS_MODULE: lms.envs.tutor.development
|
||||
ports:
|
||||
- "8001:8000"
|
||||
|
||||
|
@ -67,6 +67,8 @@ spec:
|
||||
env:
|
||||
- name: SERVICE_VARIANT
|
||||
value: cms
|
||||
- name: DJANGO_SETTINGS_MODULE
|
||||
value: cms.envs.tutor.production
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
volumeMounts:
|
||||
@ -117,6 +119,8 @@ spec:
|
||||
env:
|
||||
- name: SERVICE_VARIANT
|
||||
value: cms
|
||||
- name: DJANGO_SETTINGS_MODULE
|
||||
value: cms.envs.tutor.production
|
||||
volumeMounts:
|
||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||
name: settings-lms
|
||||
@ -160,6 +164,11 @@ spec:
|
||||
containers:
|
||||
- name: lms
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
env:
|
||||
- name: SERVICE_VARIANT
|
||||
value: lms
|
||||
- name: DJANGO_SETTINGS_MODULE
|
||||
value: lms.envs.tutor.production
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
volumeMounts:
|
||||
@ -210,6 +219,8 @@ spec:
|
||||
env:
|
||||
- name: SERVICE_VARIANT
|
||||
value: lms
|
||||
- name: DJANGO_SETTINGS_MODULE
|
||||
value: lms.envs.tutor.production
|
||||
volumeMounts:
|
||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||
name: settings-lms
|
||||
|
@ -12,6 +12,11 @@ spec:
|
||||
containers:
|
||||
- name: lms
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
env:
|
||||
- name: SERVICE_VARIANT
|
||||
value: lms
|
||||
- name: DJANGO_SETTINGS_MODULE
|
||||
value: lms.envs.tutor.production
|
||||
volumeMounts:
|
||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||
name: settings-lms
|
||||
@ -46,6 +51,8 @@ spec:
|
||||
env:
|
||||
- name: SERVICE_VARIANT
|
||||
value: cms
|
||||
- name: DJANGO_SETTINGS_MODULE
|
||||
value: cms.envs.tutor.production
|
||||
volumeMounts:
|
||||
- mountPath: /openedx/edx-platform/lms/envs/tutor/
|
||||
name: settings-lms
|
||||
|
@ -9,7 +9,7 @@ services:
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
environment:
|
||||
SERVICE_VARIANT: lms
|
||||
SETTINGS: tutor.production
|
||||
DJANGO_SETTINGS_MODULE: lms.envs.tutor.production
|
||||
volumes:
|
||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
|
||||
@ -20,7 +20,7 @@ services:
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
environment:
|
||||
SERVICE_VARIANT: cms
|
||||
SETTINGS: tutor.production
|
||||
DJANGO_SETTINGS_MODULE: cms.envs.tutor.production
|
||||
volumes:
|
||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
|
||||
|
@ -104,8 +104,8 @@ services:
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
environment:
|
||||
SERVICE_VARIANT: lms
|
||||
DJANGO_SETTINGS_MODULE: lms.envs.tutor.production
|
||||
UWSGI_WORKERS: {{ OPENEDX_LMS_UWSGI_WORKERS }}
|
||||
SETTINGS: tutor.production
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||
@ -135,8 +135,8 @@ services:
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
environment:
|
||||
SERVICE_VARIANT: cms
|
||||
DJANGO_SETTINGS_MODULE: cms.envs.tutor.production
|
||||
UWSGI_WORKERS: {{ OPENEDX_CMS_UWSGI_WORKERS }}
|
||||
SETTINGS: tutor.production
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
|
||||
@ -169,7 +169,7 @@ services:
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
environment:
|
||||
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
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
@ -187,7 +187,7 @@ services:
|
||||
image: {{ DOCKER_IMAGE_OPENEDX }}
|
||||
environment:
|
||||
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
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
|
Loading…
Reference in New Issue
Block a user