mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-05 15:12:10 +00:00
Config generation with ced
Environment variables are now used in configuration files with ced.
This commit is contained in:
parent
9004335eb9
commit
3170541f91
@ -48,6 +48,7 @@ Open a python shell in the lms or the cms:
|
||||
## TODO
|
||||
|
||||
- Make sure that secret keys are not shared with the entire world
|
||||
- Don't duplicate args between containers
|
||||
- Add arguments to set domain name, platform name, etc.
|
||||
- Add documentation on host Nginx
|
||||
- Better readme
|
||||
|
@ -26,7 +26,11 @@ services:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
|
||||
nginx:
|
||||
build: ./nginx
|
||||
build:
|
||||
context: ./nginx
|
||||
args:
|
||||
lms_host: learn.overhang.io
|
||||
cms_host: studio.learn.overhang.io
|
||||
#restart: on-failure
|
||||
ports:
|
||||
- "8800:80"
|
||||
@ -52,7 +56,10 @@ services:
|
||||
build:
|
||||
context: ./edxapp
|
||||
args:
|
||||
lms_host: learn.overhang.io
|
||||
cms_host: studio.learn.overhang.io
|
||||
service_variant: lms
|
||||
secret_key: "12UyBHiBWxcPT1NP4prP5QhHc"
|
||||
#restart: on-failure
|
||||
volumes:
|
||||
- ./data/edxapp:/openedx/data
|
||||
@ -67,7 +74,10 @@ services:
|
||||
build:
|
||||
context: ./edxapp
|
||||
args:
|
||||
lms_host: learn.overhang.io
|
||||
cms_host: studio.learn.overhang.io
|
||||
service_variant: cms
|
||||
secret_key: "12UyBHiBWxcPT1NP4prP5QhHc"
|
||||
#restart: on-failure
|
||||
volumes:
|
||||
- ./data/edxapp:/openedx/data
|
||||
@ -81,7 +91,10 @@ services:
|
||||
build:
|
||||
context: ./edxapp
|
||||
args:
|
||||
lms_host: learn.overhang.io
|
||||
cms_host: studio.learn.overhang.io
|
||||
service_variant: lms
|
||||
secret_key: "12UyBHiBWxcPT1NP4prP5QhHc"
|
||||
command: ./manage.py lms --settings=production celery worker --loglevel=info --hostname=edx.lms.core.default.%%h --maxtasksperchild 100
|
||||
environment:
|
||||
C_FORCE_ROOT: "1" # run celery tasks as root #nofear
|
||||
|
@ -34,22 +34,35 @@ RUN pip install -r requirements/edx/local.txt
|
||||
RUN pip install -r requirements/edx/base.txt
|
||||
RUN pip install -r requirements/edx/post.txt
|
||||
RUN pip install -r requirements/edx/paver.txt
|
||||
# TODO install ced from pip
|
||||
RUN curl https://raw.githubusercontent.com/regisb/ced/v0.2/ced/ced > /usr/local/bin/ced
|
||||
RUN chmod a+x /usr/local/bin/ced
|
||||
|
||||
# Finish requirements install
|
||||
RUN paver install_prereqs
|
||||
|
||||
# Copy configuration files
|
||||
COPY ./config/lms.env.json /openedx/
|
||||
COPY ./config/cms.env.json /openedx/
|
||||
COPY ./config/lms.auth.json /openedx/
|
||||
COPY ./config/cms.auth.json /openedx/
|
||||
COPY ./config/production_lms.py /openedx/edx-platform/lms/envs/production.py
|
||||
COPY ./config/production_cms.py /openedx/edx-platform/cms/envs/production.py
|
||||
|
||||
############ End of code common to lms & cms
|
||||
|
||||
ARG lms_host=localhost:8000
|
||||
ARG cms_host=localhost:8000
|
||||
ARG platform_name="My Ginkgo Open edX"
|
||||
# service variang is "lms" or "cms"
|
||||
ARG service_variant
|
||||
ARG secret_key
|
||||
|
||||
# Generate configuration files
|
||||
ENV LMS_HOST=$lms_host CMS_HOST=$cms_host PLATFORM_NAME=$platform_name SECRET_KEY=$secret_key
|
||||
COPY ./config/production_lms.py /openedx/edx-platform/lms/envs/production.py
|
||||
COPY ./config/production_cms.py /openedx/edx-platform/cms/envs/production.py
|
||||
COPY ./config/lms.env.json.templ /openedx/
|
||||
COPY ./config/cms.env.json.templ /openedx/
|
||||
COPY ./config/lms.auth.json.templ /openedx/
|
||||
COPY ./config/cms.auth.json.templ /openedx/
|
||||
RUN ced /openedx/lms.env.json.templ -o /openedx/lms.env.json
|
||||
RUN ced /openedx/cms.env.json.templ -o /openedx/cms.env.json
|
||||
RUN ced /openedx/lms.auth.json.templ -o /openedx/lms.auth.json
|
||||
RUN ced /openedx/cms.auth.json.templ -o /openedx/cms.auth.json
|
||||
|
||||
|
||||
############ End of code common to lms & cms
|
||||
|
||||
# Configure environment
|
||||
ENV DJANGO_SETTINGS_MODULE ${service_variant}.envs.production
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"SECRET_KEY": "7i#nri2i@--brp0sri9qf@ewlj1qxghv0%af$sk4ntn9pv$8t#",
|
||||
"SECRET_KEY": "${SECRET_KEY}",
|
||||
"AWS_ACCESS_KEY_ID": "",
|
||||
"AWS_SECRET_ACCESS_KEY": "",
|
||||
"XQUEUE_INTERFACE": {
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"SITE_NAME": "studio.openedxdemo.overhang.io",
|
||||
"SITE_NAME": "${CMS_HOST}",
|
||||
"BOOK_URL": "",
|
||||
"LOG_DIR": "/openedx/data/logs",
|
||||
"LOGGING_ENV": "sandbox",
|
||||
"OAUTH_OIDC_ISSUER": "http://localhost:8000/oauth2",
|
||||
"PLATFORM_NAME": "Open edX Studio Demo Site (Ginkgo)",
|
||||
"PLATFORM_NAME": "${PLATFORM_NAME}",
|
||||
"FEATURES": {
|
||||
"PREVIEW_LMS_BASE": "localhost:8000"
|
||||
},
|
||||
"LMS_ROOT_URL": "http://openedxdemo.overhang.io",
|
||||
"CMS_ROOT_URL": "http://studio.openedxdemo.overhang.io",
|
||||
"CMS_BASE": "studio.openedxdemo.overhang.io",
|
||||
"LMS_BASE": "openedxdemo.overhang.io",
|
||||
"LMS_ROOT_URL": "http://${LMS_HOST}",
|
||||
"CMS_ROOT_URL": "http://${CMS_HOST}",
|
||||
"CMS_BASE": "${CMS_HOST}",
|
||||
"LMS_BASE": "${LMS_HOST}",
|
||||
"CELERY_BROKER_HOSTNAME": "rabbitmq",
|
||||
"CELERY_BROKER_TRANSPORT": "amqp",
|
||||
"MEDIA_ROOT": "/openedx/data/uploads/",
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"SECRET_KEY": "7i#nri2i@--brp0sri9qf@ewlj1qxghv0%af$sk4ntn9pv$8t#",
|
||||
"SECRET_KEY": "${SECRET_KEY}",
|
||||
"AWS_ACCESS_KEY_ID": "",
|
||||
"AWS_SECRET_ACCESS_KEY": "",
|
||||
"XQUEUE_INTERFACE": {
|
@ -1,16 +1,16 @@
|
||||
{
|
||||
"SITE_NAME": "openedxdemo.overhang.io",
|
||||
"SITE_NAME": "${LMS_HOST}",
|
||||
"BOOK_URL": "",
|
||||
"LOG_DIR": "/openedx/data/logs",
|
||||
"LOGGING_ENV": "sandbox",
|
||||
"OAUTH_OIDC_ISSUER": "http://localhost:8000/oauth2",
|
||||
"PLATFORM_NAME": "Open edX Demo Site (Ginkgo)",
|
||||
"PLATFORM_NAME": "${PLATFORM_NAME}",
|
||||
"FEATURES": {
|
||||
"PREVIEW_LMS_BASE": "openedxdemo.overhang.io"
|
||||
"PREVIEW_LMS_BASE": "${LMS_HOST}"
|
||||
},
|
||||
"LMS_ROOT_URL": "http://openedxdemo.overhang.io",
|
||||
"CMS_ROOT_URL": "http://studio.openedxdemo.overhang.io",
|
||||
"CMS_BASE": "studio.openedxdemo.overhang.io",
|
||||
"LMS_ROOT_URL": "http://${LMS_HOST}",
|
||||
"CMS_ROOT_URL": "http://${CMS_HOST}",
|
||||
"CMS_BASE": "${CMS_HOST}",
|
||||
"LMS_BASE": "openedxdemo.overhang.io",
|
||||
"CELERY_BROKER_HOSTNAME": "rabbitmq",
|
||||
"CELERY_BROKER_TRANSPORT": "amqp",
|
@ -1,6 +1,17 @@
|
||||
FROM nginx:1.13
|
||||
|
||||
VOLUME /openedx/data
|
||||
|
||||
COPY ./config/lms.conf /etc/nginx/conf.d/lms.conf
|
||||
COPY ./config/cms.conf /etc/nginx/conf.d/cms.conf
|
||||
# TODO install ced from pip
|
||||
RUN apt update
|
||||
RUN apt install -y curl python
|
||||
RUN curl https://raw.githubusercontent.com/regisb/ced/v0.2/ced/ced > /usr/local/bin/ced
|
||||
RUN chmod a+x /usr/local/bin/ced
|
||||
|
||||
ARG lms_host=localhost
|
||||
ARG cms_host=studio.$lms_host
|
||||
ENV LMS_HOST=$lms_host CMS_HOST=$cms_host
|
||||
|
||||
COPY ./config/lms.conf.templ /etc/nginx/conf.d/lms.conf.templ
|
||||
RUN ced -o /etc/nginx/conf.d/lms.conf -d £ /etc/nginx/conf.d/lms.conf.templ
|
||||
COPY ./config/cms.conf.templ /etc/nginx/conf.d/cms.conf.templ
|
||||
RUN ced -o /etc/nginx/conf.d/cms.conf -d £ /etc/nginx/conf.d/cms.conf.templ
|
||||
|
@ -4,7 +4,7 @@ upstream cms-backend {
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name studio.openedxdemo.overhang.io;
|
||||
server_name £{CMS_HOST};
|
||||
|
||||
# Prevent invalid display courseware in IE 10+ with high privacy settings
|
||||
add_header P3P 'CP="Open edX does not have a P3P policy."';
|
@ -4,7 +4,7 @@ upstream lms-backend {
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name openedxdemo.overhang.io;
|
||||
server_name £{LMS_HOST};
|
||||
|
||||
# Prevent invalid display courseware in IE 10+ with high privacy settings
|
||||
add_header P3P 'CP="Open edX does not have a P3P policy."';
|
Loading…
Reference in New Issue
Block a user