2018-09-15 10:20:35 +00:00
|
|
|
.PHONY: all android configure build update migrate assets run daemonize
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-09-04 10:13:18 +00:00
|
|
|
PWD ?= $$(pwd)
|
2018-04-30 07:01:40 +00:00
|
|
|
USERID ?= $$(id -u)
|
2018-05-16 17:02:44 +00:00
|
|
|
EDX_PLATFORM_SETTINGS ?= universal.production
|
2018-08-19 12:40:38 +00:00
|
|
|
DOCKER_COMPOSE = docker-compose -f docker-compose.yml
|
|
|
|
|
2018-09-18 18:17:42 +00:00
|
|
|
post_configure_targets =
|
|
|
|
ifneq ($(DISABLE_STATS), 1)
|
|
|
|
post_configure_targets += stats
|
|
|
|
endif
|
2018-08-19 12:40:38 +00:00
|
|
|
ifeq ($(ACTIVATE_HTTPS), 1)
|
|
|
|
post_configure_targets += https-certificate
|
|
|
|
endif
|
|
|
|
extra_migrate_targets =
|
|
|
|
ifeq ($(ACTIVATE_XQUEUE), 1)
|
|
|
|
extra_migrate_targets += migrate-xqueue
|
|
|
|
DOCKER_COMPOSE += -f docker-compose-xqueue.yml
|
|
|
|
endif
|
2018-09-15 13:19:57 +00:00
|
|
|
ifeq ($(ACTIVATE_NOTES), 1)
|
|
|
|
extra_migrate_targets += migrate-notes
|
|
|
|
DOCKER_COMPOSE += -f docker-compose-notes.yml
|
|
|
|
endif
|
2018-08-19 12:40:38 +00:00
|
|
|
|
|
|
|
DOCKER_COMPOSE_RUN = $(DOCKER_COMPOSE) run --rm
|
2018-05-27 11:30:23 +00:00
|
|
|
DOCKER_COMPOSE_RUN_OPENEDX = $(DOCKER_COMPOSE_RUN) -e USERID=$(USERID) -e SETTINGS=$(EDX_PLATFORM_SETTINGS)
|
2018-04-09 17:16:58 +00:00
|
|
|
ifneq ($(EDX_PLATFORM_PATH),)
|
2018-05-27 11:30:23 +00:00
|
|
|
DOCKER_COMPOSE_RUN_OPENEDX += --volume="$(EDX_PLATFORM_PATH):/openedx/edx-platform"
|
2018-04-09 17:16:58 +00:00
|
|
|
endif
|
|
|
|
|
2018-05-27 11:30:23 +00:00
|
|
|
DOCKER_COMPOSE_RUN_LMS = $(DOCKER_COMPOSE_RUN_OPENEDX) -p 8000:8000 lms
|
|
|
|
DOCKER_COMPOSE_RUN_CMS = $(DOCKER_COMPOSE_RUN_OPENEDX) -p 8001:8001 cms
|
2018-04-09 17:16:58 +00:00
|
|
|
|
2018-09-15 10:20:35 +00:00
|
|
|
all: configure $(post_configure_targets) update migrate assets daemonize
|
2018-07-16 17:42:39 +00:00
|
|
|
@echo "All set \o/ You can access the LMS at http://localhost and the CMS at http://studio.localhost"
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
##################### Bootstrapping
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-09-15 09:55:42 +00:00
|
|
|
configure: build-configurator
|
2018-08-05 14:40:51 +00:00
|
|
|
docker run --rm -it --volume="$(PWD)/config:/openedx/config" \
|
2018-09-15 13:19:57 +00:00
|
|
|
-e USERID=$(USERID) -e SILENT=$(SILENT) \
|
|
|
|
-e SETTING_ACTIVATE_HTTPS=$(ACTIVATE_HTTPS) -e SETTING_ACTIVATE_NOTES=$(ACTIVATE_NOTES) -e SETTING_ACTIVATE_XQUEUE=$(ACTIVATE_XQUEUE) \
|
2018-09-15 14:19:35 +00:00
|
|
|
regis/openedx-configurator:hawthorn
|
2018-09-15 09:55:42 +00:00
|
|
|
|
2018-09-18 18:17:42 +00:00
|
|
|
stats:
|
|
|
|
@docker run --rm -it --volume="$(PWD)/config:/openedx/config" \
|
|
|
|
regis/openedx-configurator:hawthorn /openedx/config/openedx/stats 2> /dev/null|| true
|
|
|
|
|
2018-09-15 09:55:42 +00:00
|
|
|
update:
|
2018-08-19 12:40:38 +00:00
|
|
|
$(DOCKER_COMPOSE) pull
|
2018-09-06 05:35:26 +00:00
|
|
|
|
2018-09-15 18:25:13 +00:00
|
|
|
migrate: provision-database migrate-openedx migrate-forum $(extra_migrate_targets) provision-oauth2
|
|
|
|
provision-database:
|
2018-09-16 11:24:17 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN) lms /openedx/config/provision.sh
|
2018-09-15 18:25:13 +00:00
|
|
|
provision-oauth2:
|
2018-09-15 13:19:57 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN) lms /openedx/config/oauth2.sh
|
2018-08-19 12:40:38 +00:00
|
|
|
|
2018-06-02 01:29:53 +00:00
|
|
|
migrate-openedx:
|
2018-09-15 09:55:42 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN) lms bash -c "dockerize -wait tcp://mysql:3306 -timeout 20s && ./manage.py lms migrate"
|
|
|
|
$(DOCKER_COMPOSE_RUN) cms bash -c "dockerize -wait tcp://mysql:3306 -timeout 20s && ./manage.py cms migrate"
|
|
|
|
$(MAKE) reindex-courses
|
2018-05-27 11:30:23 +00:00
|
|
|
|
|
|
|
migrate-forum:
|
|
|
|
$(DOCKER_COMPOSE_RUN) forum bash -c "bundle exec rake search:initialize && \
|
|
|
|
bundle exec rake search:rebuild_index"
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-09-15 13:19:57 +00:00
|
|
|
migrate-notes:
|
|
|
|
$(DOCKER_COMPOSE_RUN) notes ./manage.py migrate
|
|
|
|
|
2018-06-02 01:29:53 +00:00
|
|
|
migrate-xqueue:
|
2018-09-15 09:55:42 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN) xqueue ./manage.py migrate
|
|
|
|
|
|
|
|
reindex-courses:
|
|
|
|
$(DOCKER_COMPOSE_RUN) cms ./manage.py cms reindex_course --all --setup
|
2018-06-02 01:29:53 +00:00
|
|
|
|
2018-09-15 13:13:37 +00:00
|
|
|
assets: assets-lms assets-cms
|
|
|
|
assets-lms:
|
2018-04-21 10:41:04 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) -e NO_PREREQ_INSTALL=True lms paver update_assets lms --settings=$(EDX_PLATFORM_SETTINGS)
|
2018-09-15 13:13:37 +00:00
|
|
|
assets-cms:
|
2018-04-21 10:41:04 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) -e NO_PREREQ_INSTALL=True cms paver update_assets cms --settings=$(EDX_PLATFORM_SETTINGS)
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
##################### Running
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-09-15 10:20:35 +00:00
|
|
|
run:
|
2018-08-19 12:40:38 +00:00
|
|
|
$(DOCKER_COMPOSE) up
|
2018-09-15 10:20:35 +00:00
|
|
|
up: run
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-09-15 10:20:35 +00:00
|
|
|
daemonize:
|
2018-08-19 12:40:38 +00:00
|
|
|
$(DOCKER_COMPOSE) up -d && \
|
2017-12-26 00:16:35 +00:00
|
|
|
echo "Daemon is up and running"
|
2018-09-15 10:20:35 +00:00
|
|
|
daemon: daemonize
|
2017-12-26 00:16:35 +00:00
|
|
|
|
|
|
|
stop:
|
2018-08-19 12:40:38 +00:00
|
|
|
$(DOCKER_COMPOSE) rm --stop --force
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
##################### Extra
|
2018-06-18 12:58:34 +00:00
|
|
|
info:
|
2018-06-18 12:20:08 +00:00
|
|
|
uname -a
|
|
|
|
@echo "-------------------------"
|
2018-09-03 05:53:34 +00:00
|
|
|
git rev-parse HEAD
|
|
|
|
@echo "-------------------------"
|
2018-06-18 12:20:08 +00:00
|
|
|
docker version
|
|
|
|
@echo "-------------------------"
|
|
|
|
docker-compose --version
|
|
|
|
@echo "-------------------------"
|
|
|
|
echo $$EDX_PLATFORM_PATH
|
|
|
|
echo $$EDX_PLATFORM_SETTINGS
|
|
|
|
|
2017-09-19 08:54:45 +00:00
|
|
|
import-demo-course:
|
2018-04-21 10:41:04 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) cms /bin/bash -c "git clone https://github.com/edx/edx-demo-course ../edx-demo-course && git -C ../edx-demo-course checkout open-release/hawthorn.beta1 && python ./manage.py cms import ../data ../edx-demo-course"
|
2018-01-29 16:18:37 +00:00
|
|
|
|
|
|
|
create-staff-user:
|
2018-05-27 11:30:23 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) lms /bin/bash -c "./manage.py lms manage_user --superuser --staff ${USERNAME} ${EMAIL} && ./manage.py lms changepassword ${USERNAME}"
|
2018-04-09 17:16:58 +00:00
|
|
|
|
|
|
|
|
2018-08-16 13:59:31 +00:00
|
|
|
##################### HTTPS
|
|
|
|
https_command = docker run --rm -it \
|
|
|
|
--volume="$(PWD)/config/letsencrypt/:/openedx/letsencrypt/config/" \
|
|
|
|
--volume="$(PWD)/data/letsencrypt/:/etc/letsencrypt/" \
|
2018-08-28 13:53:26 +00:00
|
|
|
-p "80:80"
|
2018-08-16 13:59:31 +00:00
|
|
|
certbot_image = certbot/certbot:latest
|
|
|
|
|
|
|
|
https-certificate:
|
|
|
|
$(https_command) --entrypoint "/openedx/letsencrypt/config/certonly.sh" $(certbot_image)
|
|
|
|
|
|
|
|
https-certificate-renew:
|
|
|
|
$(https_command) $(certbot_image) renew
|
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
##################### Development
|
|
|
|
|
|
|
|
lms:
|
|
|
|
$(DOCKER_COMPOSE_RUN_LMS) bash
|
|
|
|
cms:
|
|
|
|
$(DOCKER_COMPOSE_RUN_CMS) bash
|
|
|
|
|
|
|
|
lms-shell:
|
2018-05-27 11:30:23 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) lms ./manage.py lms shell
|
2018-04-09 17:16:58 +00:00
|
|
|
cms-shell:
|
2018-05-27 11:30:23 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) cms ./manage.py cms shell
|
2018-05-16 17:02:44 +00:00
|
|
|
|
|
|
|
|
2018-05-27 19:29:14 +00:00
|
|
|
#################### Android app
|
|
|
|
|
|
|
|
android:
|
|
|
|
docker-compose -f docker-compose-android.yml run --rm android
|
|
|
|
@echo "Your APK file is ready: ./data/android/edx-prod-debuggable-2.14.0.apk"
|
|
|
|
|
|
|
|
android-release:
|
|
|
|
# Note that this requires that you edit ./config/android/gradle.properties
|
|
|
|
docker-compose -f docker-compose-android.yml run --rm android ./gradlew assembleProdRelease
|
|
|
|
|
|
|
|
android-build:
|
|
|
|
docker build -t regis/openedx-android:latest android/
|
|
|
|
android-push:
|
|
|
|
docker push regis/openedx-android:latest
|
|
|
|
android-dockerhub: android-build android-push
|
|
|
|
|
2018-08-05 14:40:51 +00:00
|
|
|
#################### Build images
|
2018-09-15 13:19:57 +00:00
|
|
|
build: build-openedx build-configurator build-forum build-notes build-xqueue
|
2018-05-27 19:29:14 +00:00
|
|
|
|
2018-08-05 14:40:51 +00:00
|
|
|
build-openedx:
|
2018-04-21 10:41:04 +00:00
|
|
|
docker build -t regis/openedx:latest -t regis/openedx:hawthorn openedx/
|
2018-08-05 14:40:51 +00:00
|
|
|
build-configurator:
|
|
|
|
docker build -t regis/openedx-configurator:latest -t regis/openedx-configurator:hawthorn configurator/
|
|
|
|
build-forum:
|
2018-04-21 10:41:04 +00:00
|
|
|
docker build -t regis/openedx-forum:latest -t regis/openedx-forum:hawthorn forum/
|
2018-09-15 13:19:57 +00:00
|
|
|
build-notes:
|
|
|
|
docker build -t regis/openedx-notes:latest -t regis/openedx-notes:hawthorn notes/
|
2018-08-05 14:40:51 +00:00
|
|
|
build-xqueue:
|
2018-04-21 10:41:04 +00:00
|
|
|
docker build -t regis/openedx-xqueue:latest -t regis/openedx-xqueue:hawthorn xqueue/
|
2018-05-16 17:02:44 +00:00
|
|
|
|
2018-08-05 14:40:51 +00:00
|
|
|
#################### Deploying to docker hub
|
2018-09-15 18:31:49 +00:00
|
|
|
push: push-openedx push-forum push-notes push-xqueue push-configurator
|
2018-08-05 14:40:51 +00:00
|
|
|
push-openedx:
|
2018-04-21 10:41:04 +00:00
|
|
|
docker push regis/openedx:hawthorn
|
2018-05-16 17:35:18 +00:00
|
|
|
docker push regis/openedx:latest
|
2018-08-05 14:40:51 +00:00
|
|
|
push-configurator:
|
|
|
|
docker push regis/openedx-configurator:hawthorn
|
|
|
|
docker push regis/openedx-configurator:latest
|
|
|
|
push-forum:
|
2018-04-21 10:41:04 +00:00
|
|
|
docker push regis/openedx-forum:hawthorn
|
2018-05-27 11:30:23 +00:00
|
|
|
docker push regis/openedx-forum:latest
|
2018-09-15 13:19:57 +00:00
|
|
|
push-notes:
|
|
|
|
docker push regis/openedx-notes:hawthorn
|
|
|
|
docker push regis/openedx-notes:latest
|
2018-08-05 14:40:51 +00:00
|
|
|
push-xqueue:
|
2018-04-21 10:41:04 +00:00
|
|
|
docker push regis/openedx-xqueue:hawthorn
|
2018-06-02 01:29:53 +00:00
|
|
|
docker push regis/openedx-xqueue:latest
|
2018-05-16 17:02:44 +00:00
|
|
|
|
2018-05-24 13:56:27 +00:00
|
|
|
dockerhub: build push
|