7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-05-28 11:50:49 +00:00

Make Xqueue an optional feature

Xqueue is no longer run by default. Instead, add the ACTIVATE_XQUEUE
environment variable to add it to the platform.
This commit is contained in:
Régis Behmo 2018-08-19 14:40:38 +02:00
parent c883af35f7
commit 8e46b4ca2b
9 changed files with 64 additions and 39 deletions

View File

@ -2,7 +2,19 @@
USERID ?= $$(id -u)
EDX_PLATFORM_SETTINGS ?= universal.production
DOCKER_COMPOSE_RUN = docker-compose run --rm
DOCKER_COMPOSE = docker-compose -f docker-compose.yml
post_configure_targets =
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
DOCKER_COMPOSE_RUN = $(DOCKER_COMPOSE) run --rm
DOCKER_COMPOSE_RUN_OPENEDX = $(DOCKER_COMPOSE_RUN) -e USERID=$(USERID) -e SETTINGS=$(EDX_PLATFORM_SETTINGS)
ifneq ($(EDX_PLATFORM_PATH),)
DOCKER_COMPOSE_RUN_OPENEDX += --volume="$(EDX_PLATFORM_PATH):/openedx/edx-platform"
@ -11,11 +23,6 @@ endif
DOCKER_COMPOSE_RUN_LMS = $(DOCKER_COMPOSE_RUN_OPENEDX) -p 8000:8000 lms
DOCKER_COMPOSE_RUN_CMS = $(DOCKER_COMPOSE_RUN_OPENEDX) -p 8001:8001 cms
post_configure_targets =
ifeq ($(ACTIVATE_HTTPS), 1)
post_configure_targets += https-certificate
endif
all: configure $(post_configure_targets) update migrate assets daemon
@echo "All set \o/ You can access the LMS at http://localhost and the CMS at http://studio.localhost"
@ -23,16 +30,18 @@ all: configure $(post_configure_targets) update migrate assets daemon
configure:
docker run --rm -it --volume="$(PWD)/config:/openedx/config" \
-e USERID=$(USERID) -e SILENT=$(SILENT) -e ACTIVATE_HTTPS=$(ACTIVATE_HTTPS) \
-e USERID=$(USERID) -e SILENT=$(SILENT) -e ACTIVATE_HTTPS=$(ACTIVATE_HTTPS) -e ACTIVATE_XQUEUE=$(ACTIVATE_XQUEUE) \
regis/openedx-configurator
update:
docker-compose pull
$(DOCKER_COMPOSE) pull
docker pull regis/openedx-configurator:hawthorn
provision:
$(DOCKER_COMPOSE_RUN) lms bash -c "dockerize -wait tcp://mysql:3306 -timeout 20s && bash /openedx/config/provision.sh"
migrate: provision migrate-openedx migrate-forum $(extra_migrate_targets)
migrate-openedx:
$(DOCKER_COMPOSE_RUN_OPENEDX) lms bash -c "dockerize -wait tcp://mysql:3306 -timeout 20s && ./manage.py lms migrate"
$(DOCKER_COMPOSE_RUN_OPENEDX) cms bash -c "dockerize -wait tcp://mysql:3306 -timeout 20s && ./manage.py cms migrate"
@ -44,8 +53,6 @@ migrate-forum:
migrate-xqueue:
$(DOCKER_COMPOSE_RUN) xqueue bash -c "./manage.py migrate"
migrate: provision migrate-openedx migrate-forum migrate-xqueue
assets:
$(DOCKER_COMPOSE_RUN_OPENEDX) -e NO_PREREQ_INSTALL=True lms paver update_assets lms --settings=$(EDX_PLATFORM_SETTINGS)
$(DOCKER_COMPOSE_RUN_OPENEDX) -e NO_PREREQ_INSTALL=True cms paver update_assets cms --settings=$(EDX_PLATFORM_SETTINGS)
@ -53,14 +60,14 @@ assets:
##################### Running
up:
docker-compose up
$(DOCKER_COMPOSE) up
daemon:
docker-compose up -d && \
$(DOCKER_COMPOSE) up -d && \
echo "Daemon is up and running"
stop:
docker-compose rm --stop --force
$(DOCKER_COMPOSE) rm --stop --force
##################### Extra
info:
@ -123,7 +130,7 @@ android-push:
android-dockerhub: android-build android-push
#################### Build images
build: build-forum build-xqueue build-openedx
build: build-openedx build-configurator build-forum build-xqueue
build-openedx:
docker build -t regis/openedx:latest -t regis/openedx:hawthorn openedx/

View File

@ -49,6 +49,12 @@ To renew the certificate, run this command once per month:
make https-certificate-renew
### Xqueue (`ACTIVATE_XQUEUE`)
[Xqueue](https://github.com/edx/xqueue) is for grading problems with external services. If you don't know what it is, you probably don't need it.
Note: in previous releases of openedx-docker, xqueue was run for all platforms. It is now an optional feature.
### Android app (beta)
The Android app for your platform can be easily built in just one command:

View File

@ -2,6 +2,7 @@
"SECRET_KEY": "{{ SECRET_KEY }}",
"AWS_ACCESS_KEY_ID": "",
"AWS_SECRET_ACCESS_KEY": "",
{% if ACTIVATE_XQUEUE %}
"XQUEUE_INTERFACE": {
"django_auth": {
"username": "{{ XQUEUE_AUTH_USERNAME }}",
@ -9,6 +10,7 @@
},
"url": "http://xqueue:8040"
},
{% endif %}
"CONTENTSTORE": {
"ENGINE": "xmodule.contentstore.mongo.MongoContentStore",
"DOC_STORE_CONFIG": {

View File

@ -2,6 +2,7 @@
"SECRET_KEY": "{{ SECRET_KEY }}",
"AWS_ACCESS_KEY_ID": "",
"AWS_SECRET_ACCESS_KEY": "",
{% if ACTIVATE_XQUEUE %}
"XQUEUE_INTERFACE": {
"django_auth": {
"username": "{{ XQUEUE_AUTH_USERNAME }}",
@ -9,6 +10,7 @@
},
"url": "http://xqueue:8040"
},
{% endif %}
"CONTENTSTORE": {
"ENGINE": "xmodule.contentstore.mongo.MongoContentStore",
"DOC_STORE_CONFIG": {

View File

@ -1,5 +1,7 @@
mysql -u root --password="{{ MYSQL_PASSWORD }}" --host "mysql" -e 'CREATE DATABASE IF NOT EXISTS {{ MYSQL_DATABASE }};'
mysql -u root --password="{{ MYSQL_PASSWORD }}" --host "mysql" -e 'GRANT ALL ON {{ MYSQL_DATABASE }}.* TO "{{ MYSQL_USERNAME }}"@"%" IDENTIFIED BY "{{ MYSQL_PASSWORD }}";'
{% if ACTIVATE_XQUEUE %}
mysql -u root --password="{{ MYSQL_PASSWORD }}" --host "mysql" -e 'CREATE DATABASE IF NOT EXISTS {{ XQUEUE_MYSQL_DATABASE }};'
mysql -u root --password="{{ MYSQL_PASSWORD }}" --host "mysql" -e 'GRANT ALL ON {{ XQUEUE_MYSQL_DATABASE }}.* TO "{{ XQUEUE_MYSQL_USERNAME }}"@"%" IDENTIFIED BY "{{ XQUEUE_MYSQL_PASSWORD }}";'
{% endif %}

View File

@ -12,6 +12,7 @@ WORKDIR /openedx
ENV SILENT=''
ENV ACTIVATE_HTTPS=''
ENV ACTIVATE_XQUEUE=''
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ./configure.py interactive ${SILENT:+--silent} && \
./configure.py substitute ./config/openedx/templates/lms.env.json.templ ./config/openedx/lms.env.json && \

View File

@ -65,6 +65,7 @@ def main():
"probably not what you want"
))
parser_interactive.add_argument('--activate-https', action='store_true', default=False, help='Activate https feature flag')
parser_interactive.add_argument('--activate-xqueue', action='store_true', default=False, help='Activate xqueue feature flag')
parser_interactive.set_defaults(func=interactive)
parser_substitute = subparsers.add_parser('substitute')
@ -119,6 +120,8 @@ def interactive(args):
'XQUEUE_SECRET_KEY', "", random_string(24),
).set(
'ACTIVATE_HTTPS', bool(args.activate_https or os.environ.get('ACTIVATE_HTTPS'))
).set(
'ACTIVATE_XQUEUE', bool(args.activate_xqueue or os.environ.get('ACTIVATE_XQUEUE'))
)
# Save values

27
docker-compose-xqueue.yml Normal file
View File

@ -0,0 +1,27 @@
version: "3"
services:
############# Xqueue: external grading of Open edX problems
xqueue:
image: regis/openedx-xqueue:hawthorn
build:
context: ./xqueue
volumes:
- ./config/xqueue:/openedx/config
- ./data/xqueue:/openedx/data
restart: unless-stopped
depends_on:
- mysql
xqueue_consumer:
image: regis/openedx-xqueue:hawthorn
build:
context: ./xqueue
volumes:
- ./config/xqueue:/openedx/config
- ./data/xqueue:/openedx/data
restart: unless-stopped
# Run 12 workers per queue
command: ./manage.py run_consumer 12
depends_on:
- mysql

View File

@ -146,28 +146,3 @@ services:
- ./data/cms_worker:/openedx/data
depends_on:
- cms
############# Xqueue: external grading of Open edX problems
xqueue:
image: regis/openedx-xqueue:hawthorn
build:
context: ./xqueue
volumes:
- ./config/xqueue:/openedx/config
- ./data/xqueue:/openedx/data
restart: unless-stopped
depends_on:
- mysql
xqueue_consumer:
image: regis/openedx-xqueue:hawthorn
build:
context: ./xqueue
volumes:
- ./config/xqueue:/openedx/config
- ./data/xqueue:/openedx/data
restart: unless-stopped
# Run 12 workers per queue
command: ./manage.py run_consumer 12
depends_on:
- mysql