2018-05-16 17:02:44 +00:00
|
|
|
.PHONY: all configure build update migrate assets up daemon
|
2017-12-26 00:16:35 +00:00
|
|
|
|
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-05-27 11:30:23 +00:00
|
|
|
DOCKER_COMPOSE_RUN = docker-compose run --rm
|
|
|
|
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-05-27 11:30:23 +00:00
|
|
|
all: configure update migrate migrate-forum assets daemon
|
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
|
|
|
|
|
|
|
configure:
|
|
|
|
./configure
|
|
|
|
|
2018-05-16 17:02:44 +00:00
|
|
|
update:
|
|
|
|
docker-compose pull
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2017-07-19 07:42:42 +00:00
|
|
|
migrate:
|
2018-05-27 11:30:23 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) lms bash -c "wait-for-greenlight.sh && ./manage.py lms migrate"
|
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) cms bash -c "wait-for-greenlight.sh && ./manage.py cms migrate"
|
|
|
|
|
|
|
|
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
|
|
|
|
2017-07-19 07:42:42 +00:00
|
|
|
assets:
|
2018-05-27 11:30:23 +00:00
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) lms paver update_assets lms --settings=$(EDX_PLATFORM_SETTINGS)
|
|
|
|
$(DOCKER_COMPOSE_RUN_OPENEDX) 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
|
|
|
|
|
|
|
up:
|
|
|
|
docker-compose up
|
|
|
|
|
|
|
|
daemon:
|
|
|
|
docker-compose up -d && \
|
|
|
|
echo "Daemon is up and running"
|
|
|
|
|
|
|
|
stop:
|
|
|
|
docker-compose stop
|
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
##################### Extra
|
2017-09-19 08:54:45 +00:00
|
|
|
|
|
|
|
import-demo-course:
|
2018-05-27 11:30:23 +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/ginkgo.master && 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
|
|
|
|
|
|
|
|
|
|
|
##################### 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
|
|
|
|
|
|
|
|
|
|
|
#################### Deploying to docker hub
|
|
|
|
|
|
|
|
build:
|
2018-05-27 11:30:23 +00:00
|
|
|
# We need to build with docker, as long as docker-compose cannot push to dockerhub
|
2018-05-24 13:56:27 +00:00
|
|
|
docker build -t regis/openedx:latest -t regis/openedx:ginkgo openedx/
|
2018-05-27 11:30:23 +00:00
|
|
|
docker build -t regis/openedx-forum:latest -t regis/openedx-forum:ginkgo forum/
|
2018-05-16 17:02:44 +00:00
|
|
|
|
|
|
|
push:
|
2018-05-16 17:35:18 +00:00
|
|
|
docker push regis/openedx:ginkgo
|
|
|
|
docker push regis/openedx:latest
|
2018-05-27 11:30:23 +00:00
|
|
|
docker push regis/openedx-forum:ginkgo
|
|
|
|
docker push regis/openedx-forum:latest
|
2018-05-16 17:02:44 +00:00
|
|
|
|
2018-05-24 13:56:27 +00:00
|
|
|
dockerhub: build push
|