From fee5b8aa729954367c6bb4f919eae6d4522bda07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 15 Jan 2019 09:00:47 +0100 Subject: [PATCH] Fix demo-course and staff-user commands for k8s Because we use "exec" and not "run" like in the local install, we need to explicitely define the django settings (which sucks). This should be improved by using k8s Jobs. --- deploy/k8s/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deploy/k8s/Makefile b/deploy/k8s/Makefile index 169dd8a..6dcee09 100644 --- a/deploy/k8s/Makefile +++ b/deploy/k8s/Makefile @@ -84,15 +84,18 @@ pod-exec: ## Execute a command inside an arbitrary pod: make pod-exec APP=appnam $(call podexec,$(APP),$(COMMAND)) # TODO replace these tasks with Job objects +# Note that here, settings must be defined manually because "exec" does not use +# the docker entrypoint, and thus does not define the DJANGO_SETTINGS_MODULE +# environment variable. demo-course: ## Import the demo course from edX $(call podexec,cms,/bin/bash -c "\ git clone https://github.com/edx/edx-demo-course --branch open-release/hawthorn.2 --depth 1 ../edx-demo-course \ - && python ./manage.py cms import ../data ../edx-demo-course") + && python ./manage.py cms --settings=tutor.production import ../data ../edx-demo-course") staff-user: ## Create a user with admin rights: make staff-user USERNAME=... EMAIL=... $(call podexec,lms,/bin/bash -c "\ ./manage.py lms manage_user --superuser --staff ${USERNAME} ${EMAIL} \ - && ./manage.py lms changepassword ${USERNAME}") + && ./manage.py lms --settings=tutor.production changepassword ${USERNAME}") ##################### Various minikube command