├── .circleci
└── config.yml
├── .dockerignore
├── .github
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── bin
├── clone_demo_course
├── clone_repositories
└── watch
├── config
├── cms
│ ├── __init__.py
│ ├── docker_build_development.py
│ ├── docker_build_production.py
│ ├── docker_run.py
│ ├── docker_run_ci.py
│ ├── docker_run_development.py
│ ├── docker_run_feature.py
│ ├── docker_run_preprod.py
│ ├── docker_run_production.py
│ └── docker_run_staging.py
└── lms
│ ├── __init__.py
│ ├── docker_build_development.py
│ ├── docker_build_production.py
│ ├── docker_run.py
│ ├── docker_run_ci.py
│ ├── docker_run_development.py
│ ├── docker_run_feature.py
│ ├── docker_run_preprod.py
│ ├── docker_run_production.py
│ ├── docker_run_staging.py
│ └── utils.py
├── docker-compose.yml
├── docker
└── files
│ ├── etc
│ └── nginx
│ │ └── conf.d
│ │ ├── cms.conf
│ │ └── lms.conf
│ └── usr
│ └── local
│ └── bin
│ └── entrypoint.sh
└── env.d
└── development
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | # Open edX
2 | # Docker containers CI
3 | version: 2
4 |
5 | # List openedx-docker jobs that will be integrated and executed in a workflow
6 | jobs:
7 | # Build job
8 | # Build the Docker images for production and development
9 | build:
10 | # We use the machine executor, i.e. a VM, not a container
11 | machine:
12 | # Cache docker layers so that we strongly speed up this job execution
13 | # This cache will be available to future jobs (although because jobs run
14 | # in parallel, CircleCI does not garantee that a given job will see a
15 | # specific version of the cache. See documentation for details)
16 | docker_layer_caching: true
17 |
18 | working_directory: ~/fun
19 |
20 | steps:
21 | # Checkout openedx-docker sources
22 | - checkout
23 |
24 | # Restore the ~/fun/src cached repository. If the cache does not exists for
25 | # the current .Revision (commit hash), we fall back to the latest cache
26 | # with a label matching 'edx-repository-v1-'
27 | - restore_cache:
28 | keys:
29 | - edx-repository-v1-{{ .Revision }}
30 | - edx-repository-v1-
31 |
32 | # Install a recent docker-compose release
33 | - run:
34 | name: Upgrade docker-compose
35 | command: |
36 | curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o ~/docker-compose
37 | chmod +x ~/docker-compose
38 | sudo mv ~/docker-compose /usr/local/bin/docker-compose
39 |
40 | # Clone Open edX sources
41 | - run:
42 | name: Clone Open edX platform
43 | command: |
44 | make clone
45 |
46 | # Production image build. It will be tagged as edxapp:latest
47 | - run:
48 | name: Build production image
49 | command: |
50 | make build
51 |
52 | # Development image build. It uses the Dockerfile_dev file and will
53 | # be tagged as edxapp:dev
54 | - run:
55 | name: Build development image
56 | command: |
57 | make dev-build
58 |
59 | # Cache Open edX repository (cloned in ~/fun/src) as the checkout is
60 | # rather time consuming for this project
61 | - save_cache:
62 | paths:
63 | - ~/fun/src/edx-platform/.git
64 | key: edx-repository-v1-{{ .Revision }}
65 |
66 | # Save and cache the built images to filesystem so that they will be
67 | # available to test and push them to DockerHub in subsequent jobs
68 | - run:
69 | name: Save docker images to filesystem
70 | command: |
71 | docker save -o edxapp.tar edxapp:latest edxapp:dev
72 | - save_cache:
73 | paths:
74 | - ~/fun/edxapp.tar
75 | key: edx-image-v1-{{ .Revision }}
76 |
77 | # Hub job
78 | # Load and tag production/development images to push them to Dockerhub
79 | # public registry
80 | # These images are now the latest for this branch so we will publish
81 | # both under their tag and under the `latest` tag so that our `latest`
82 | # images are always up-to-date
83 | hub:
84 | # We use the machine executor, i.e. a VM, not a container
85 | machine: true
86 |
87 | working_directory: ~/fun
88 |
89 | steps:
90 | # First, check that the BRANCH name is included in the TAG name. This is important
91 | # because we handle several important branches (master, funmooc, funwb, etc.) and
92 | # we must make sure that tag names are explicitly linked to a branch in order to
93 | # avoid conflicts
94 | - run:
95 | name: Check that the BRANCH name is included in the TAG name
96 | command: |
97 | if ! echo ${CIRCLE_TAG} | grep "${CIRCLE_BRANCH}" &> /dev/null; then
98 | # Stop the step without failing
99 | circleci step halt
100 | fi
101 |
102 | # Load the docker images from our cache to the docker engine and check that they
103 | # have been effectively loaded
104 | - restore_cache:
105 | keys:
106 | - edx-image-v1-{{ .Revision }}
107 | - run:
108 | name: Load images to docker engine
109 | command: |
110 | docker load < edxapp.tar
111 | - run:
112 | name: Check docker image tags
113 | command: |
114 | docker images edxapp:latest
115 | docker images edxapp:dev
116 |
117 | # Login to DockerHub with encrypted credentials stored as secret
118 | # environment variables (set in CircleCI project settings)
119 | - run:
120 | name: Login to DockerHub
121 | command: echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
122 |
123 | # Tag images with our DockerHub namespace (fundocker/), and list
124 | # images to check that they have been properly tagged
125 | - run:
126 | name: Tag production image
127 | command: |
128 | docker tag edxapp:latest fundocker/edxapp:${CIRCLE_TAG}
129 | docker images fundocker/edxapp:${CIRCLE_TAG}
130 |
131 | # Publish the production image to DockerHub
132 | - run:
133 | name: Publish production image
134 | command: |
135 | docker push fundocker/edxapp:${CIRCLE_TAG}
136 |
137 | # CI workflows
138 | workflows:
139 | version: 2
140 |
141 | # We have a single workflow
142 | edxapp:
143 | jobs:
144 | # The build job has no required jobs, hence this will be our first job
145 | - build:
146 | # Filtering rule to run this job: none (we accept all tags; this job
147 | # will always run).
148 | filters:
149 | tags:
150 | only: /.*/
151 |
152 | # We are pushing to Docker only images that are the result of a tag respecting the pattern:
153 | # **{branch-name}-x.y.z**
154 | #
155 | # Where branch-name is of the form: **{edx-version}[-{fork-name}]**
156 | # - **edx-version:** name of the upstream `edx-platform` version (e.g. ginkgo.1),
157 | # - **fork-name:** name of the specific project fork, if any (e.g. funwb).
158 | #
159 | # Some valid examples:
160 | # - dogwood.3-1.0.3
161 | # - dogwood.2-funmooc-17.6.1
162 | # - eucalyptus-funwb-2.3.19
163 | - hub:
164 | requires:
165 | - build
166 | filters:
167 | branches:
168 | ignore: /.*/
169 | tags:
170 | only: /^[a-z0-9.]*-?[a-z]*-(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
171 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | data/
2 | src/
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Expected Behavior
2 |
3 | Description...
4 |
5 |
6 | ## Actual Behavior
7 |
8 | Description...
9 |
10 |
11 | ## Steps to Reproduce
12 |
13 | Description...
14 |
15 | 1. item 1...
16 | 2. item 2...
17 |
18 |
19 | ## Specifications
20 |
21 | - Version: ...
22 | - Platform: ...
23 |
24 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Purpose
2 |
3 | Description...
4 |
5 |
6 | ## Proposal
7 |
8 | Description...
9 |
10 | - [] item 1...
11 | - [] item 2...
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # env
2 | .env
3 |
4 | # Byte-compiled / optimized / DLL files
5 | __pycache__/
6 | *.py[cod]
7 |
8 | # Site media
9 | /data/
10 |
11 | # Sources
12 | /src/
13 |
14 | # Unit test / coverage reports
15 | htmlcov/
16 | .coverage
17 | .cache
18 | nosetests.xml
19 | coverage.xml
20 |
21 | # Translations
22 | *.mo
23 |
24 | # Vagrant
25 | .vagrant
26 |
27 | # PyCharm IDE
28 | .idea/
29 |
30 | # Mr Developer
31 | .mr.developer.cfg
32 | .project
33 | .pydevproject
34 |
35 | # Eclipse
36 | .settings/
37 |
38 | # Rope
39 | .ropeproject
40 |
41 | # Sublime-Text:
42 | /*.sublime-project
43 | /*.sublime-workspace
44 |
45 | # TextMate 2
46 | .tm_properties
47 |
48 | # VS Code
49 | .vscode
50 |
51 | # Mac Os
52 | .DS_Store
53 |
54 | # Temp files
55 | *~
56 | .~lock*
57 |
58 | # Swap files
59 | *.sw[po]
60 |
61 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # EDX-PLATFORM multi-stage docker build
2 |
3 | # Change release to build, by providing the EDXAPP_RELEASE build argument to
4 | # your build command:
5 | #
6 | # $ docker build \
7 | # --build-arg EDXAPP_RELEASE="open-release/hawthorn.1" \
8 | # -t edxapp:hawthorn.1 \
9 | # .
10 | ARG EDXAPP_RELEASE=release-2018-08-29-14.14
11 |
12 | # === BASE ===
13 | FROM ubuntu:16.04 as base
14 |
15 | # Configure locales
16 | RUN apt-get update && \
17 | apt-get install -y gettext locales && \
18 | rm -rf /var/lib/apt/lists/*
19 | RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
20 | locale-gen
21 | ENV LANG en_US.UTF-8
22 | ENV LANGUAGE en_US:en
23 | ENV LC_ALL en_US.UTF-8
24 |
25 | # === DOWNLOAD ===
26 | FROM base as downloads
27 |
28 | WORKDIR /downloads
29 |
30 | # Install curl
31 | RUN apt-get update && \
32 | apt-get install -y curl
33 |
34 | # Download pip installer
35 | RUN curl -sLo get-pip.py https://bootstrap.pypa.io/get-pip.py
36 |
37 | # Download edxapp release
38 | # Get default EDXAPP_RELEASE value (defined on top)
39 | ARG EDXAPP_RELEASE
40 | RUN curl -sLo edxapp.tgz https://github.com/edx/edx-platform/archive/$EDXAPP_RELEASE.tar.gz && \
41 | tar xzf edxapp.tgz
42 |
43 |
44 | # === EDXAPP ===
45 | FROM base as edxapp
46 |
47 | # Install base system dependencies
48 | RUN apt-get update && \
49 | apt-get upgrade -y && \
50 | apt-get install -y python && \
51 | rm -rf /var/lib/apt/lists/*
52 |
53 | WORKDIR /edx/app/edxapp/edx-platform
54 |
55 | # Get default EDXAPP_RELEASE value (defined on top)
56 | ARG EDXAPP_RELEASE
57 | COPY --from=downloads /downloads/edx-platform-* .
58 |
59 | # We copy default configuration files to "/config" and we point to them via
60 | # symlinks. That allows to easily override default configurations by mounting a
61 | # docker volume.
62 | COPY ./config /config
63 | RUN ln -sf /config/lms /edx/app/edxapp/edx-platform/lms/envs/fun && \
64 | ln -sf /config/cms /edx/app/edxapp/edx-platform/cms/envs/fun
65 |
66 | # Add node_modules/.bin to the PATH so that paver-related commands can execute
67 | # node scripts
68 | ENV PATH="/edx/app/edxapp/edx-platform/node_modules/.bin:${PATH}"
69 |
70 | # === BUILDER ===
71 | FROM edxapp as builder
72 |
73 | WORKDIR /builder
74 |
75 | # Install builder system dependencies
76 | RUN apt-get update && \
77 | apt-get upgrade -y && \
78 | apt-get install -y \
79 | build-essential \
80 | gettext \
81 | git \
82 | graphviz-dev \
83 | libgeos-dev \
84 | libmysqlclient-dev \
85 | libxml2-dev \
86 | libxmlsec1-dev \
87 | nodejs \
88 | nodejs-legacy \
89 | npm \
90 | python-dev && \
91 | rm -rf /var/lib/apt/lists/*
92 |
93 | # Install the latest pip release
94 | COPY --from=downloads /downloads/get-pip.py ./get-pip.py
95 | RUN python get-pip.py
96 |
97 | WORKDIR /edx/app/edxapp/edx-platform
98 |
99 | # Install python dependencies
100 | RUN pip install --src /usr/local/src -r requirements/edx/base.txt
101 |
102 | # Install Javascript requirements
103 | RUN npm install
104 |
105 | # Update assets skipping collectstatic (it should be done during deployment)
106 | RUN NO_PREREQ_INSTALL=1 \
107 | paver update_assets --settings=fun.docker_build_production --skip-collect
108 |
109 | # FIXME: we also copy /edx/app/edxapp/staticfiles/webpack-stats.json and
110 | # /edx/app/edxapp/staticfiles/studio/webpack-stats.json files in a path that
111 | # will be collected
112 | RUN cp -R /edx/app/edxapp/staticfiles/* /edx/app/edxapp/edx-platform/common/static/
113 |
114 |
115 | # === DEVELOPMENT ===
116 | FROM builder as development
117 |
118 | ARG UID=1000
119 | ARG GID=1000
120 | ARG EDXAPP_RELEASE
121 |
122 | # Install system dependencies
123 | RUN apt-get update && \
124 | apt-get upgrade -y && \
125 | apt-get install -y \
126 | dnsutils \
127 | iputils-ping \
128 | libsqlite3-dev \
129 | mongodb \
130 | vim && \
131 | rm -rf /var/lib/apt/lists/*
132 |
133 | # To prevent permission issues related to the non-priviledged user running in
134 | # development, we will install development dependencies in a python virtual
135 | # environment belonging to that user
136 | RUN pip install virtualenv
137 |
138 | # Create the virtualenv directory where we will install python development
139 | # dependencies
140 | RUN mkdir -p /edx/app/edxapp/venv && \
141 | chown -R ${UID}:${GID} /edx/app/edxapp/venv
142 |
143 | # Change edxapp directory owner to allow the development image docker user to
144 | # perform installations from edxapp sources (yeah, I know...)
145 | RUN chown -R ${UID}:${GID} /edx/app/edxapp
146 |
147 | # Copy the entrypoint that will activate the virtualenv
148 | COPY ./docker/files/usr/local/bin/entrypoint.sh /usr/local/bin/entrypoint.sh
149 |
150 | # Switch to an un-privileged user matching the host user to prevent permission
151 | # issues with volumes (host folders)
152 | USER ${UID}:${GID}
153 |
154 | # Create the virtualenv with a non-priviledged user
155 | RUN virtualenv -p python2.7 --system-site-packages /edx/app/edxapp/venv
156 |
157 | # Install development dependencies in a virtualenv
158 | RUN bash -c "source /edx/app/edxapp/venv/bin/activate && \
159 | pip install --no-cache-dir -r requirements/edx/testing.txt && \
160 | pip install --no-cache-dir -r requirements/edx/development.txt"
161 |
162 | ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
163 |
164 |
165 | # === PRODUCTION ===
166 | FROM edxapp as production
167 |
168 | # Install runner system dependencies
169 | RUN apt-get update && \
170 | apt-get upgrade -y && \
171 | apt-get install -y \
172 | libgeos-dev \
173 | libmysqlclient20 \
174 | libxml2 \
175 | libxmlsec1-dev \
176 | nodejs \
177 | nodejs-legacy \
178 | tzdata && \
179 | rm -rf /var/lib/apt/lists/*
180 |
181 | # Copy installed dependencies
182 | COPY --from=builder /usr/local /usr/local
183 |
184 | # Copy modified sources (sic!)
185 | COPY --from=builder /edx/app/edxapp/edx-platform /edx/app/edxapp/edx-platform
186 |
187 | # Set container timezone and related timezones database and DST rules
188 | # See https://serverfault.com/a/856593
189 | ENV TZ 'Etc/UTC'
190 | RUN echo $TZ > /etc/timezone && \
191 | rm /etc/localtime && \
192 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
193 | dpkg-reconfigure -f noninteractive tzdata
194 |
195 | # Now that dependencies are installed and configuration has been set, the above
196 | # statements will run with a un-privileged user.
197 | USER 10000
198 |
199 | # To start the CMS, inject the SERVICE_VARIANT=cms environment variable
200 | # (defaults to "lms")
201 | ENV SERVICE_VARIANT=lms
202 |
203 | # Use Gunicorn in production as web server
204 | CMD DJANGO_SETTINGS_MODULE=${SERVICE_VARIANT}.envs.fun.docker_run \
205 | gunicorn --name=${SERVICE_VARIANT} --bind=0.0.0.0:8000 --max-requests=1000 ${SERVICE_VARIANT}.wsgi:application
206 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published
637 | by the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # Get local user ids
2 | UID = $(shell id -u)
3 | GID = $(shell id -g)
4 |
5 | # Docker
6 | COMPOSE = UID=$(UID) GID=$(GID) docker-compose
7 | COMPOSE_RUN = $(COMPOSE) run --rm -e HOME="/tmp"
8 | COMPOSE_EXEC = $(COMPOSE) exec
9 |
10 | # Django
11 | MANAGE_CMS = $(COMPOSE_RUN) cms python manage.py cms
12 | MANAGE_LMS = $(COMPOSE_RUN) lms python manage.py lms
13 |
14 | default: help
15 |
16 | bootstrap: tree run collectstatic migrate demo-course ## install development dependencies
17 |
18 | # Build production image. Note that the cms service uses the same image built
19 | # for the lms service.
20 | build: ## build the edxapp production image
21 | @echo "🐳 Building production image..."
22 | $(COMPOSE) build lms
23 | .PHONY: build
24 |
25 | # Build development image. Note that the cms-dev service uses the same image
26 | # built for the lms-dev service.
27 | dev-build: ## build the edxapp production image
28 | @echo "🐳 Building development image..."
29 | $(COMPOSE) build lms-dev
30 | .PHONY: dev-build
31 |
32 | clone: ## clone source repositories
33 | @./bin/clone_repositories;
34 | .PHONY: clone
35 |
36 | collectstatic: tree ## copy static assets to static root directory
37 | $(COMPOSE_RUN) lms python manage.py lms collectstatic --noinput --settings=fun.docker_run;
38 | $(COMPOSE_RUN) cms python manage.py cms collectstatic --noinput --settings=fun.docker_run;
39 | .PHONY: collectstatic
40 |
41 | create-symlinks: ## create symlinks to local configuration (mounted via a volume)
42 | $(COMPOSE_RUN) --no-deps lms-dev bash -c "\
43 | rm -f /edx/app/edxapp/edx-platform/lms/envs/fun && \
44 | rm -f /edx/app/edxapp/edx-platform/cms/envs/fun && \
45 | ln -sf /config/lms /edx/app/edxapp/edx-platform/lms/envs/fun && \
46 | ln -sf /config/cms /edx/app/edxapp/edx-platform/cms/envs/fun"
47 | .PHONY: create-symlinks
48 |
49 | demo-course: tree ## import demo course from edX repository
50 | @./bin/clone_demo_course
51 | $(COMPOSE_RUN) -v $(shell pwd)/src/edx-demo-course:/edx/app/edxapp/edx-demo-course cms \
52 | python manage.py cms import /edx/var/edxapp/data /edx/app/edxapp/edx-demo-course
53 | .PHONY: demo-course
54 |
55 | # In development, we work with local directories (on our host machine) for
56 | # static files and for edx-platform sources, and mount them in the container
57 | # (using Docker volumes). Hence, you will need to run the update_assets target
58 | # everytime you update edx-platform sources and plan to develop in it.
59 | dev-assets: tree create-symlinks ## run update_assets to copy required statics in local volumes
60 | $(COMPOSE_RUN) --no-deps lms-dev \
61 | paver update_assets --settings=fun.docker_build_development --skip-collect
62 | .PHONY: dev-assets
63 |
64 | # As we mount edx-platform as a volume in development, we need to re-create
65 | # symlinks that points to our custom configuration
66 | dev: tree create-symlinks ## start the cms and lms services (development image and servers)
67 | $(COMPOSE) up -d cms-dev # starts lms-dev as well via dependency
68 | .PHONY: dev
69 |
70 | dev-watch: tree ## start assets watcher (front-end development)
71 | $(COMPOSE_EXEC) lms-dev \
72 | paver watch_assets --settings=fun.docker_build_development
73 | .PHONY: dev-watch
74 |
75 | logs: ## get development logs
76 | $(COMPOSE) logs -f
77 | .PHONY: logs
78 |
79 | migrate: ## perform database migrations
80 | $(MANAGE_LMS) migrate;
81 | $(MANAGE_CMS) migrate;
82 | .PHONY: migrate
83 |
84 | run: tree ## start the cms and lms services (nginx + production image)
85 | $(COMPOSE) up -d nginx
86 | .PHONY: run
87 |
88 | stop: ## stop the development servers
89 | $(COMPOSE) stop
90 | .PHONY: stop
91 |
92 | superuser: ## create a super user
93 | $(MANAGE_LMS) createsuperuser
94 | .PHONY: superuser
95 |
96 | tree: ## create data directories mounted as volumes
97 | bash -c "mkdir -p data/{static/production,static/development,media,store}"
98 | .PHONY: tree
99 |
100 | help:
101 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
102 | .PHONY: help
103 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Open edX Docker
2 |
3 | France Université Numérique introduces an alternative `Docker` approach to
4 | install a complete and customized version of [Open edX](https://open.edx.org).
5 |
6 | The idea is to handcraft a `Dockerfile`, in order to make the project simpler,
7 | more flexible and fully operable by developers.
8 |
9 | We hope this kind of `Docker` configuration can soon be included in the
10 | edx-platform repository itself.
11 |
12 | ## Approach
13 |
14 | This project builds a docker image that is ready for production.
15 |
16 | At France Université Numérique, we are deploying Open edX Docker to OpenShift,
17 | for many customers and in multiple environments using
18 | [Arnold](https://github.com/openfun/arnold):
19 |
20 | - The Open edX settings were polished to unlock powerful configuration
21 | management features: sensible defaults, flexible overrides using YAML files
22 | and/or environment variables, secure credentials using Ansible Vault and PGP
23 | keys,
24 | - We focused on a best practice installation of `edxapp`, the core Open edX
25 | application. You can build you own image by adding specific Xblocks or Django
26 | apps in a `Dockerfile` inheriting from this one (see
27 | for an example).
28 |
29 | Docker compose is only used for development purposes so that we can code locally
30 | and see our changes immediately:
31 |
32 | - sources and configuration files are mounted from the host,
33 | - the Docker CMD launches Django's development server instead of `gunicorn`,
34 | - ports are opened on the application containers to allow bypassing `nginx`.
35 |
36 | Docker compose also allows us to run a complete project in development,
37 | including database services which in production are not run on Docker. See the
38 | [docker-compose file](./docker-compose.yml) for details on each service:
39 |
40 | - **mysql:** the SQL database used to structure and persist the application
41 | data,
42 | - **mongodb:** the no-SQL database used to store course content,
43 | - **memcached:** the cache engine,
44 | - **lms:** the Django web application used by learners,
45 | - **cms:** the Django web application used by teachers,
46 | - **forum:** the Ruby web application serving the discussion forum, **TODO**
47 | - **ecommerce:** the Django web application used for payments, **TODO**
48 | - **xqueue:** the interface for the LMS to communicate with external grader
49 | services, **TODO**
50 | - **nginx:** the front end web server configured to serve static/media files and
51 | proxy other requests to Django.
52 |
53 | ## Alternative projects
54 |
55 | If what you're looking for is a quick 1-click installation of the complete
56 | Open edX stack, you may take a look at Régis Behmo's work
57 | [here](https://github.com/regisb/openedx-docker).
58 |
59 | ## Getting started
60 |
61 | Make sure you have a recent version of [Docker](https://docs.docker.com/install) and [Docker Compose](https://docs.docker.com/compose/install) installed on your laptop:
62 |
63 | $ docker -v
64 | Docker version 17.12.0-ce, build c97c6d6
65 |
66 | $ docker-compose --version
67 | docker-compose version 1.17.1, build 6d101fb
68 |
69 | ⚠️ `Docker Compose` version 1.19 is not supported because of a bug (see
70 | https://github.com/docker/compose/issues/5686). Please downgrade to 1.18 or
71 | upgrade to a higher version.
72 |
73 | Start the full project by running:
74 |
75 | ```bash
76 | $ make bootstrap
77 | ```
78 |
79 | You should now be able to view the web applications:
80 |
81 | - LMS served by nginx at: [http://localhost:8073](http://localhost:8073)
82 | - CMS served by nginx at: [http://localhost:8083](http://localhost:8083)
83 |
84 | See other available commands by running:
85 |
86 | ```bash
87 | $ make --help
88 | ```
89 |
90 | ## Developer guide
91 |
92 | If you intend to work on edx-platform or its configuration, you'll first need to
93 | clone the git repository locally and compile static files in local directories
94 | that are mounted as docker volumes in the target container:
95 |
96 | ```bash
97 | $ make clone
98 | $ make dev-assets
99 | ```
100 |
101 | **Tip:** you will need to update assets at every new `edx-platform` checkout.
102 |
103 | Now you can start services development server _via_:
104 |
105 | ```bash
106 | $ make dev
107 | ```
108 |
109 | You should be able to view the web applications:
110 |
111 | - LMS served by runserver at: [http://localhost:8072](http://localhost:8072)
112 | - CMS served by runserver at: [http://localhost:8082](http://localhost:8082)
113 |
114 | ### Hacking with themes
115 |
116 | To work on a particular theme, we invite you to use the `paver watch_assets`
117 | command; _e.g._:
118 |
119 | ```bash
120 | $ make dev-watch
121 | ```
122 |
123 | **Troubleshooting**: if the command above raises the following error:
124 |
125 | ```
126 | OSError: inotify watch limit reached
127 | ```
128 |
129 | Then you will need to increase the **host**'s `fs.inotify.max_user_watches` kernel
130 | setting (for reference, see https://unix.stackexchange.com/a/13757):
131 |
132 | ```conf
133 | # /etc/sysctl.conf (debian based)
134 | fs.inotify.max_user_watches=524288
135 | ```
136 |
137 | # Docker images
138 |
139 | The plan is to prepare several flavors of images, the docker files and settings
140 | of which are living in their own branch (e.g. ginkgo.1, eucalyptus-funwb,
141 | dogwood-funmooc,...)
142 |
143 | Branch names on the current repository are of the form:
144 | **{edx-version}[-{fork-name}]** Two words separated by a dash, the second word
145 | being optional:
146 |
147 | - **edx-version:** name of the upstream `edx-platform` version (e.g. ginkgo.1),
148 | - **fork-name:** name of the specific project fork, if any (e.g. funwb).
149 |
150 | We are pushing to `DockerHub` only images that are the result of a tag
151 | respecting the pattern: **{branch-name}-x.y.z**
152 |
153 | Here are some valid examples:
154 |
155 | - dogwood.3-1.0.3
156 | - dogwood.2-funmooc-17.6.1
157 | - eucalyptus-funwb-2.3.19
158 |
159 | Each time we push to `DockerHub` the new version of an image, we also update the
160 | `latest` version so that our `latest` images are always up-to-date:
161 |
162 | - eucalyptus-funwb-2.3.19 -> eucalyptus-funwb-latest
163 | - eucalyptus-funwb-2.3.19-dev -> eucalyptus-funwb-latest-dev
164 |
165 | ## License
166 |
167 | The code in this repository is licensed under the GNU AGPL-3.0 terms unless
168 | otherwise noted.
169 |
170 | Please see `LICENSE` for details.
171 |
--------------------------------------------------------------------------------
/bin/clone_demo_course:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | RELEASE="${1:-master}"
4 |
5 | echo -e "📦 Getting edx-demo-course..."
6 | # Clone it from here to get a better message in command line
7 | git clone --depth 1 https://github.com/edx/edx-demo-course.git src/edx-demo-course
8 | cd src/edx-demo-course
9 | # Better do the checkout separately from the clone so that if the repository
10 | # already exists, the checkout is still done to the branch we want.
11 | echo -e "✅ Checking out release: ${RELEASE}"
12 | git checkout "${RELEASE}"
13 | git clean -fdx
14 |
--------------------------------------------------------------------------------
/bin/clone_repositories:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | RELEASE="${1:-release-2018-08-29-14.14}"
4 |
5 | echo -e "📦 Cloning edx-platform (release: ${RELEASE})..."
6 | # Clone it from here to get a better message in command line
7 | git clone --no-checkout --depth 1 https://github.com/edx/edx-platform.git src/edx-platform
8 | cd src/edx-platform
9 | # Create both remotes for CI as other branches may have created/used them and it
10 | # was saved in cache.
11 | git remote add edx https://github.com/edx/edx-platform.git
12 | git remote add openfun https://github.com/openfun/edx-platform.git
13 | # Better do the checkout separately from the clone so that if the repository
14 | # already exists, the checkout is still done to the branch we want.
15 | echo -e "🔖 Fetching tags..."
16 | git fetch edx "${RELEASE}"
17 | echo -e "✅ Checking out release: ${RELEASE}"
18 | git checkout -f "${RELEASE}"
19 | echo -e "🛀 Cleaning local clone..."
20 | git clean -fdx
21 |
--------------------------------------------------------------------------------
/bin/watch:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | THEME="${1:-red-theme}"
4 |
5 | docker-compose run --rm --no-deps lms-dev \
6 | paver watch_assets \
7 | --settings=fun.docker_build_development \
8 | --theme-dirs=/edx/app/edxapp/edx-platform/themes \
9 | --themes="${THEME}"
10 |
--------------------------------------------------------------------------------
/config/cms/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FIRSTdotorg/openedx-docker/6feedeb20aad7b8203d91f17ecf05d267dc8eb70/config/cms/__init__.py
--------------------------------------------------------------------------------
/config/cms/docker_build_development.py:
--------------------------------------------------------------------------------
1 | # This is a minimal settings file allowing us to run "update_assets"
2 | # in the Dockerfile for the development image of the edxapp CMS
3 |
4 | from .docker_build_production import *
5 |
6 | DEBUG = True
7 | REQUIRE_DEBUG = True
8 |
9 | WEBPACK_CONFIG_PATH = "webpack.dev.config.js"
10 |
--------------------------------------------------------------------------------
/config/cms/docker_build_production.py:
--------------------------------------------------------------------------------
1 | # This is a minimal settings file allowing us to run "update_assets"
2 | # in the Dockerfile for the production image of the edxapp CMS
3 |
4 | from openedx.core.lib.derived import derive_settings
5 |
6 | from lms.envs.fun.utils import Configuration
7 | from path import Path as path
8 |
9 | from ..common import *
10 |
11 | # Load custom configuration parameters
12 | config = Configuration()
13 |
14 | DATABASES = {"default": {}}
15 |
16 | XQUEUE_INTERFACE = {"url": None, "django_auth": None}
17 |
18 | # We need to override STATIC_ROOT because for CMS, edX appends the value of
19 | # "EDX_PLATFORM_REVISION" to it by default and we don't want to use this.
20 | # We should use Django's ManifestStaticFilesStorage for this purpose.
21 | STATIC_URL = "/static/studio/"
22 | STATIC_ROOT = path("/edx/app/edxapp/staticfiles/studio")
23 |
24 | # Allow setting a custom theme
25 | DEFAULT_SITE_THEME = config("DEFAULT_SITE_THEME", default=None)
26 |
27 | ########################## Derive Any Derived Settings #######################
28 |
29 | derive_settings(__name__)
30 |
--------------------------------------------------------------------------------
/config/cms/docker_run.py:
--------------------------------------------------------------------------------
1 | # This file is meant to import the environment related settings file
2 |
3 | from docker_run_production import *
4 |
--------------------------------------------------------------------------------
/config/cms/docker_run_ci.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `CI` environment for the CMS, starting from
2 | # the settings of the `production` environment
3 |
4 | from docker_run_production import *
5 |
6 |
7 | DEBUG = True
8 |
9 | EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
10 |
11 | PIPELINE_ENABLED = False
12 | STATICFILES_STORAGE = "openedx.core.storage.DevelopmentStorage"
13 |
14 | ALLOWED_HOSTS = ["*"]
15 |
--------------------------------------------------------------------------------
/config/cms/docker_run_development.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `development` environment for the CMS, starting from
2 | # the settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from lms.envs.fun.utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "development"
11 |
12 | DEBUG = True
13 | REQUIRE_DEBUG = True
14 |
15 | EMAIL_BACKEND = config(
16 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
17 | )
18 |
19 |
20 | PIPELINE_ENABLED = False
21 | STATICFILES_STORAGE = "openedx.core.storage.DevelopmentStorage"
22 |
23 | ALLOWED_HOSTS = ["*"]
24 |
--------------------------------------------------------------------------------
/config/cms/docker_run_feature.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `feature` environment for the CMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from lms.envs.fun.utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "feature"
11 |
12 | EMAIL_BACKEND = config(
13 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
14 | )
15 |
--------------------------------------------------------------------------------
/config/cms/docker_run_preprod.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `preprod` environment for the CMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from lms.envs.fun.utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "preprod"
11 |
12 | EMAIL_BACKEND = config(
13 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
14 | )
15 |
--------------------------------------------------------------------------------
/config/cms/docker_run_production.py:
--------------------------------------------------------------------------------
1 | """
2 | This is the settings to run the Open edX CMS with Docker the FUN way.
3 | """
4 |
5 | import json
6 | import os
7 | import platform
8 |
9 | from lms.envs.fun.utils import Configuration
10 | from openedx.core.lib.derived import derive_settings
11 | from path import Path as path
12 | from xmodule.modulestore.modulestore_settings import (
13 | convert_module_store_setting_if_needed
14 | )
15 |
16 | from ..common import *
17 |
18 |
19 | # Load custom configuration parameters from yaml files
20 | config = Configuration(os.path.dirname(__file__))
21 |
22 | # edX has now started using "settings.ENV_TOKENS" and "settings.AUTH_TOKENS" everywhere in the
23 | # project, not just in the settings. Let's make sure our settings still work in this case
24 | ENV_TOKENS = config
25 | AUTH_TOKENS = config
26 |
27 | ############### ALWAYS THE SAME ################################
28 |
29 | RELEASE = config("RELEASE", default=None)
30 | DEBUG = False
31 |
32 | # IMPORTANT: With this enabled, the server must always be behind a proxy that
33 | # strips the header HTTP_X_FORWARDED_PROTO from client requests. Otherwise,
34 | # a user can fool our server into thinking it was an https connection.
35 | # See
36 | # https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header
37 | # for other warnings.
38 | SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
39 |
40 | ###################################### CELERY ################################
41 |
42 | CELERY_ALWAYS_EAGER = config("CELERY_ALWAYS_EAGER", default=False, formatter=bool)
43 |
44 | # Don't use a connection pool, since connections are dropped by ELB.
45 | BROKER_POOL_LIMIT = 0
46 | BROKER_CONNECTION_TIMEOUT = 1
47 |
48 | # For the Result Store, use the django cache named 'celery'
49 | CELERY_RESULT_BACKEND = "djcelery.backends.cache:CacheBackend"
50 |
51 | # When the broker is behind an ELB, use a heartbeat to refresh the
52 | # connection and to detect if it has been dropped.
53 | BROKER_HEARTBEAT = 60.0
54 | BROKER_HEARTBEAT_CHECKRATE = 2
55 |
56 | # Each worker should only fetch one message at a time
57 | CELERYD_PREFETCH_MULTIPLIER = 1
58 |
59 | # Celery queues
60 | DEFAULT_PRIORITY_QUEUE = config(
61 | "DEFAULT_PRIORITY_QUEUE", default="edx.cms.core.default"
62 | )
63 | HIGH_PRIORITY_QUEUE = config("HIGH_PRIORITY_QUEUE", default="edx.cms.core.high")
64 | LOW_PRIORITY_QUEUE = config("LOW_PRIORITY_QUEUE", default="edx.cms.core.low")
65 |
66 | CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE
67 | CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
68 |
69 | CELERY_QUEUES = config(
70 | "CELERY_QUEUES",
71 | default={
72 | DEFAULT_PRIORITY_QUEUE: {},
73 | HIGH_PRIORITY_QUEUE: {},
74 | LOW_PRIORITY_QUEUE: {},
75 | },
76 | formatter=json.loads,
77 | )
78 |
79 | CELERY_ROUTES = "cms.celery.Router"
80 |
81 | # Force accepted content to "json" only. If we also accept pickle-serialized
82 | # messages, the worker will crash when it's running with a privileged user (even
83 | # if it's not the root user but a user belonging to the root group, which is the
84 | # case with OpenShift for example).
85 | CELERY_ACCEPT_CONTENT = ["json"]
86 |
87 | ############# NON-SECURE ENV CONFIG ##############################
88 | # Things like server locations, ports, etc.
89 |
90 | # DEFAULT_COURSE_ABOUT_IMAGE_URL specifies the default image to show for courses that don't
91 | # provide one
92 | DEFAULT_COURSE_ABOUT_IMAGE_URL = config(
93 | "DEFAULT_COURSE_ABOUT_IMAGE_URL", default=DEFAULT_COURSE_ABOUT_IMAGE_URL
94 | )
95 |
96 | DEFAULT_COURSE_VISIBILITY_IN_CATALOG = config(
97 | "DEFAULT_COURSE_VISIBILITY_IN_CATALOG", default=DEFAULT_COURSE_VISIBILITY_IN_CATALOG
98 | )
99 |
100 | # DEFAULT_MOBILE_AVAILABLE specifies if the course is available for mobile by default
101 | DEFAULT_MOBILE_AVAILABLE = config(
102 | "DEFAULT_MOBILE_AVAILABLE", default=DEFAULT_MOBILE_AVAILABLE, formatter=bool
103 | )
104 |
105 | # GITHUB_REPO_ROOT is the base directory
106 | # for course data
107 | GITHUB_REPO_ROOT = config("GITHUB_REPO_ROOT", default=GITHUB_REPO_ROOT)
108 |
109 | STATIC_URL = "/static/studio/"
110 | STATIC_ROOT_BASE = path("/edx/app/edxapp/staticfiles")
111 | STATIC_ROOT = path("/edx/app/edxapp/staticfiles/studio")
112 |
113 | WEBPACK_LOADER["DEFAULT"]["STATS_FILE"] = STATIC_ROOT / "webpack-stats.json"
114 |
115 | EMAIL_BACKEND = config(
116 | "EMAIL_BACKEND", default="django.core.mail.backends.smtp.EmailBackend"
117 | )
118 | EMAIL_FILE_PATH = config("EMAIL_FILE_PATH", default=None)
119 |
120 | EMAIL_HOST = config("EMAIL_HOST", default="localhost")
121 | EMAIL_PORT = config("EMAIL_PORT", default=25, formatter=int)
122 | EMAIL_USE_TLS = config("EMAIL_USE_TLS", default=False, formatter=bool)
123 |
124 | LMS_BASE = config("LMS_BASE", default="localhost:8072")
125 | CMS_BASE = config("CMS_BASE", default="localhost:8082")
126 |
127 | LMS_ROOT_URL = config("LMS_ROOT_URL", default="http://localhost:8072")
128 | LMS_INTERNAL_ROOT_URL = config("LMS_INTERNAL_ROOT_URL", default=LMS_ROOT_URL)
129 | ENTERPRISE_API_URL = config(
130 | "ENTERPRISE_API_URL", default=LMS_INTERNAL_ROOT_URL + "/enterprise/api/v1/"
131 | )
132 | ENTERPRISE_CONSENT_API_URL = config(
133 | "ENTERPRISE_CONSENT_API_URL", default=LMS_INTERNAL_ROOT_URL + "/consent/api/v1/"
134 | )
135 |
136 | SITE_NAME = config("SITE_NAME", default=CMS_BASE)
137 |
138 | ALLOWED_HOSTS = config(
139 | "ALLOWED_HOSTS",
140 | default=[CMS_BASE.split(":")[0]],
141 | formatter=json.loads
142 | )
143 |
144 | LOG_DIR = config("LOG_DIR", default="/edx/var/logs/edx")
145 |
146 | MEMCACHED_HOST = config("MEMCACHED_HOST", default="memcached")
147 | MEMCACHED_PORT = config("MEMCACHED_PORT", default=11211, formatter=int)
148 |
149 | CACHES = config(
150 | "CACHES",
151 | default={
152 | "loc_cache": {
153 | "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
154 | "LOCATION": "edx_location_mem_cache",
155 | },
156 | "default": {
157 | "BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
158 | "LOCATION": "{}:{}".format(MEMCACHED_HOST, MEMCACHED_PORT),
159 | }
160 | },
161 | formatter=json.loads,
162 | )
163 |
164 | SESSION_COOKIE_DOMAIN = config("SESSION_COOKIE_DOMAIN", default=None)
165 | SESSION_COOKIE_HTTPONLY = config(
166 | "SESSION_COOKIE_HTTPONLY", default=True, formatter=bool
167 | )
168 | SESSION_ENGINE = config(
169 | "SESSION_ENGINE", default="django.contrib.sessions.backends.cache"
170 | )
171 | SESSION_COOKIE_SECURE = config(
172 | "SESSION_COOKIE_SECURE", default=SESSION_COOKIE_SECURE, formatter=bool
173 | )
174 | SESSION_SAVE_EVERY_REQUEST = config(
175 | "SESSION_SAVE_EVERY_REQUEST", default=SESSION_SAVE_EVERY_REQUEST, formatter=bool
176 | )
177 |
178 | # social sharing settings
179 | SOCIAL_SHARING_SETTINGS = config(
180 | "SOCIAL_SHARING_SETTINGS", default=SOCIAL_SHARING_SETTINGS, formatter=json.loads
181 | )
182 |
183 | REGISTRATION_EMAIL_PATTERNS_ALLOWED = config(
184 | "REGISTRATION_EMAIL_PATTERNS_ALLOWED", default=None, formatter=json.loads
185 | )
186 |
187 | # allow for environments to specify what cookie name our login subsystem should use
188 | # this is to fix a bug regarding simultaneous logins between edx.org and edge.edx.org which can
189 | # happen with some browsers (e.g. Firefox)
190 | if config("SESSION_COOKIE_NAME", default=None):
191 | # NOTE, there's a bug in Django (http://bugs.python.org/issue18012) which necessitates this
192 | # being a str()
193 | SESSION_COOKIE_NAME = str(config("SESSION_COOKIE_NAME"))
194 |
195 | # Set the names of cookies shared with the marketing site
196 | # These have the same cookie domain as the session, which in production
197 | # usually includes subdomains.
198 | EDXMKTG_LOGGED_IN_COOKIE_NAME = config(
199 | "EDXMKTG_LOGGED_IN_COOKIE_NAME", default=EDXMKTG_LOGGED_IN_COOKIE_NAME
200 | )
201 | EDXMKTG_USER_INFO_COOKIE_NAME = config(
202 | "EDXMKTG_USER_INFO_COOKIE_NAME", default=EDXMKTG_USER_INFO_COOKIE_NAME
203 | )
204 |
205 | # Determines whether the CSRF token can be transported on
206 | # unencrypted channels. It is set to False here for backward compatibility,
207 | # but it is highly recommended that this is True for environments accessed
208 | # by end users.
209 | CSRF_COOKIE_SECURE = config("CSRF_COOKIE_SECURE", default=False, formatter=bool)
210 |
211 | # Email overrides
212 | DEFAULT_FROM_EMAIL = config("DEFAULT_FROM_EMAIL", default=DEFAULT_FROM_EMAIL)
213 | DEFAULT_FEEDBACK_EMAIL = config(
214 | "DEFAULT_FEEDBACK_EMAIL", default=DEFAULT_FEEDBACK_EMAIL
215 | )
216 | ADMINS = config("ADMINS", default=ADMINS, formatter=json.loads)
217 | SERVER_EMAIL = config("SERVER_EMAIL", default=SERVER_EMAIL)
218 | MKTG_URLS = config("MKTG_URLS", default=MKTG_URLS, formatter=json.loads)
219 | TECH_SUPPORT_EMAIL = config("TECH_SUPPORT_EMAIL", default=TECH_SUPPORT_EMAIL)
220 |
221 | for name, value in config("CODE_JAIL", default={}, formatter=json.loads).items():
222 | oldvalue = CODE_JAIL.get(name)
223 | if isinstance(oldvalue, dict):
224 | for subname, subvalue in value.items():
225 | oldvalue[subname] = subvalue
226 | else:
227 | CODE_JAIL[name] = value
228 |
229 | COURSES_WITH_UNSAFE_CODE = config(
230 | "COURSES_WITH_UNSAFE_CODE", default=[], formatter=json.loads
231 | )
232 |
233 | ASSET_IGNORE_REGEX = config("ASSET_IGNORE_REGEX", default=ASSET_IGNORE_REGEX)
234 |
235 | COMPREHENSIVE_THEME_DIRS = (
236 | config(
237 | "COMPREHENSIVE_THEME_DIRS",
238 | default=COMPREHENSIVE_THEME_DIRS,
239 | formatter=json.loads,
240 | )
241 | or []
242 | )
243 |
244 | # COMPREHENSIVE_THEME_LOCALE_PATHS contain the paths to themes locale directories e.g.
245 | # "COMPREHENSIVE_THEME_LOCALE_PATHS" : [
246 | # "/edx/src/edx-themes/conf/locale"
247 | # ],
248 | COMPREHENSIVE_THEME_LOCALE_PATHS = config(
249 | "COMPREHENSIVE_THEME_LOCALE_PATHS", default=[], formatter=json.loads
250 | )
251 |
252 | DEFAULT_SITE_THEME = config("DEFAULT_SITE_THEME", default=DEFAULT_SITE_THEME)
253 | ENABLE_COMPREHENSIVE_THEMING = config(
254 | "ENABLE_COMPREHENSIVE_THEMING", default=ENABLE_COMPREHENSIVE_THEMING, formatter=bool
255 | )
256 |
257 | # Timezone overrides
258 | TIME_ZONE = config("TIME_ZONE", default=TIME_ZONE)
259 |
260 | # Push to LMS overrides
261 | GIT_REPO_EXPORT_DIR = config(
262 | "GIT_REPO_EXPORT_DIR", default="/edx/var/edxapp/export_course_repos"
263 | )
264 |
265 | # Translation overrides
266 | LANGUAGES = config("LANGUAGES", default=LANGUAGES, formatter=json.loads)
267 | LANGUAGE_CODE = config("LANGUAGE_CODE", default=LANGUAGE_CODE)
268 | LANGUAGE_COOKIE = config("LANGUAGE_COOKIE", default=LANGUAGE_COOKIE)
269 |
270 | USE_I18N = config("USE_I18N", default=USE_I18N, formatter=bool)
271 | ALL_LANGUAGES = config("ALL_LANGUAGES", default=ALL_LANGUAGES, formatter=json.loads)
272 |
273 | # Override feature by feature by whatever is being redefined in the settings.yaml file
274 | CONFIG_FEATURES = config("FEATURES", default={}, formatter=json.loads)
275 | FEATURES.update(CONFIG_FEATURES)
276 |
277 | # Additional installed apps
278 | for app in config("ADDL_INSTALLED_APPS", default=[], formatter=json.loads):
279 | INSTALLED_APPS.append(app)
280 |
281 | WIKI_ENABLED = config("WIKI_ENABLED", default=WIKI_ENABLED, formatter=bool)
282 |
283 | # Configure Logging
284 |
285 | # Default format for syslog logging
286 | standard_format = "%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s"
287 | syslog_format = (
288 | "[variant:cms][%(name)s][env:sandbox] %(levelname)s "
289 | "[{hostname} %(process)d] [%(filename)s:%(lineno)d] - %(message)s"
290 | ).format(hostname=platform.node().split(".")[0])
291 |
292 | LOGGING = {
293 | "version": 1,
294 | "disable_existing_loggers": False,
295 | "handlers": {
296 | "local": {
297 | "formatter": "syslog_format",
298 | "class": "logging.StreamHandler",
299 | "level": "INFO",
300 | },
301 | "tracking": {
302 | "formatter": "raw",
303 | "class": "logging.StreamHandler",
304 | "level": "DEBUG",
305 | },
306 | "console": {
307 | "formatter": "standard",
308 | "class": "logging.StreamHandler",
309 | "level": "INFO",
310 | },
311 | },
312 | "formatters": {
313 | "raw": {"format": "%(message)s"},
314 | "syslog_format": {"format": syslog_format},
315 | "standard": {"format": standard_format},
316 | },
317 | "filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
318 | "loggers": {
319 | "": {"level": "INFO", "propagate": False, "handlers": ["console", "local"]},
320 | "tracking": {"level": "DEBUG", "propagate": False, "handlers": ["tracking"]},
321 | },
322 | }
323 |
324 | SENTRY_DSN = config("SENTRY_DSN", default=None)
325 | if SENTRY_DSN:
326 | LOGGING["loggers"][""]["handlers"].append("sentry")
327 | LOGGING["handlers"]["sentry"] = {
328 | "class": "raven.handlers.logging.SentryHandler",
329 | "dsn": SENTRY_DSN,
330 | "level": "ERROR",
331 | "environment": "production",
332 | "release": RELEASE,
333 | }
334 |
335 | # FIXME: the PLATFORM_NAME and PLATFORM_DESCRIPTION settings should be set to lazy translatable
336 | # strings but edX tries to serialize them with a default json serializer which breaks. We should
337 | # submit a PR to fix it in edx-platform
338 | PLATFORM_NAME = config("PLATFORM_NAME", default="Your Platform Name Here")
339 | PLATFORM_DESCRIPTION = config("PLATFORM_DESCRIPTION", default="Your Platform Description Here")
340 | STUDIO_NAME = config("STUDIO_NAME", default=STUDIO_NAME)
341 | STUDIO_SHORT_NAME = config("STUDIO_SHORT_NAME", default=STUDIO_SHORT_NAME)
342 |
343 | # Event Tracking
344 | TRACKING_IGNORE_URL_PATTERNS = config(
345 | "TRACKING_IGNORE_URL_PATTERNS", default=TRACKING_IGNORE_URL_PATTERNS, formatter=json.loads
346 | )
347 |
348 | # Heartbeat
349 | HEARTBEAT_CHECKS = config(
350 | "HEARTBEAT_CHECKS", default=HEARTBEAT_CHECKS, formatter=json.loads
351 | )
352 | HEARTBEAT_EXTENDED_CHECKS = config(
353 | "HEARTBEAT_EXTENDED_CHECKS", default=HEARTBEAT_EXTENDED_CHECKS, formatter=json.loads
354 | )
355 | HEARTBEAT_CELERY_TIMEOUT = config(
356 | "HEARTBEAT_CELERY_TIMEOUT", default=HEARTBEAT_CELERY_TIMEOUT, formatter=int
357 | )
358 |
359 | # Django CAS external authentication settings
360 | CAS_EXTRA_LOGIN_PARAMS = config(
361 | "CAS_EXTRA_LOGIN_PARAMS", default=None, formatter=json.loads
362 | )
363 | if FEATURES.get("AUTH_USE_CAS"):
364 | CAS_SERVER_URL = config("CAS_SERVER_URL", default=None)
365 | AUTHENTICATION_BACKENDS = [
366 | "django.contrib.auth.backends.ModelBackend",
367 | "django_cas.backends.CASBackend",
368 | ]
369 | INSTALLED_APPS.append("django_cas")
370 | MIDDLEWARE_CLASSES.append("django_cas.middleware.CASMiddleware")
371 | CAS_ATTRIBUTE_CALLBACK = config(
372 | "CAS_ATTRIBUTE_CALLBACK", default=None, formatter=json.loads
373 | )
374 | if CAS_ATTRIBUTE_CALLBACK:
375 | import importlib
376 |
377 | CAS_USER_DETAILS_RESOLVER = getattr(
378 | importlib.import_module(CAS_ATTRIBUTE_CALLBACK["module"]),
379 | CAS_ATTRIBUTE_CALLBACK["function"],
380 | )
381 |
382 | # Specific setting for the File Upload Service to store media in a bucket.
383 | FILE_UPLOAD_STORAGE_BUCKET_NAME = config(
384 | "FILE_UPLOAD_STORAGE_BUCKET_NAME", default=FILE_UPLOAD_STORAGE_BUCKET_NAME
385 | )
386 | FILE_UPLOAD_STORAGE_PREFIX = config(
387 | "FILE_UPLOAD_STORAGE_PREFIX", default=FILE_UPLOAD_STORAGE_PREFIX
388 | )
389 |
390 | # Zendesk
391 | ZENDESK_URL = config("ZENDESK_URL", default=ZENDESK_URL)
392 | ZENDESK_CUSTOM_FIELDS = config(
393 | "ZENDESK_CUSTOM_FIELDS", default=ZENDESK_CUSTOM_FIELDS, formatter=json.loads
394 | )
395 |
396 | ################ SECURE AUTH ITEMS ###############################
397 |
398 | ############### XBlock filesystem field config ##########
399 | DJFS = config("DJFS", default=None, formatter=json.loads)
400 |
401 | EMAIL_HOST_USER = config("EMAIL_HOST_USER", default=EMAIL_HOST_USER)
402 | EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD", default=EMAIL_HOST_PASSWORD)
403 |
404 | # Note that this is the Studio key for Segment. There is a separate key for the LMS.
405 | CMS_SEGMENT_KEY = config("SEGMENT_KEY", default=None)
406 |
407 | SECRET_KEY = config("SECRET_KEY", default="ThisIsAnExampleKeyForDevPurposeOnly")
408 |
409 | DEFAULT_FILE_STORAGE = config(
410 | "DEFAULT_FILE_STORAGE", default="django.core.files.storage.FileSystemStorage"
411 | )
412 |
413 | USER_TASKS_ARTIFACT_STORAGE = COURSE_IMPORT_EXPORT_STORAGE
414 |
415 | # Databases
416 |
417 | DATABASE_ENGINE = config("DATABASE_ENGINE", default="django.db.backends.mysql")
418 | DATABASE_HOST = config("DATABASE_HOST", default="mysql")
419 | DATABASE_PORT = config("DATABASE_PORT", default=3306, formatter=int)
420 | DATABASE_NAME = config("DATABASE_NAME", default="edxapp")
421 | DATABASE_USER = config("DATABASE_USER", default="edxapp_user")
422 | DATABASE_PASSWORD = config("DATABASE_PASSWORD", default="password")
423 |
424 | DATABASES = config(
425 | "DATABASES",
426 | default={
427 | "default": {
428 | "ENGINE": DATABASE_ENGINE,
429 | "HOST": DATABASE_HOST,
430 | "PORT": DATABASE_PORT,
431 | "NAME": DATABASE_NAME,
432 | "USER": DATABASE_USER,
433 | "PASSWORD": DATABASE_PASSWORD,
434 | }
435 | },
436 | formatter=json.loads,
437 | )
438 |
439 | # Configure the MODULESTORE
440 | MODULESTORE = convert_module_store_setting_if_needed(
441 | config("MODULESTORE", default=MODULESTORE, formatter=json.loads)
442 | )
443 |
444 | MONGODB_PASSWORD = config("MONGODB_PASSWORD", default="")
445 | MONGODB_HOST = config("MONGODB_HOST", default="mongodb")
446 | MONGODB_PORT = config("MONGODB_PORT", default=27017, formatter=int)
447 | MONGODB_NAME = config("MONGODB_NAME", default="edxapp")
448 | MONGODB_USER = config("MONGODB_USER", default=None)
449 | MONGODB_SSL = config("MONGODB_SSL", default=False, formatter=bool)
450 |
451 | DOC_STORE_CONFIG = config(
452 | "DOC_STORE_CONFIG",
453 | default={
454 | "collection": "modulestore",
455 | "host": MONGODB_HOST,
456 | "port": MONGODB_PORT,
457 | "db": MONGODB_NAME,
458 | "user": MONGODB_USER,
459 | "password": MONGODB_PASSWORD,
460 | "ssl": MONGODB_SSL,
461 | },
462 | formatter=json.loads,
463 | )
464 |
465 | MODULESTORE_FIELD_OVERRIDE_PROVIDERS = config(
466 | "MODULESTORE_FIELD_OVERRIDE_PROVIDERS",
467 | default=MODULESTORE_FIELD_OVERRIDE_PROVIDERS,
468 | formatter=json.loads,
469 | )
470 |
471 | XBLOCK_FIELD_DATA_WRAPPERS = config(
472 | "XBLOCK_FIELD_DATA_WRAPPERS",
473 | default=XBLOCK_FIELD_DATA_WRAPPERS,
474 | formatter=json.loads,
475 | )
476 |
477 | CONTENTSTORE = config(
478 | "CONTENTSTORE",
479 | default={
480 | "DOC_STORE_CONFIG": DOC_STORE_CONFIG,
481 | "ENGINE": "xmodule.contentstore.mongo.MongoContentStore",
482 | },
483 | formatter=json.loads,
484 | )
485 |
486 | update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
487 |
488 | # Datadog for events!
489 | DATADOG = config("DATADOG", default={}, formatter=json.loads)
490 |
491 | # TODO: deprecated (compatibility with previous settings)
492 | DATADOG["api_key"] = config("DATADOG_API", default=None)
493 |
494 | # Celery Broker
495 | CELERY_BROKER_TRANSPORT = config("CELERY_BROKER_TRANSPORT", default="redis")
496 | CELERY_BROKER_USER = config("CELERY_BROKER_USER", default="")
497 | CELERY_BROKER_PASSWORD = config("CELERY_BROKER_PASSWORD", default="")
498 | CELERY_BROKER_HOST = config("CELERY_BROKER_HOST", default="redis")
499 | CELERY_BROKER_PORT = config("CELERY_BROKER_PORT", default=6379, formatter=int)
500 | CELERY_BROKER_VHOST = config("CELERY_BROKER_VHOST", default=0, formatter=int)
501 |
502 | BROKER_URL = "{transport}://{user}:{password}@{host}:{port}/{vhost}".format(
503 | transport=CELERY_BROKER_TRANSPORT,
504 | user=CELERY_BROKER_USER,
505 | password=CELERY_BROKER_PASSWORD,
506 | host=CELERY_BROKER_HOST,
507 | port=CELERY_BROKER_PORT,
508 | vhost=CELERY_BROKER_VHOST,
509 | )
510 | BROKER_USE_SSL = config("CELERY_BROKER_USE_SSL", default=False, formatter=bool)
511 |
512 | # Message expiry time in seconds
513 | CELERY_EVENT_QUEUE_TTL = config("CELERY_EVENT_QUEUE_TTL", default=None, formatter=int)
514 |
515 | # Queue to use for updating grades due to grading policy change
516 | POLICY_CHANGE_GRADES_ROUTING_KEY = config(
517 | "POLICY_CHANGE_GRADES_ROUTING_KEY", default=LOW_PRIORITY_QUEUE
518 | )
519 |
520 | # Event tracking
521 | TRACKING_BACKENDS.update(config("TRACKING_BACKENDS", default={}, formatter=json.loads))
522 | EVENT_TRACKING_BACKENDS["tracking_logs"]["OPTIONS"]["backends"].update(
523 | config("EVENT_TRACKING_BACKENDS", default={}, formatter=json.loads)
524 | )
525 | EVENT_TRACKING_BACKENDS["segmentio"]["OPTIONS"]["processors"][0]["OPTIONS"][
526 | "whitelist"
527 | ].extend(
528 | config("EVENT_TRACKING_SEGMENTIO_EMIT_WHITELIST", default=[], formatter=json.loads)
529 | )
530 |
531 | ##### ACCOUNT LOCKOUT DEFAULT PARAMETERS #####
532 | MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = config(
533 | "MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED", default=5, formatter=int
534 | )
535 | MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = config(
536 | "MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS", default=15 * 60, formatter=int
537 | )
538 |
539 | #### PASSWORD POLICY SETTINGS #####
540 | PASSWORD_MIN_LENGTH = config("PASSWORD_MIN_LENGTH", default=12, formatter=int)
541 | PASSWORD_MAX_LENGTH = config("PASSWORD_MAX_LENGTH", default=None, formatter=int)
542 |
543 | PASSWORD_COMPLEXITY = config(
544 | "PASSWORD_COMPLEXITY",
545 | default={"UPPER": 1, "LOWER": 1, "DIGITS": 1},
546 | formatter=json.loads,
547 | )
548 | PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD = config(
549 | "PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD",
550 | default=PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD,
551 | formatter=int,
552 | )
553 | PASSWORD_DICTIONARY = config("PASSWORD_DICTIONARY", default=[], formatter=json.loads)
554 |
555 | ### INACTIVITY SETTINGS ####
556 | SESSION_INACTIVITY_TIMEOUT_IN_SECONDS = config(
557 | "SESSION_INACTIVITY_TIMEOUT_IN_SECONDS", default=None, formatter=int
558 | )
559 |
560 | ##### X-Frame-Options response header settings #####
561 | X_FRAME_OPTIONS = config("X_FRAME_OPTIONS", default=X_FRAME_OPTIONS)
562 |
563 | ##### ADVANCED_SECURITY_CONFIG #####
564 | ADVANCED_SECURITY_CONFIG = config(
565 | "ADVANCED_SECURITY_CONFIG", default={}, formatter=json.loads
566 | )
567 |
568 | ################ ADVANCED COMPONENT/PROBLEM TYPES ###############
569 |
570 | ADVANCED_PROBLEM_TYPES = config(
571 | "ADVANCED_PROBLEM_TYPES", default=ADVANCED_PROBLEM_TYPES, formatter=json.loads
572 | )
573 |
574 | ################ VIDEO UPLOAD PIPELINE ###############
575 |
576 | VIDEO_UPLOAD_PIPELINE = config(
577 | "VIDEO_UPLOAD_PIPELINE", default=VIDEO_UPLOAD_PIPELINE, formatter=json.loads
578 | )
579 |
580 | ################ VIDEO IMAGE STORAGE ###############
581 |
582 | VIDEO_IMAGE_SETTINGS = config(
583 | "VIDEO_IMAGE_SETTINGS", default=VIDEO_IMAGE_SETTINGS, formatter=json.loads
584 | )
585 |
586 | ################ VIDEO TRANSCRIPTS STORAGE ###############
587 |
588 | VIDEO_TRANSCRIPTS_SETTINGS = config(
589 | "VIDEO_TRANSCRIPTS_SETTINGS",
590 | default=VIDEO_TRANSCRIPTS_SETTINGS,
591 | formatter=json.loads,
592 | )
593 |
594 | ################ PUSH NOTIFICATIONS ###############
595 |
596 | PARSE_KEYS = config("PARSE_KEYS", default={}, formatter=json.loads)
597 |
598 |
599 | # Video Caching. Pairing country codes with CDN URLs.
600 | # Example: {'CN': 'http://api.xuetangx.com/edx/video?s3_url='}
601 | VIDEO_CDN_URL = config("VIDEO_CDN_URL", default={}, formatter=json.loads)
602 |
603 | if FEATURES["ENABLE_COURSEWARE_INDEX"] or FEATURES["ENABLE_LIBRARY_INDEX"]:
604 | # Use ElasticSearch for the search engine
605 | SEARCH_ENGINE = "search.elastic.ElasticSearchEngine"
606 |
607 | ELASTIC_SEARCH_CONFIG = config(
608 | "ELASTIC_SEARCH_CONFIG", default=[{}], formatter=json.loads
609 | )
610 |
611 | XBLOCK_SETTINGS = config("XBLOCK_SETTINGS", default={}, formatter=json.loads)
612 | XBLOCK_SETTINGS.setdefault("VideoDescriptor", {})["licensing_enabled"] = FEATURES.get(
613 | "LICENSING", False
614 | )
615 | XBLOCK_SETTINGS.setdefault("VideoModule", {})["YOUTUBE_API_KEY"] = config(
616 | "YOUTUBE_API_KEY", default=YOUTUBE_API_KEY
617 | )
618 |
619 | ################# PROCTORING CONFIGURATION ##################
620 |
621 | PROCTORING_BACKEND_PROVIDER = config(
622 | "PROCTORING_BACKEND_PROVIDER", default=PROCTORING_BACKEND_PROVIDER
623 | )
624 | PROCTORING_SETTINGS = config(
625 | "PROCTORING_SETTINGS", default=PROCTORING_SETTINGS, formatter=json.loads
626 | )
627 |
628 | ################# MICROSITE ####################
629 | # microsite specific configurations.
630 | MICROSITE_CONFIGURATION = config(
631 | "MICROSITE_CONFIGURATION", default={}, formatter=json.loads
632 | )
633 | MICROSITE_ROOT_DIR = path(config("MICROSITE_ROOT_DIR", default=""))
634 | # this setting specify which backend to be used when pulling microsite specific configuration
635 | MICROSITE_BACKEND = config("MICROSITE_BACKEND", default=MICROSITE_BACKEND)
636 | # this setting specify which backend to be used when loading microsite specific templates
637 | MICROSITE_TEMPLATE_BACKEND = config(
638 | "MICROSITE_TEMPLATE_BACKEND", default=MICROSITE_TEMPLATE_BACKEND
639 | )
640 | # TTL for microsite database template cache
641 | MICROSITE_DATABASE_TEMPLATE_CACHE_TTL = config(
642 | "MICROSITE_DATABASE_TEMPLATE_CACHE_TTL",
643 | default=MICROSITE_DATABASE_TEMPLATE_CACHE_TTL,
644 | formatter=int,
645 | )
646 |
647 | ############################ OAUTH2 Provider ###################################
648 |
649 | # OpenID Connect issuer ID. Normally the URL of the authentication endpoint.
650 | OAUTH_OIDC_ISSUER = config("OAUTH_OIDC_ISSUER", default=None)
651 |
652 | #### JWT configuration ####
653 | JWT_AUTH.update(config("JWT_AUTH", default={}, formatter=json.loads))
654 |
655 | ######################## CUSTOM COURSES for EDX CONNECTOR ######################
656 | if FEATURES.get("CUSTOM_COURSES_EDX"):
657 | INSTALLED_APPS.append("openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig")
658 |
659 | # Partner support link for CMS footer
660 | PARTNER_SUPPORT_EMAIL = config("PARTNER_SUPPORT_EMAIL", default=PARTNER_SUPPORT_EMAIL)
661 |
662 | # Affiliate cookie tracking
663 | AFFILIATE_COOKIE_NAME = config("AFFILIATE_COOKIE_NAME", default=AFFILIATE_COOKIE_NAME)
664 |
665 | ############## Settings for Studio Context Sensitive Help ##############
666 |
667 | HELP_TOKENS_BOOKS = config(
668 | "HELP_TOKENS_BOOKS", default=HELP_TOKENS_BOOKS, formatter=json.loads
669 | )
670 |
671 | ############## Settings for CourseGraph ############################
672 | COURSEGRAPH_JOB_QUEUE = config("COURSEGRAPH_JOB_QUEUE", default=LOW_PRIORITY_QUEUE)
673 |
674 | ########## Settings for video transcript migration tasks ############
675 | VIDEO_TRANSCRIPT_MIGRATIONS_JOB_QUEUE = config(
676 | "VIDEO_TRANSCRIPT_MIGRATIONS_JOB_QUEUE", default=LOW_PRIORITY_QUEUE
677 | )
678 |
679 | ########################## Parental controls config #######################
680 |
681 | # The age at which a learner no longer requires parental consent, or None
682 | # if parental consent is never required.
683 | PARENTAL_CONSENT_AGE_LIMIT = config(
684 | "PARENTAL_CONSENT_AGE_LIMIT", default=PARENTAL_CONSENT_AGE_LIMIT, formatter=int
685 | )
686 |
687 | ########################## Extra middleware classes #######################
688 |
689 | # Allow extra middleware classes to be added to the app through configuration.
690 | MIDDLEWARE_CLASSES.extend(
691 | config("EXTRA_MIDDLEWARE_CLASSES", default=[], formatter=json.loads)
692 | )
693 |
694 | ########################## Settings for Completion API #####################
695 |
696 | # Once a user has watched this percentage of a video, mark it as complete:
697 | # (0.0 = 0%, 1.0 = 100%)
698 | COMPLETION_VIDEO_COMPLETE_PERCENTAGE = config(
699 | "COMPLETION_VIDEO_COMPLETE_PERCENTAGE",
700 | default=COMPLETION_VIDEO_COMPLETE_PERCENTAGE,
701 | formatter=float,
702 | )
703 |
704 | ####################### Enterprise Settings ######################
705 | # A shared secret to be used for encrypting passwords passed from the enterprise api
706 | # to the enteprise reporting script.
707 | ENTERPRISE_REPORTING_SECRET = config(
708 | "ENTERPRISE_REPORTING_SECRET", default=ENTERPRISE_REPORTING_SECRET
709 | )
710 |
711 | # A default dictionary to be used for filtering out enterprise customer catalog.
712 | ENTERPRISE_CUSTOMER_CATALOG_DEFAULT_CONTENT_FILTER = config(
713 | "ENTERPRISE_CUSTOMER_CATALOG_DEFAULT_CONTENT_FILTER",
714 | default=ENTERPRISE_CUSTOMER_CATALOG_DEFAULT_CONTENT_FILTER,
715 | )
716 |
717 | ############### Settings for Retirement #####################
718 | RETIRED_USERNAME_PREFIX = config(
719 | "RETIRED_USERNAME_PREFIX", default=RETIRED_USERNAME_PREFIX
720 | )
721 | RETIRED_EMAIL_PREFIX = config("RETIRED_EMAIL_PREFIX", default=RETIRED_EMAIL_PREFIX)
722 | RETIRED_EMAIL_DOMAIN = config("RETIRED_EMAIL_DOMAIN", default=RETIRED_EMAIL_DOMAIN)
723 | RETIREMENT_SERVICE_WORKER_USERNAME = config(
724 | "RETIREMENT_SERVICE_WORKER_USERNAME", default=RETIREMENT_SERVICE_WORKER_USERNAME
725 | )
726 | RETIREMENT_STATES = config(
727 | "RETIREMENT_STATES", default=RETIREMENT_STATES, formatter=json.loads
728 | )
729 |
730 | ####################### Plugin Settings ##########################
731 |
732 | from openedx.core.djangoapps.plugins import (
733 | plugin_settings,
734 | constants as plugin_constants,
735 | )
736 |
737 | plugin_settings.add_plugins(
738 | __name__, plugin_constants.ProjectType.CMS, plugin_constants.SettingsType.AWS
739 | )
740 |
741 | ########################## Derive Any Derived Settings #######################
742 |
743 | derive_settings(__name__)
744 |
--------------------------------------------------------------------------------
/config/cms/docker_run_staging.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `staging` environment for the CMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from lms.envs.fun.utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "staging"
11 |
12 | EMAIL_BACKEND = config(
13 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
14 | )
15 |
--------------------------------------------------------------------------------
/config/lms/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FIRSTdotorg/openedx-docker/6feedeb20aad7b8203d91f17ecf05d267dc8eb70/config/lms/__init__.py
--------------------------------------------------------------------------------
/config/lms/docker_build_development.py:
--------------------------------------------------------------------------------
1 | # This is a minimal settings file allowing us to run "update_assets"
2 | # in the Dockerfile for the development image of the edxapp LMS
3 |
4 | from .docker_build_production import *
5 |
6 | DEBUG = True
7 | REQUIRE_DEBUG = True
8 |
9 | WEBPACK_CONFIG_PATH = "webpack.dev.config.js"
10 |
--------------------------------------------------------------------------------
/config/lms/docker_build_production.py:
--------------------------------------------------------------------------------
1 | # This is a minimal settings file allowing us to run "update_assets"
2 | # in the Dockerfile for the production image of the edxapp LMS
3 |
4 | from openedx.core.lib.derived import derive_settings
5 | from path import Path as path
6 |
7 | from ..common import *
8 | from .utils import Configuration
9 |
10 | # Load custom configuration parameters
11 | config = Configuration()
12 |
13 | DATABASES = {"default": {}}
14 |
15 | XQUEUE_INTERFACE = {"url": None, "django_auth": None}
16 |
17 | STATIC_ROOT = path("/edx/app/edxapp/staticfiles")
18 |
19 | # Allow setting a custom theme
20 | DEFAULT_SITE_THEME = config("DEFAULT_SITE_THEME", default=None)
21 |
22 | ########################## Derive Any Derived Settings #######################
23 |
24 | derive_settings(__name__)
25 |
--------------------------------------------------------------------------------
/config/lms/docker_run.py:
--------------------------------------------------------------------------------
1 | # This file is meant to import the environment related settings file
2 |
3 | from docker_run_production import *
4 |
--------------------------------------------------------------------------------
/config/lms/docker_run_ci.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `CI` environment for the LMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 |
6 |
7 | DEBUG = True
8 |
9 | EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
10 |
11 | PIPELINE_ENABLED = False
12 | STATICFILES_STORAGE = "openedx.core.storage.DevelopmentStorage"
13 |
14 | ALLOWED_HOSTS = ["*"]
15 |
--------------------------------------------------------------------------------
/config/lms/docker_run_development.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `development` environment for the LMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from .utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "development"
11 |
12 | DEBUG = True
13 | REQUIRE_DEBUG = True
14 |
15 | EMAIL_BACKEND = config(
16 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
17 | )
18 |
19 | PIPELINE_ENABLED = False
20 | STATICFILES_STORAGE = "openedx.core.storage.DevelopmentStorage"
21 |
22 | ALLOWED_HOSTS = ["*"]
23 |
24 | WEBPACK_CONFIG_PATH = "webpack.dev.config.js"
25 |
--------------------------------------------------------------------------------
/config/lms/docker_run_feature.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `feature` environment for the LMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from .utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "feature"
11 |
12 | EMAIL_BACKEND = config(
13 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
14 | )
15 |
--------------------------------------------------------------------------------
/config/lms/docker_run_preprod.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `preprod` environment for the LMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from .utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "preprod"
11 |
12 | EMAIL_BACKEND = config(
13 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
14 | )
15 |
--------------------------------------------------------------------------------
/config/lms/docker_run_production.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | """
4 | This is the settings to run Open edX with Docker the FUN way.
5 | """
6 |
7 | import datetime
8 | import dateutil
9 | import json
10 | import os
11 | import platform
12 |
13 | from openedx.core.lib.derived import derive_settings
14 | from path import Path as path
15 | from xmodule.modulestore.modulestore_settings import (
16 | convert_module_store_setting_if_needed
17 | )
18 |
19 | from ..common import *
20 | from .utils import Configuration
21 |
22 | # Load custom configuration parameters from yaml files
23 | config = Configuration(os.path.dirname(__file__))
24 |
25 | # edX has now started using "settings.ENV_TOKENS" and "settings.AUTH_TOKENS" everywhere in the
26 | # project, not just in the settings. Let's make sure our settings still work in this case
27 | ENV_TOKENS = config
28 | AUTH_TOKENS = config
29 |
30 | ################################ ALWAYS THE SAME ##############################
31 |
32 | RELEASE = config("RELEASE", default=None)
33 | DEBUG = False
34 | DEFAULT_TEMPLATE_ENGINE["OPTIONS"]["debug"] = False
35 |
36 | SESSION_ENGINE = config(
37 | "SESSION_ENGINE", default="django.contrib.sessions.backends.cache"
38 | )
39 |
40 | # IMPORTANT: With this enabled, the server must always be behind a proxy that
41 | # strips the header HTTP_X_FORWARDED_PROTO from client requests. Otherwise,
42 | # a user can fool our server into thinking it was an https connection.
43 | # See
44 | # https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header
45 | # for other warnings.
46 | SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
47 |
48 | ###################################### CELERY ################################
49 |
50 | CELERY_ALWAYS_EAGER = config("CELERY_ALWAYS_EAGER", default=False, formatter=bool)
51 |
52 | # Don't use a connection pool, since connections are dropped by ELB.
53 | BROKER_POOL_LIMIT = 0
54 | BROKER_CONNECTION_TIMEOUT = 1
55 |
56 | # For the Result Store, use the django cache named 'celery'
57 | CELERY_RESULT_BACKEND = "djcelery.backends.cache:CacheBackend"
58 |
59 | # When the broker is behind an ELB, use a heartbeat to refresh the
60 | # connection and to detect if it has been dropped.
61 | BROKER_HEARTBEAT = 60.0
62 | BROKER_HEARTBEAT_CHECKRATE = 2
63 |
64 | # Each worker should only fetch one message at a time
65 | CELERYD_PREFETCH_MULTIPLIER = 1
66 |
67 | # Celery queues
68 |
69 | DEFAULT_PRIORITY_QUEUE = config(
70 | "DEFAULT_PRIORITY_QUEUE", default="edx.lms.core.default"
71 | )
72 | HIGH_PRIORITY_QUEUE = config("HIGH_PRIORITY_QUEUE", default="edx.lms.core.high")
73 | LOW_PRIORITY_QUEUE = config("LOW_PRIORITY_QUEUE", default="edx.lms.core.low")
74 | HIGH_MEM_QUEUE = config("HIGH_MEM_QUEUE", default="edx.lms.core.high_mem")
75 |
76 | CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE
77 | CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
78 |
79 | CELERY_QUEUES = config(
80 | "CELERY_QUEUES",
81 | default={
82 | DEFAULT_PRIORITY_QUEUE: {},
83 | HIGH_PRIORITY_QUEUE: {},
84 | LOW_PRIORITY_QUEUE: {},
85 | HIGH_MEM_QUEUE: {},
86 | },
87 | formatter=json.loads,
88 | )
89 |
90 | CELERY_ROUTES = "lms.celery.Router"
91 |
92 | # Force accepted content to "json" only. If we also accept pickle-serialized
93 | # messages, the worker will crash when it's running with a privileged user (even
94 | # if it's not the root user but a user belonging to the root group, which is our
95 | # case with OpenShift).
96 | CELERY_ACCEPT_CONTENT = ["json"]
97 |
98 | CELERYBEAT_SCHEDULE = {} # For scheduling tasks, entries can be added to this dict
99 |
100 | ########################## NON-SECURE ENV CONFIG ##############################
101 | # Things like server locations, ports, etc.
102 |
103 | STATIC_ROOT_BASE = path("/edx/app/edxapp/staticfiles")
104 | STATIC_ROOT = STATIC_ROOT_BASE
105 | STATIC_URL = "/static/"
106 |
107 | WEBPACK_LOADER["DEFAULT"]["STATS_FILE"] = STATIC_ROOT / "webpack-stats.json"
108 |
109 | MEDIA_ROOT = path("/edx/var/edxapp/media/")
110 | MEDIA_URL = "/media/"
111 |
112 | # DEFAULT_COURSE_ABOUT_IMAGE_URL specifies the default image to show for courses that don't provide one
113 | DEFAULT_COURSE_ABOUT_IMAGE_URL = config(
114 | "DEFAULT_COURSE_ABOUT_IMAGE_URL", default=DEFAULT_COURSE_ABOUT_IMAGE_URL
115 | )
116 |
117 | # COURSE_MODE_DEFAULTS specifies the course mode to use for courses that do not set one
118 | COURSE_MODE_DEFAULTS = config(
119 | "COURSE_MODE_DEFAULTS", default=COURSE_MODE_DEFAULTS, formatter=json.loads
120 | )
121 |
122 | # FIXME: the PLATFORM_NAME and PLATFORM_DESCRIPTION settings should be set to lazy translatable
123 | # strings but edX tries to serialize them with a default json serializer which breaks. We should
124 | # submit a PR to fix it in edx-platform
125 | PLATFORM_NAME = config("PLATFORM_NAME", default="Your Platform Name Here")
126 | PLATFORM_DESCRIPTION = config("PLATFORM_DESCRIPTION", default="Your Platform Description Here")
127 | PLATFORM_TWITTER_ACCOUNT = config(
128 | "PLATFORM_TWITTER_ACCOUNT", default=PLATFORM_TWITTER_ACCOUNT
129 | )
130 | PLATFORM_FACEBOOK_ACCOUNT = config(
131 | "PLATFORM_FACEBOOK_ACCOUNT", default=PLATFORM_FACEBOOK_ACCOUNT
132 | )
133 | SOCIAL_SHARING_SETTINGS = config(
134 | "SOCIAL_SHARING_SETTINGS", default=SOCIAL_SHARING_SETTINGS, formatter=json.loads
135 | )
136 |
137 | # Social media links for the page footer
138 | SOCIAL_MEDIA_FOOTER_URLS = config(
139 | "SOCIAL_MEDIA_FOOTER_URLS", default=SOCIAL_MEDIA_FOOTER_URLS, formatter=json.loads
140 | )
141 |
142 | CC_MERCHANT_NAME = config("CC_MERCHANT_NAME", default=PLATFORM_NAME)
143 | EMAIL_BACKEND = config(
144 | "EMAIL_BACKEND", default="django.core.mail.backends.smtp.EmailBackend"
145 | )
146 | EMAIL_FILE_PATH = config("EMAIL_FILE_PATH", default=None)
147 | EMAIL_HOST = config("EMAIL_HOST", default="localhost")
148 | EMAIL_PORT = config("EMAIL_PORT", default=25, formatter=int)
149 | EMAIL_USE_TLS = config("EMAIL_USE_TLS", default=False, formatter=bool)
150 | HTTPS = config("HTTPS", default=HTTPS)
151 | SESSION_COOKIE_DOMAIN = config("SESSION_COOKIE_DOMAIN", default=None)
152 | SESSION_COOKIE_HTTPONLY = config(
153 | "SESSION_COOKIE_HTTPONLY", default=True, formatter=bool
154 | )
155 | SESSION_COOKIE_SECURE = config(
156 | "SESSION_COOKIE_SECURE", default=SESSION_COOKIE_SECURE, formatter=bool
157 | )
158 | SESSION_SAVE_EVERY_REQUEST = config(
159 | "SESSION_SAVE_EVERY_REQUEST", default=SESSION_SAVE_EVERY_REQUEST, formatter=bool
160 | )
161 |
162 | REGISTRATION_EXTRA_FIELDS = config(
163 | "REGISTRATION_EXTRA_FIELDS", default=REGISTRATION_EXTRA_FIELDS, formatter=json.loads
164 | )
165 | REGISTRATION_EXTENSION_FORM = config(
166 | "REGISTRATION_EXTENSION_FORM", default=REGISTRATION_EXTENSION_FORM
167 | )
168 | REGISTRATION_EMAIL_PATTERNS_ALLOWED = config(
169 | "REGISTRATION_EMAIL_PATTERNS_ALLOWED", default=None, formatter=json.loads
170 | )
171 | REGISTRATION_FIELD_ORDER = config(
172 | "REGISTRATION_FIELD_ORDER", default=REGISTRATION_FIELD_ORDER, formatter=json.loads
173 | )
174 |
175 | # Set the names of cookies shared with the marketing site
176 | # These have the same cookie domain as the session, which in production
177 | # usually includes subdomains.
178 | EDXMKTG_LOGGED_IN_COOKIE_NAME = config(
179 | "EDXMKTG_LOGGED_IN_COOKIE_NAME", default=EDXMKTG_LOGGED_IN_COOKIE_NAME
180 | )
181 | EDXMKTG_USER_INFO_COOKIE_NAME = config(
182 | "EDXMKTG_USER_INFO_COOKIE_NAME", default=EDXMKTG_USER_INFO_COOKIE_NAME
183 | )
184 |
185 | LMS_ROOT_URL = config("LMS_ROOT_URL", default="http://localhost:8000")
186 | LMS_INTERNAL_ROOT_URL = config("LMS_INTERNAL_ROOT_URL", default=LMS_ROOT_URL)
187 |
188 | # Override feature by feature by whatever is being redefined in the settings.yaml file
189 | CONFIG_FEATURES = config("FEATURES", default={}, formatter=json.loads)
190 | FEATURES.update(CONFIG_FEATURES)
191 |
192 | LMS_BASE = config("LMS_BASE", default="localhost:8072")
193 | CMS_BASE = config("CMS_BASE", default="localhost:8082")
194 |
195 | SITE_NAME = config("SITE_NAME", default=LMS_BASE)
196 |
197 | ALLOWED_HOSTS = config(
198 | "ALLOWED_HOSTS",
199 | default=[LMS_BASE.split(":")[0]],
200 | formatter=json.loads
201 | )
202 | if FEATURES.get("PREVIEW_LMS_BASE"):
203 | ALLOWED_HOSTS.append(FEATURES["PREVIEW_LMS_BASE"])
204 |
205 | # allow for environments to specify what cookie name our login subsystem should use
206 | # this is to fix a bug regarding simultaneous logins between edx.org and edge.edx.org which can
207 | # happen with some browsers (e.g. Firefox)
208 | if config("SESSION_COOKIE_NAME", default=None):
209 | # NOTE, there's a bug in Django (http://bugs.python.org/issue18012) which necessitates this
210 | # being a str()
211 | SESSION_COOKIE_NAME = str(config("SESSION_COOKIE_NAME"))
212 |
213 | MEMCACHED_HOST = config("MEMCACHED_HOST", default="memcached")
214 | MEMCACHED_PORT = config("MEMCACHED_PORT", default=11211, formatter=int)
215 |
216 | CACHES = config(
217 | "CACHES",
218 | default={
219 | "loc_cache": {
220 | "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
221 | "LOCATION": "edx_location_mem_cache",
222 | },
223 | "default": {
224 | "BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
225 | "LOCATION": "{}:{}".format(MEMCACHED_HOST, MEMCACHED_PORT),
226 | }
227 | },
228 | formatter=json.loads,
229 | )
230 |
231 | # Email overrides
232 | DEFAULT_FROM_EMAIL = config("DEFAULT_FROM_EMAIL", default=DEFAULT_FROM_EMAIL)
233 | DEFAULT_FEEDBACK_EMAIL = config(
234 | "DEFAULT_FEEDBACK_EMAIL", default=DEFAULT_FEEDBACK_EMAIL
235 | )
236 | ADMINS = config("ADMINS", default=ADMINS, formatter=json.loads)
237 | SERVER_EMAIL = config("SERVER_EMAIL", default=SERVER_EMAIL)
238 | TECH_SUPPORT_EMAIL = config("TECH_SUPPORT_EMAIL", default=TECH_SUPPORT_EMAIL)
239 | CONTACT_EMAIL = config("CONTACT_EMAIL", default=CONTACT_EMAIL)
240 | BUGS_EMAIL = config("BUGS_EMAIL", default=BUGS_EMAIL)
241 | PAYMENT_SUPPORT_EMAIL = config("PAYMENT_SUPPORT_EMAIL", default=PAYMENT_SUPPORT_EMAIL)
242 | FINANCE_EMAIL = config("FINANCE_EMAIL", default=FINANCE_EMAIL)
243 | UNIVERSITY_EMAIL = config("UNIVERSITY_EMAIL", default=UNIVERSITY_EMAIL)
244 | PRESS_EMAIL = config("PRESS_EMAIL", default=PRESS_EMAIL)
245 |
246 | CONTACT_MAILING_ADDRESS = config(
247 | "CONTACT_MAILING_ADDRESS", default=CONTACT_MAILING_ADDRESS
248 | )
249 |
250 | # Account activation email sender address
251 | ACTIVATION_EMAIL_FROM_ADDRESS = config(
252 | "ACTIVATION_EMAIL_FROM_ADDRESS", default=DEFAULT_FROM_EMAIL
253 | )
254 |
255 | # Currency
256 | PAID_COURSE_REGISTRATION_CURRENCY = config(
257 | "PAID_COURSE_REGISTRATION_CURRENCY", default=PAID_COURSE_REGISTRATION_CURRENCY
258 | )
259 |
260 | # Payment Report Settings
261 | PAYMENT_REPORT_GENERATOR_GROUP = config(
262 | "PAYMENT_REPORT_GENERATOR_GROUP", default=PAYMENT_REPORT_GENERATOR_GROUP
263 | )
264 |
265 | # Bulk Email overrides
266 | BULK_EMAIL_DEFAULT_FROM_EMAIL = config(
267 | "BULK_EMAIL_DEFAULT_FROM_EMAIL", default=BULK_EMAIL_DEFAULT_FROM_EMAIL
268 | )
269 | BULK_EMAIL_EMAILS_PER_TASK = config(
270 | "BULK_EMAIL_EMAILS_PER_TASK", default=BULK_EMAIL_EMAILS_PER_TASK, formatter=int
271 | )
272 | BULK_EMAIL_DEFAULT_RETRY_DELAY = config(
273 | "BULK_EMAIL_DEFAULT_RETRY_DELAY",
274 | default=BULK_EMAIL_DEFAULT_RETRY_DELAY,
275 | formatter=int,
276 | )
277 | BULK_EMAIL_MAX_RETRIES = config(
278 | "BULK_EMAIL_MAX_RETRIES", default=BULK_EMAIL_MAX_RETRIES, formatter=int
279 | )
280 | BULK_EMAIL_INFINITE_RETRY_CAP = config(
281 | "BULK_EMAIL_INFINITE_RETRY_CAP",
282 | default=BULK_EMAIL_INFINITE_RETRY_CAP,
283 | formatter=int,
284 | )
285 | BULK_EMAIL_LOG_SENT_EMAILS = config(
286 | "BULK_EMAIL_LOG_SENT_EMAILS", default=BULK_EMAIL_LOG_SENT_EMAILS, formatter=bool
287 | )
288 | BULK_EMAIL_RETRY_DELAY_BETWEEN_SENDS = config(
289 | "BULK_EMAIL_RETRY_DELAY_BETWEEN_SENDS",
290 | default=BULK_EMAIL_RETRY_DELAY_BETWEEN_SENDS,
291 | formatter=int,
292 | )
293 | # We want Bulk Email running on the high-priority queue, so we define the
294 | # routing key that points to it. At the moment, the name is the same.
295 | # We have to reset the value here, since we have changed the value of the queue name.
296 | BULK_EMAIL_ROUTING_KEY = config("BULK_EMAIL_ROUTING_KEY", default=HIGH_PRIORITY_QUEUE)
297 |
298 | # We can run smaller jobs on the low priority queue. See note above for why
299 | # we have to reset the value here.
300 | BULK_EMAIL_ROUTING_KEY_SMALL_JOBS = config(
301 | "BULK_EMAIL_ROUTING_KEY_SMALL_JOBS", default=LOW_PRIORITY_QUEUE
302 | )
303 |
304 | # Queue to use for expiring old entitlements
305 | ENTITLEMENTS_EXPIRATION_ROUTING_KEY = config(
306 | "ENTITLEMENTS_EXPIRATION_ROUTING_KEY", default=LOW_PRIORITY_QUEUE
307 | )
308 |
309 | # Message expiry time in seconds
310 | CELERY_EVENT_QUEUE_TTL = config("CELERY_EVENT_QUEUE_TTL", default=None, formatter=int)
311 |
312 | # following setting is for backward compatibility
313 | if config("COMPREHENSIVE_THEME_DIR", default=None):
314 | COMPREHENSIVE_THEME_DIR = config("COMPREHENSIVE_THEME_DIR")
315 |
316 | COMPREHENSIVE_THEME_DIRS = (
317 | config(
318 | "COMPREHENSIVE_THEME_DIRS",
319 | default=COMPREHENSIVE_THEME_DIRS,
320 | formatter=json.loads,
321 | )
322 | or []
323 | )
324 |
325 | # COMPREHENSIVE_THEME_LOCALE_PATHS contain the paths to themes locale directories e.g.
326 | # "COMPREHENSIVE_THEME_LOCALE_PATHS" : [
327 | # "/edx/src/edx-themes/conf/locale"
328 | # ],
329 | COMPREHENSIVE_THEME_LOCALE_PATHS = config(
330 | "COMPREHENSIVE_THEME_LOCALE_PATHS", default=[], formatter=json.loads
331 | )
332 |
333 | DEFAULT_SITE_THEME = config("DEFAULT_SITE_THEME", default=DEFAULT_SITE_THEME)
334 | ENABLE_COMPREHENSIVE_THEMING = config(
335 | "ENABLE_COMPREHENSIVE_THEMING", default=ENABLE_COMPREHENSIVE_THEMING, formatter=bool
336 | )
337 |
338 | # Marketing link overrides
339 | MKTG_URL_LINK_MAP.update(config("MKTG_URL_LINK_MAP", default={}, formatter=json.loads))
340 |
341 | # Intentional defaults.
342 | SUPPORT_SITE_LINK = config("SUPPORT_SITE_LINK", default=SUPPORT_SITE_LINK)
343 | ID_VERIFICATION_SUPPORT_LINK = config(
344 | "ID_VERIFICATION_SUPPORT_LINK", default=SUPPORT_SITE_LINK
345 | )
346 | PASSWORD_RESET_SUPPORT_LINK = config(
347 | "PASSWORD_RESET_SUPPORT_LINK", default=SUPPORT_SITE_LINK
348 | )
349 | ACTIVATION_EMAIL_SUPPORT_LINK = config(
350 | "ACTIVATION_EMAIL_SUPPORT_LINK", default=SUPPORT_SITE_LINK
351 | )
352 |
353 | # Mobile store URL overrides
354 | MOBILE_STORE_URLS = config(
355 | "MOBILE_STORE_URLS", default=MOBILE_STORE_URLS, formatter=json.loads
356 | )
357 |
358 | # Timezone overrides
359 | TIME_ZONE = config("TIME_ZONE", default=TIME_ZONE)
360 |
361 | # Translation overrides
362 | LANGUAGES = config("LANGUAGES", default=LANGUAGES, formatter=json.loads)
363 | CERTIFICATE_TEMPLATE_LANGUAGES = config(
364 | "CERTIFICATE_TEMPLATE_LANGUAGES",
365 | default=CERTIFICATE_TEMPLATE_LANGUAGES,
366 | formatter=json.loads,
367 | )
368 | LANGUAGE_DICT = dict(LANGUAGES)
369 | LANGUAGE_CODE = config("LANGUAGE_CODE", default=LANGUAGE_CODE)
370 | LANGUAGE_COOKIE = config("LANGUAGE_COOKIE", default=LANGUAGE_COOKIE)
371 | ALL_LANGUAGES = config("ALL_LANGUAGES", default=ALL_LANGUAGES, formatter=json.loads)
372 |
373 | USE_I18N = config("USE_I18N", default=USE_I18N, formatter=bool)
374 |
375 | LOCALE_PATHS = (REPO_ROOT + "/conf/locale",)
376 | # Additional installed apps
377 | for app in config("ADDL_INSTALLED_APPS", default=[], formatter=json.loads):
378 | INSTALLED_APPS.append(app)
379 |
380 | WIKI_ENABLED = config("WIKI_ENABLED", default=WIKI_ENABLED, formatter=bool)
381 | local_loglevel = config("LOCAL_LOGLEVEL", default="INFO")
382 |
383 | # Configure Logging
384 |
385 | LOG_DIR = config("LOG_DIR", default="/edx/var/logs/edx")
386 | DATA_DIR = config("DATA_DIR", default="/edx/var/edxapp")
387 |
388 | # Default format for syslog logging
389 | standard_format = "%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s"
390 | syslog_format = (
391 | "[variant:lms][%(name)s][env:sandbox] %(levelname)s "
392 | "[{hostname} %(process)d] [%(filename)s:%(lineno)d] - %(message)s"
393 | ).format(hostname=platform.node().split(".")[0])
394 |
395 | LOGGING = {
396 | "version": 1,
397 | "disable_existing_loggers": False,
398 | "handlers": {
399 | "local": {
400 | "formatter": "syslog_format",
401 | "class": "logging.StreamHandler",
402 | "level": "INFO",
403 | },
404 | "tracking": {
405 | "formatter": "raw",
406 | "class": "logging.StreamHandler",
407 | "level": "DEBUG",
408 | },
409 | "console": {
410 | "formatter": "standard",
411 | "class": "logging.StreamHandler",
412 | "level": "INFO",
413 | },
414 | },
415 | "formatters": {
416 | "raw": {"format": "%(message)s"},
417 | "syslog_format": {"format": syslog_format},
418 | "standard": {"format": standard_format},
419 | },
420 | "filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
421 | "loggers": {
422 | "": {"level": "INFO", "propagate": False, "handlers": ["console", "local"]},
423 | "tracking": {"level": "DEBUG", "propagate": False, "handlers": ["tracking"]},
424 | },
425 | }
426 |
427 | SENTRY_DSN = config("SENTRY_DSN", default=None)
428 | if SENTRY_DSN:
429 | LOGGING["loggers"][""]["handlers"].append("sentry")
430 | LOGGING["handlers"]["sentry"] = {
431 | "class": "raven.handlers.logging.SentryHandler",
432 | "dsn": SENTRY_DSN,
433 | "level": "ERROR",
434 | "environment": "production",
435 | "release": RELEASE,
436 | }
437 |
438 |
439 | COURSE_LISTINGS = config("COURSE_LISTINGS", default={}, formatter=json.loads)
440 | COMMENTS_SERVICE_URL = config("COMMENTS_SERVICE_URL", default="")
441 | COMMENTS_SERVICE_KEY = config("COMMENTS_SERVICE_KEY", default="")
442 | CERT_NAME_SHORT = config("CERT_NAME_SHORT", default=CERT_NAME_SHORT)
443 | CERT_NAME_LONG = config("CERT_NAME_LONG", default=CERT_NAME_LONG)
444 | CERT_QUEUE = config("CERT_QUEUE", default="test-pull")
445 |
446 | FEEDBACK_SUBMISSION_EMAIL = config("FEEDBACK_SUBMISSION_EMAIL", default=None)
447 | MKTG_URLS = config("MKTG_URLS", default=MKTG_URLS, formatter=json.loads)
448 |
449 | # Badgr API
450 | BADGR_API_TOKEN = config("BADGR_API_TOKEN", default=BADGR_API_TOKEN)
451 | BADGR_BASE_URL = config("BADGR_BASE_URL", default=BADGR_BASE_URL)
452 | BADGR_ISSUER_SLUG = config("BADGR_ISSUER_SLUG", default=BADGR_ISSUER_SLUG)
453 | BADGR_TIMEOUT = config("BADGR_TIMEOUT", default=BADGR_TIMEOUT, formatter=int)
454 |
455 | # git repo loading environment
456 | GIT_REPO_DIR = config("GIT_REPO_DIR", default="/edx/var/edxapp/course_repos")
457 | GIT_IMPORT_STATIC = config("GIT_IMPORT_STATIC", default=True, formatter=bool)
458 | GIT_IMPORT_PYTHON_LIB = config("GIT_IMPORT_PYTHON_LIB", default=True, formatter=bool)
459 | PYTHON_LIB_FILENAME = config("PYTHON_LIB_FILENAME", default="python_lib.zip")
460 |
461 | for name, value in config("CODE_JAIL", default={}, formatter=json.loads).items():
462 | oldvalue = CODE_JAIL.get(name)
463 | if isinstance(oldvalue, dict):
464 | for subname, subvalue in value.items():
465 | oldvalue[subname] = subvalue
466 | else:
467 | CODE_JAIL[name] = value
468 |
469 | COURSES_WITH_UNSAFE_CODE = config(
470 | "COURSES_WITH_UNSAFE_CODE", default=[], formatter=json.loads
471 | )
472 |
473 | ASSET_IGNORE_REGEX = config("ASSET_IGNORE_REGEX", default=ASSET_IGNORE_REGEX)
474 |
475 | # Event Tracking
476 | TRACKING_IGNORE_URL_PATTERNS = config(
477 | "TRACKING_IGNORE_URL_PATTERNS", default=TRACKING_IGNORE_URL_PATTERNS, formatter=json.loads
478 | )
479 |
480 | # SSL external authentication settings
481 | SSL_AUTH_EMAIL_DOMAIN = config("SSL_AUTH_EMAIL_DOMAIN", default="MIT.EDU")
482 | SSL_AUTH_DN_FORMAT_STRING = config("SSL_AUTH_DN_FORMAT_STRING", default=None)
483 |
484 | # Django CAS external authentication settings
485 | CAS_EXTRA_LOGIN_PARAMS = config(
486 | "CAS_EXTRA_LOGIN_PARAMS", default=None, formatter=json.loads
487 | )
488 | if FEATURES.get("AUTH_USE_CAS"):
489 | CAS_SERVER_URL = config("CAS_SERVER_URL", default=None)
490 | AUTHENTICATION_BACKENDS = [
491 | "django.contrib.auth.backends.ModelBackend",
492 | "django_cas.backends.CASBackend",
493 | ]
494 | INSTALLED_APPS.append("django_cas")
495 | MIDDLEWARE_CLASSES.append("django_cas.middleware.CASMiddleware")
496 | CAS_ATTRIBUTE_CALLBACK = config(
497 | "CAS_ATTRIBUTE_CALLBACK", default=None, formatter=json.loads
498 | )
499 | if CAS_ATTRIBUTE_CALLBACK:
500 | import importlib
501 |
502 | CAS_USER_DETAILS_RESOLVER = getattr(
503 | importlib.import_module(CAS_ATTRIBUTE_CALLBACK["module"]),
504 | CAS_ATTRIBUTE_CALLBACK["function"],
505 | )
506 |
507 | # Video Caching. Pairing country codes with CDN URLs.
508 | # Example: {'CN': 'http://api.xuetangx.com/edx/video?s3_url='}
509 | VIDEO_CDN_URL = config("VIDEO_CDN_URL", default={})
510 |
511 | # Branded footer
512 | FOOTER_OPENEDX_URL = config("FOOTER_OPENEDX_URL", default=FOOTER_OPENEDX_URL)
513 | FOOTER_OPENEDX_LOGO_IMAGE = config(
514 | "FOOTER_OPENEDX_LOGO_IMAGE", default=FOOTER_OPENEDX_LOGO_IMAGE
515 | )
516 | FOOTER_ORGANIZATION_IMAGE = config(
517 | "FOOTER_ORGANIZATION_IMAGE", default=FOOTER_ORGANIZATION_IMAGE
518 | )
519 | FOOTER_CACHE_TIMEOUT = config(
520 | "FOOTER_CACHE_TIMEOUT", default=FOOTER_CACHE_TIMEOUT, formatter=int
521 | )
522 | FOOTER_BROWSER_CACHE_MAX_AGE = config(
523 | "FOOTER_BROWSER_CACHE_MAX_AGE", default=FOOTER_BROWSER_CACHE_MAX_AGE, formatter=int
524 | )
525 |
526 | # Credit notifications settings
527 | NOTIFICATION_EMAIL_CSS = config(
528 | "NOTIFICATION_EMAIL_CSS", default=NOTIFICATION_EMAIL_CSS
529 | )
530 | NOTIFICATION_EMAIL_EDX_LOGO = config(
531 | "NOTIFICATION_EMAIL_EDX_LOGO", default=NOTIFICATION_EMAIL_EDX_LOGO
532 | )
533 | SECRET_KEY = config("SECRET_KEY", default="ThisIsAnExampleKeyForDevPurposeOnly")
534 |
535 | # Determines whether the CSRF token can be transported on
536 | # unencrypted channels. It is set to False here for backward compatibility,
537 | # but it is highly recommended that this is True for enviroments accessed
538 | # by end users.
539 | CSRF_COOKIE_SECURE = config("CSRF_COOKIE_SECURE", default=False, formatter=bool)
540 |
541 | ############# CORS headers for cross-domain requests #################
542 |
543 | if FEATURES.get("ENABLE_CORS_HEADERS") or FEATURES.get(
544 | "ENABLE_CROSS_DOMAIN_CSRF_COOKIE"
545 | ):
546 | CORS_ALLOW_CREDENTIALS = True
547 | CORS_ORIGIN_WHITELIST = config(
548 | "CORS_ORIGIN_WHITELIST", default=(), formatter=json.loads
549 | )
550 | CORS_ORIGIN_ALLOW_ALL = config(
551 | "CORS_ORIGIN_ALLOW_ALL", default=False, formatter=bool
552 | )
553 | CORS_ALLOW_INSECURE = config("CORS_ALLOW_INSECURE", default=False, formatter=bool)
554 |
555 | # If setting a cross-domain cookie, it's really important to choose
556 | # a name for the cookie that is DIFFERENT than the cookies used
557 | # by each subdomain. For example, suppose the applications
558 | # at these subdomains are configured to use the following cookie names:
559 | #
560 | # 1) foo.example.com --> "csrftoken"
561 | # 2) baz.example.com --> "csrftoken"
562 | # 3) bar.example.com --> "csrftoken"
563 | #
564 | # For the cross-domain version of the CSRF cookie, you need to choose
565 | # a name DIFFERENT than "csrftoken"; otherwise, the new token configured
566 | # for ".example.com" could conflict with the other cookies,
567 | # non-deterministically causing 403 responses.
568 | #
569 | # Because of the way Django stores cookies, the cookie name MUST
570 | # be a `str`, not unicode. Otherwise there will `TypeError`s will be raised
571 | # when Django tries to call the unicode `translate()` method with the wrong
572 | # number of parameters.
573 | CROSS_DOMAIN_CSRF_COOKIE_NAME = str(config("CROSS_DOMAIN_CSRF_COOKIE_NAME"))
574 |
575 | # When setting the domain for the "cross-domain" version of the CSRF
576 | # cookie, you should choose something like: ".example.com"
577 | # (note the leading dot), where both the referer and the host
578 | # are subdomains of "example.com".
579 | #
580 | # Browser security rules require that
581 | # the cookie domain matches the domain of the server; otherwise
582 | # the cookie won't get set. And once the cookie gets set, the client
583 | # needs to be on a domain that matches the cookie domain, otherwise
584 | # the client won't be able to read the cookie.
585 | CROSS_DOMAIN_CSRF_COOKIE_DOMAIN = config("CROSS_DOMAIN_CSRF_COOKIE_DOMAIN")
586 |
587 |
588 | # Field overrides. To use the IDDE feature, add
589 | # 'courseware.student_field_overrides.IndividualStudentOverrideProvider'.
590 | FIELD_OVERRIDE_PROVIDERS = tuple(
591 | config("FIELD_OVERRIDE_PROVIDERS", default=[], formatter=json.loads)
592 | )
593 |
594 | ############################## SECURE AUTH ITEMS ###############
595 |
596 | ############### XBlock filesystem field config ##########
597 | DJFS = config("DJFS", default=None, formatter=json.loads)
598 |
599 | ############### Module Store Items ##########
600 | HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS = config(
601 | "HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS", default={}, formatter=json.loads
602 | )
603 | # PREVIEW DOMAIN must be present in HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS for the preview to show
604 | # draft changes
605 | if "PREVIEW_LMS_BASE" in FEATURES and FEATURES["PREVIEW_LMS_BASE"] != "":
606 | PREVIEW_DOMAIN = FEATURES["PREVIEW_LMS_BASE"].split(":")[0]
607 | # update dictionary with preview domain regex
608 | HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS.update({PREVIEW_DOMAIN: "draft-preferred"})
609 |
610 | MODULESTORE_FIELD_OVERRIDE_PROVIDERS = config(
611 | "MODULESTORE_FIELD_OVERRIDE_PROVIDERS",
612 | default=MODULESTORE_FIELD_OVERRIDE_PROVIDERS,
613 | formatter=json.loads,
614 | )
615 |
616 | XBLOCK_FIELD_DATA_WRAPPERS = config(
617 | "XBLOCK_FIELD_DATA_WRAPPERS",
618 | default=XBLOCK_FIELD_DATA_WRAPPERS,
619 | formatter=json.loads,
620 | )
621 |
622 | ############### Mixed Related(Secure/Not-Secure) Items ##########
623 | LMS_SEGMENT_KEY = config("LMS_SEGMENT_KEY", default=None)
624 |
625 | CC_PROCESSOR_NAME = config("CC_PROCESSOR_NAME", default=CC_PROCESSOR_NAME)
626 | CC_PROCESSOR = config("CC_PROCESSOR", default=CC_PROCESSOR, formatter=json.loads)
627 |
628 |
629 | DEFAULT_FILE_STORAGE = config(
630 | "DEFAULT_FILE_STORAGE", default="django.core.files.storage.FileSystemStorage"
631 | )
632 |
633 | # Specific setting for the File Upload Service to store media in a bucket.
634 | FILE_UPLOAD_STORAGE_BUCKET_NAME = config(
635 | "FILE_UPLOAD_STORAGE_BUCKET_NAME", default=FILE_UPLOAD_STORAGE_BUCKET_NAME
636 | )
637 | FILE_UPLOAD_STORAGE_PREFIX = config(
638 | "FILE_UPLOAD_STORAGE_PREFIX", default=FILE_UPLOAD_STORAGE_PREFIX
639 | )
640 |
641 | # Databases
642 |
643 | # If there is a database called 'read_replica', you can use the use_read_replica_if_available
644 | # function in util/query.py, which is useful for very large database reads
645 |
646 | DATABASE_ENGINE = config("DATABASE_ENGINE", default="django.db.backends.mysql")
647 | DATABASE_HOST = config("DATABASE_HOST", default="mysql")
648 | DATABASE_PORT = config("DATABASE_PORT", default=3306, formatter=int)
649 | DATABASE_NAME = config("DATABASE_NAME", default="edxapp")
650 | DATABASE_USER = config("DATABASE_USER", default="edxapp_user")
651 | DATABASE_PASSWORD = config("DATABASE_PASSWORD", default="password")
652 |
653 | DATABASES = config(
654 | "DATABASES",
655 | default={
656 | "default": {
657 | "ENGINE": DATABASE_ENGINE,
658 | "HOST": DATABASE_HOST,
659 | "PORT": DATABASE_PORT,
660 | "NAME": DATABASE_NAME,
661 | "USER": DATABASE_USER,
662 | "PASSWORD": DATABASE_PASSWORD,
663 | }
664 | },
665 | formatter=json.loads,
666 | )
667 |
668 | XQUEUE_INTERFACE = config(
669 | "XQUEUE_INTERFACE",
670 | default={"url": None, "basic_auth": None, "django_auth": None},
671 | formatter=json.loads,
672 | )
673 |
674 | # Configure the MODULESTORE
675 | MODULESTORE = convert_module_store_setting_if_needed(
676 | config("MODULESTORE", default=MODULESTORE, formatter=json.loads)
677 | )
678 |
679 | MONGODB_PASSWORD = config("MONGODB_PASSWORD", default="")
680 | MONGODB_HOST = config("MONGODB_HOST", default="mongodb")
681 | MONGODB_PORT = config("MONGODB_PORT", default=27017, formatter=int)
682 | MONGODB_NAME = config("MONGODB_NAME", default="edxapp")
683 | MONGODB_USER = config("MONGODB_USER", default=None)
684 | MONGODB_SSL = config("MONGODB_SSL", default=False, formatter=bool)
685 |
686 | DOC_STORE_CONFIG = config(
687 | "DOC_STORE_CONFIG",
688 | default={
689 | "collection": "modulestore",
690 | "host": MONGODB_HOST,
691 | "port": MONGODB_PORT,
692 | "db": MONGODB_NAME,
693 | "user": MONGODB_USER,
694 | "password": MONGODB_PASSWORD,
695 | "ssl": MONGODB_SSL,
696 | },
697 | formatter=json.loads,
698 | )
699 |
700 | MONGODB_LOG = config("MONGODB_LOG", default={}, formatter=json.loads)
701 |
702 | CONTENTSTORE = config(
703 | "CONTENTSTORE",
704 | default={
705 | "DOC_STORE_CONFIG": DOC_STORE_CONFIG,
706 | "ENGINE": "xmodule.contentstore.mongo.MongoContentStore",
707 | },
708 | formatter=json.loads,
709 | )
710 |
711 | update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
712 |
713 | EMAIL_HOST_USER = config("EMAIL_HOST_USER", default="") # django default is ''
714 | EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD", default="") # django default is ''
715 |
716 | # Datadog for events!
717 | DATADOG = config("DATADOG", default={}, formatter=json.loads)
718 |
719 | # TODO: deprecated (compatibility with previous settings)
720 | DATADOG_API = config("DATADOG_API", default=None)
721 |
722 | # Analytics API
723 | ANALYTICS_API_KEY = config("ANALYTICS_API_KEY", default=ANALYTICS_API_KEY)
724 | ANALYTICS_API_URL = config("ANALYTICS_API_URL", default=ANALYTICS_API_URL)
725 |
726 | # Mailchimp New User List
727 | MAILCHIMP_NEW_USER_LIST_ID = config("MAILCHIMP_NEW_USER_LIST_ID", default=None)
728 |
729 | # Zendesk
730 | ZENDESK_URL = config("ZENDESK_URL", default=None)
731 | ZENDESK_USER = config("ZENDESK_USER", default=None)
732 | ZENDESK_API_KEY = config("ZENDESK_API_KEY", default=None)
733 | ZENDESK_CUSTOM_FIELDS = config(
734 | "ZENDESK_CUSTOM_FIELDS", default={}, formatter=json.loads
735 | )
736 |
737 | # API Key for inbound requests from Notifier service
738 | EDX_API_KEY = config("EDX_API_KEY", default="ThisIsAnExampleKeyForDevPurposeOnly")
739 |
740 | # Celery Broker
741 | CELERY_BROKER_TRANSPORT = config("CELERY_BROKER_TRANSPORT", default="redis")
742 | CELERY_BROKER_USER = config("CELERY_BROKER_USER", default="")
743 | CELERY_BROKER_PASSWORD = config("CELERY_BROKER_PASSWORD", default="")
744 | CELERY_BROKER_HOST = config("CELERY_BROKER_HOST", default="redis")
745 | CELERY_BROKER_PORT = config("CELERY_BROKER_PORT", default=6379, formatter=int)
746 | CELERY_BROKER_VHOST = config("CELERY_BROKER_VHOST", default=0, formatter=int)
747 |
748 | BROKER_URL = "{transport}://{user}:{password}@{host}:{port}/{vhost}".format(
749 | transport=CELERY_BROKER_TRANSPORT,
750 | user=CELERY_BROKER_USER,
751 | password=CELERY_BROKER_PASSWORD,
752 | host=CELERY_BROKER_HOST,
753 | port=CELERY_BROKER_PORT,
754 | vhost=CELERY_BROKER_VHOST,
755 | )
756 | BROKER_USE_SSL = config("CELERY_BROKER_USE_SSL", default=False, formatter=bool)
757 |
758 | # Block Structures
759 | BLOCK_STRUCTURES_SETTINGS = config(
760 | "BLOCK_STRUCTURES_SETTINGS", default=BLOCK_STRUCTURES_SETTINGS, formatter=json.loads
761 | )
762 |
763 | # upload limits
764 | STUDENT_FILEUPLOAD_MAX_SIZE = config(
765 | "STUDENT_FILEUPLOAD_MAX_SIZE", default=STUDENT_FILEUPLOAD_MAX_SIZE, formatter=int
766 | )
767 |
768 | # Event tracking
769 | TRACKING_BACKENDS.update(config("TRACKING_BACKENDS", default={}, formatter=json.loads))
770 | EVENT_TRACKING_BACKENDS["tracking_logs"]["OPTIONS"]["backends"].update(
771 | config("EVENT_TRACKING_BACKENDS", default={}, formatter=json.loads)
772 | )
773 | EVENT_TRACKING_BACKENDS["segmentio"]["OPTIONS"]["processors"][0]["OPTIONS"][
774 | "whitelist"
775 | ].extend(
776 | config("EVENT_TRACKING_SEGMENTIO_EMIT_WHITELIST", default=[], formatter=json.loads)
777 | )
778 | TRACKING_SEGMENTIO_WEBHOOK_SECRET = config(
779 | "TRACKING_SEGMENTIO_WEBHOOK_SECRET", default=TRACKING_SEGMENTIO_WEBHOOK_SECRET
780 | )
781 | TRACKING_SEGMENTIO_ALLOWED_TYPES = config(
782 | "TRACKING_SEGMENTIO_ALLOWED_TYPES",
783 | default=TRACKING_SEGMENTIO_ALLOWED_TYPES,
784 | formatter=json.loads,
785 | )
786 | TRACKING_SEGMENTIO_DISALLOWED_SUBSTRING_NAMES = config(
787 | "TRACKING_SEGMENTIO_DISALLOWED_SUBSTRING_NAMES",
788 | default=TRACKING_SEGMENTIO_DISALLOWED_SUBSTRING_NAMES,
789 | formatter=json.loads,
790 | )
791 | TRACKING_SEGMENTIO_SOURCE_MAP = config(
792 | "TRACKING_SEGMENTIO_SOURCE_MAP",
793 | default=TRACKING_SEGMENTIO_SOURCE_MAP,
794 | formatter=json.loads,
795 | )
796 |
797 | # Heartbeat
798 | HEARTBEAT_CHECKS = config(
799 | "HEARTBEAT_CHECKS", default=HEARTBEAT_CHECKS, formatter=json.loads
800 | )
801 | HEARTBEAT_EXTENDED_CHECKS = config(
802 | "HEARTBEAT_EXTENDED_CHECKS", default=HEARTBEAT_EXTENDED_CHECKS, formatter=json.loads
803 | )
804 | HEARTBEAT_CELERY_TIMEOUT = config(
805 | "HEARTBEAT_CELERY_TIMEOUT", default=HEARTBEAT_CELERY_TIMEOUT, formatter=int
806 | )
807 |
808 | # Student identity verification settings
809 | VERIFY_STUDENT = config("VERIFY_STUDENT", default=VERIFY_STUDENT, formatter=json.loads)
810 | DISABLE_ACCOUNT_ACTIVATION_REQUIREMENT_SWITCH = config(
811 | "DISABLE_ACCOUNT_ACTIVATION_REQUIREMENT_SWITCH",
812 | default=DISABLE_ACCOUNT_ACTIVATION_REQUIREMENT_SWITCH,
813 | )
814 |
815 | # Grades download
816 | GRADES_DOWNLOAD_ROUTING_KEY = config(
817 | "GRADES_DOWNLOAD_ROUTING_KEY", default=HIGH_MEM_QUEUE
818 | )
819 |
820 | GRADES_DOWNLOAD = config(
821 | "GRADES_DOWNLOAD", default=GRADES_DOWNLOAD, formatter=json.loads
822 | )
823 |
824 | # Rate limit for regrading tasks that a grading policy change can kick off
825 | POLICY_CHANGE_TASK_RATE_LIMIT = config(
826 | "POLICY_CHANGE_TASK_RATE_LIMIT", default=POLICY_CHANGE_TASK_RATE_LIMIT
827 | )
828 |
829 | # financial reports
830 | FINANCIAL_REPORTS = config(
831 | "FINANCIAL_REPORTS", default=FINANCIAL_REPORTS, formatter=json.loads
832 | )
833 |
834 | ##### ORA2 ######
835 | # Prefix for uploads of example-based assessment AI classifiers
836 | # This can be used to separate uploads for different environments
837 | # within the same S3 bucket.
838 | ORA2_FILE_PREFIX = config("ORA2_FILE_PREFIX", default=ORA2_FILE_PREFIX)
839 |
840 | ##### ACCOUNT LOCKOUT DEFAULT PARAMETERS #####
841 | MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = config(
842 | "MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED", default=5, formatter=int
843 | )
844 | MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = config(
845 | "MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS", default=15 * 60, formatter=int
846 | )
847 |
848 | #### PASSWORD POLICY SETTINGS #####
849 | PASSWORD_MIN_LENGTH = config("PASSWORD_MIN_LENGTH", default=12, formatter=int)
850 | PASSWORD_MAX_LENGTH = config("PASSWORD_MAX_LENGTH", default=None, formatter=int)
851 |
852 | PASSWORD_COMPLEXITY = config(
853 | "PASSWORD_COMPLEXITY",
854 | default={"UPPER": 1, "LOWER": 1, "DIGITS": 1},
855 | formatter=json.loads,
856 | )
857 | PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD = config(
858 | "PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD",
859 | default=PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD,
860 | formatter=int,
861 | )
862 | PASSWORD_DICTIONARY = config("PASSWORD_DICTIONARY", default=[], formatter=json.loads)
863 |
864 | ### INACTIVITY SETTINGS ####
865 | SESSION_INACTIVITY_TIMEOUT_IN_SECONDS = config(
866 | "SESSION_INACTIVITY_TIMEOUT_IN_SECONDS", default=None, formatter=int
867 | )
868 |
869 | ##### LMS DEADLINE DISPLAY TIME_ZONE #######
870 | TIME_ZONE_DISPLAYED_FOR_DEADLINES = config(
871 | "TIME_ZONE_DISPLAYED_FOR_DEADLINES",
872 | default=TIME_ZONE_DISPLAYED_FOR_DEADLINES,
873 | )
874 |
875 | ##### X-Frame-Options response header settings #####
876 | X_FRAME_OPTIONS = config("X_FRAME_OPTIONS", default=X_FRAME_OPTIONS)
877 |
878 | ##### Third-party auth options ################################################
879 | if FEATURES.get("ENABLE_THIRD_PARTY_AUTH"):
880 | AUTHENTICATION_BACKENDS = config(
881 | "THIRD_PARTY_AUTH_BACKENDS",
882 | default=[
883 | "social_core.backends.google.GoogleOAuth2",
884 | "social_core.backends.linkedin.LinkedinOAuth2",
885 | "social_core.backends.facebook.FacebookOAuth2",
886 | "social_core.backends.azuread.AzureADOAuth2",
887 | "third_party_auth.saml.SAMLAuthBackend",
888 | "third_party_auth.lti.LTIAuthBackend",
889 | ],
890 | formatter=json.loads,
891 | ) + list(AUTHENTICATION_BACKENDS)
892 |
893 | # The reduced session expiry time during the third party login pipeline. (Value in seconds)
894 | SOCIAL_AUTH_PIPELINE_TIMEOUT = config(
895 | "SOCIAL_AUTH_PIPELINE_TIMEOUT", default=600, formatter=int
896 | )
897 |
898 | # Most provider configuration is done via ConfigurationModels but for a few sensitive values
899 | # we allow configuration via credentials.vault.yaml instead (optionally).
900 | # The SAML private/public key values do not need the delimiter lines (such as
901 | # "-----BEGIN PRIVATE KEY-----", "-----END PRIVATE KEY-----" etc.) but they may be included
902 | # if you want (though it's easier to format the key values as JSON without the delimiters).
903 | SOCIAL_AUTH_SAML_SP_PRIVATE_KEY = config(
904 | "SOCIAL_AUTH_SAML_SP_PRIVATE_KEY", default={}, formatter=json.loads
905 | )
906 | SOCIAL_AUTH_SAML_SP_PUBLIC_CERT = config(
907 | "SOCIAL_AUTH_SAML_SP_PUBLIC_CERT", default={}, formatter=json.loads
908 | )
909 | SOCIAL_AUTH_OAUTH_SECRETS = config("SOCIAL_AUTH_OAUTH_SECRETS", default={})
910 | SOCIAL_AUTH_LTI_CONSUMER_SECRETS = config(
911 | "SOCIAL_AUTH_LTI_CONSUMER_SECRETS", default={}, formatter=json.loads
912 | )
913 |
914 | # third_party_auth config moved to ConfigurationModels. This is for data migration only:
915 | THIRD_PARTY_AUTH_OLD_CONFIG = config("THIRD_PARTY_AUTH", default=None)
916 |
917 | if (
918 | config("THIRD_PARTY_AUTH_SAML_FETCH_PERIOD_HOURS", default=24, formatter=int)
919 | is not None
920 | ):
921 | CELERYBEAT_SCHEDULE["refresh-saml-metadata"] = {
922 | "task": "third_party_auth.fetch_saml_metadata",
923 | "schedule": datetime.timedelta(
924 | hours=config(
925 | "THIRD_PARTY_AUTH_SAML_FETCH_PERIOD_HOURS",
926 | default=24,
927 | formatter=int,
928 | )
929 | ),
930 | }
931 |
932 | # The following can be used to integrate a custom login form with third_party_auth.
933 | # It should be a dict where the key is a word passed via ?auth_entry=, and the value is a
934 | # dict with an arbitrary 'secret_key' and a 'url'.
935 | THIRD_PARTY_AUTH_CUSTOM_AUTH_FORMS = config(
936 | "THIRD_PARTY_AUTH_CUSTOM_AUTH_FORMS", default={}, formatter=json.loads
937 | )
938 |
939 | ##### OAUTH2 Provider ##############
940 | if FEATURES.get("ENABLE_OAUTH2_PROVIDER"):
941 | OAUTH_OIDC_ISSUER = config("OAUTH_OIDC_ISSUER")
942 | OAUTH_ENFORCE_SECURE = config("OAUTH_ENFORCE_SECURE", default=True, formatter=bool)
943 | OAUTH_ENFORCE_CLIENT_SECURE = config(
944 | "OAUTH_ENFORCE_CLIENT_SECURE", default=True, formatter=bool
945 | )
946 | # Defaults for the following are defined in lms.envs.common
947 | OAUTH_EXPIRE_DELTA = datetime.timedelta(
948 | days=config(
949 | "OAUTH_EXPIRE_CONFIDENTIAL_CLIENT_DAYS",
950 | default=OAUTH_EXPIRE_CONFIDENTIAL_CLIENT_DAYS,
951 | formatter=int,
952 | )
953 | )
954 | OAUTH_EXPIRE_DELTA_PUBLIC = datetime.timedelta(
955 | days=config(
956 | "OAUTH_EXPIRE_PUBLIC_CLIENT_DAYS",
957 | default=OAUTH_EXPIRE_PUBLIC_CLIENT_DAYS,
958 | formatter=int,
959 | )
960 | )
961 | OAUTH_ID_TOKEN_EXPIRATION = config(
962 | "OAUTH_ID_TOKEN_EXPIRATION", default=OAUTH_ID_TOKEN_EXPIRATION, formatter=int
963 | )
964 | OAUTH_DELETE_EXPIRED = config(
965 | "OAUTH_DELETE_EXPIRED", default=OAUTH_DELETE_EXPIRED, formatter=bool
966 | )
967 |
968 | ##### ADVANCED_SECURITY_CONFIG #####
969 | ADVANCED_SECURITY_CONFIG = config(
970 | "ADVANCED_SECURITY_CONFIG", default={}, formatter=json.loads
971 | )
972 |
973 | ##### GOOGLE ANALYTICS IDS #####
974 | GOOGLE_ANALYTICS_ACCOUNT = config("GOOGLE_ANALYTICS_ACCOUNT", default=None)
975 | GOOGLE_ANALYTICS_TRACKING_ID = config("GOOGLE_ANALYTICS_TRACKING_ID", default=None)
976 | GOOGLE_ANALYTICS_LINKEDIN = config("GOOGLE_ANALYTICS_LINKEDIN", default=None)
977 | GOOGLE_SITE_VERIFICATION_ID = config("GOOGLE_SITE_VERIFICATION_ID", default=None)
978 |
979 | ##### BRANCH.IO KEY #####
980 | BRANCH_IO_KEY = config("BRANCH_IO_KEY", default=None)
981 |
982 | ##### OPTIMIZELY PROJECT ID #####
983 | OPTIMIZELY_PROJECT_ID = config("OPTIMIZELY_PROJECT_ID", default=OPTIMIZELY_PROJECT_ID)
984 |
985 | #### Course Registration Code length ####
986 | REGISTRATION_CODE_LENGTH = config("REGISTRATION_CODE_LENGTH", default=8, formatter=int)
987 |
988 | # REGISTRATION CODES DISPLAY INFORMATION
989 | INVOICE_CORP_ADDRESS = config("INVOICE_CORP_ADDRESS", default=INVOICE_CORP_ADDRESS)
990 | INVOICE_PAYMENT_INSTRUCTIONS = config(
991 | "INVOICE_PAYMENT_INSTRUCTIONS", default=INVOICE_PAYMENT_INSTRUCTIONS
992 | )
993 |
994 | # Which access.py permission names to check;
995 | # We default this to the legacy permission 'see_exists'.
996 | COURSE_CATALOG_VISIBILITY_PERMISSION = config(
997 | "COURSE_CATALOG_VISIBILITY_PERMISSION", default=COURSE_CATALOG_VISIBILITY_PERMISSION
998 | )
999 | COURSE_ABOUT_VISIBILITY_PERMISSION = config(
1000 | "COURSE_ABOUT_VISIBILITY_PERMISSION", default=COURSE_ABOUT_VISIBILITY_PERMISSION
1001 | )
1002 |
1003 | DEFAULT_COURSE_VISIBILITY_IN_CATALOG = config(
1004 | "DEFAULT_COURSE_VISIBILITY_IN_CATALOG", default=DEFAULT_COURSE_VISIBILITY_IN_CATALOG
1005 | )
1006 |
1007 | DEFAULT_MOBILE_AVAILABLE = config(
1008 | "DEFAULT_MOBILE_AVAILABLE", default=DEFAULT_MOBILE_AVAILABLE, formatter=bool
1009 | )
1010 |
1011 | # Enrollment API Cache Timeout
1012 | ENROLLMENT_COURSE_DETAILS_CACHE_TIMEOUT = config(
1013 | "ENROLLMENT_COURSE_DETAILS_CACHE_TIMEOUT", default=60, formatter=int
1014 | )
1015 |
1016 | # PDF RECEIPT/INVOICE OVERRIDES
1017 | PDF_RECEIPT_TAX_ID = config("PDF_RECEIPT_TAX_ID", default=PDF_RECEIPT_TAX_ID)
1018 | PDF_RECEIPT_FOOTER_TEXT = config(
1019 | "PDF_RECEIPT_FOOTER_TEXT", default=PDF_RECEIPT_FOOTER_TEXT
1020 | )
1021 | PDF_RECEIPT_DISCLAIMER_TEXT = config(
1022 | "PDF_RECEIPT_DISCLAIMER_TEXT", default=PDF_RECEIPT_DISCLAIMER_TEXT
1023 | )
1024 | PDF_RECEIPT_BILLING_ADDRESS = config(
1025 | "PDF_RECEIPT_BILLING_ADDRESS", default=PDF_RECEIPT_BILLING_ADDRESS
1026 | )
1027 | PDF_RECEIPT_TERMS_AND_CONDITIONS = config(
1028 | "PDF_RECEIPT_TERMS_AND_CONDITIONS", default=PDF_RECEIPT_TERMS_AND_CONDITIONS
1029 | )
1030 | PDF_RECEIPT_TAX_ID_LABEL = config(
1031 | "PDF_RECEIPT_TAX_ID_LABEL", default=PDF_RECEIPT_TAX_ID_LABEL
1032 | )
1033 | PDF_RECEIPT_LOGO_PATH = config("PDF_RECEIPT_LOGO_PATH", default=PDF_RECEIPT_LOGO_PATH)
1034 | PDF_RECEIPT_COBRAND_LOGO_PATH = config(
1035 | "PDF_RECEIPT_COBRAND_LOGO_PATH", default=PDF_RECEIPT_COBRAND_LOGO_PATH
1036 | )
1037 | PDF_RECEIPT_LOGO_HEIGHT_MM = config(
1038 | "PDF_RECEIPT_LOGO_HEIGHT_MM", default=PDF_RECEIPT_LOGO_HEIGHT_MM, formatter=int
1039 | )
1040 | PDF_RECEIPT_COBRAND_LOGO_HEIGHT_MM = config(
1041 | "PDF_RECEIPT_COBRAND_LOGO_HEIGHT_MM",
1042 | default=PDF_RECEIPT_COBRAND_LOGO_HEIGHT_MM,
1043 | formatter=int,
1044 | )
1045 |
1046 | if (
1047 | FEATURES.get("ENABLE_COURSEWARE_SEARCH")
1048 | or FEATURES.get("ENABLE_DASHBOARD_SEARCH")
1049 | or FEATURES.get("ENABLE_COURSE_DISCOVERY")
1050 | or FEATURES.get("ENABLE_TEAMS")
1051 | ):
1052 | # Use ElasticSearch as the search engine herein
1053 | SEARCH_ENGINE = "search.elastic.ElasticSearchEngine"
1054 |
1055 | ELASTIC_SEARCH_CONFIG = config(
1056 | "ELASTIC_SEARCH_CONFIG", default=[{}], formatter=json.loads
1057 | )
1058 |
1059 | # Facebook app
1060 | FACEBOOK_API_VERSION = config("FACEBOOK_API_VERSION", default=None)
1061 | FACEBOOK_APP_SECRET = config(
1062 | "FACEBOOK_APP_SECRET", default="ThisIsAnExampleKeyForDevPurposeOnly"
1063 | )
1064 | FACEBOOK_APP_ID = config("FACEBOOK_APP_ID", default=None)
1065 |
1066 | XBLOCK_SETTINGS = config("XBLOCK_SETTINGS", default={}, formatter=json.loads)
1067 | XBLOCK_SETTINGS.setdefault("VideoDescriptor", {})["licensing_enabled"] = FEATURES.get(
1068 | "LICENSING", False
1069 | )
1070 | XBLOCK_SETTINGS.setdefault("VideoModule", {})["YOUTUBE_API_KEY"] = config(
1071 | "YOUTUBE_API_KEY", default=YOUTUBE_API_KEY
1072 | )
1073 |
1074 | ##### VIDEO IMAGE STORAGE #####
1075 | VIDEO_IMAGE_SETTINGS = config(
1076 | "VIDEO_IMAGE_SETTINGS", default=VIDEO_IMAGE_SETTINGS, formatter=json.loads
1077 | )
1078 |
1079 | ##### VIDEO TRANSCRIPTS STORAGE #####
1080 | VIDEO_TRANSCRIPTS_SETTINGS = config(
1081 | "VIDEO_TRANSCRIPTS_SETTINGS",
1082 | default=VIDEO_TRANSCRIPTS_SETTINGS,
1083 | formatter=json.loads,
1084 | )
1085 |
1086 | ##### ECOMMERCE API CONFIGURATION SETTINGS #####
1087 | ECOMMERCE_PUBLIC_URL_ROOT = config(
1088 | "ECOMMERCE_PUBLIC_URL_ROOT", default=ECOMMERCE_PUBLIC_URL_ROOT
1089 | )
1090 | ECOMMERCE_API_URL = config("ECOMMERCE_API_URL", default=ECOMMERCE_API_URL)
1091 | ECOMMERCE_API_TIMEOUT = config(
1092 | "ECOMMERCE_API_TIMEOUT", default=ECOMMERCE_API_TIMEOUT, formatter=int
1093 | )
1094 |
1095 | COURSE_CATALOG_API_URL = config(
1096 | "COURSE_CATALOG_API_URL", default=COURSE_CATALOG_API_URL
1097 | )
1098 |
1099 | ECOMMERCE_SERVICE_WORKER_USERNAME = config(
1100 | "ECOMMERCE_SERVICE_WORKER_USERNAME", default=ECOMMERCE_SERVICE_WORKER_USERNAME
1101 | )
1102 |
1103 | ##### Custom Courses for EdX #####
1104 | if FEATURES.get("CUSTOM_COURSES_EDX"):
1105 | INSTALLED_APPS += [
1106 | "lms.djangoapps.ccx",
1107 | "openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig",
1108 | ]
1109 | MODULESTORE_FIELD_OVERRIDE_PROVIDERS += (
1110 | "lms.djangoapps.ccx.overrides.CustomCoursesForEdxOverrideProvider",
1111 | )
1112 | CCX_MAX_STUDENTS_ALLOWED = config(
1113 | "CCX_MAX_STUDENTS_ALLOWED", default=CCX_MAX_STUDENTS_ALLOWED, formatter=int
1114 | )
1115 |
1116 | ##### Individual Due Date Extensions #####
1117 | if FEATURES.get("INDIVIDUAL_DUE_DATES"):
1118 | FIELD_OVERRIDE_PROVIDERS += (
1119 | "courseware.student_field_overrides.IndividualStudentOverrideProvider",
1120 | )
1121 |
1122 | ##### Self-Paced Course Due Dates #####
1123 | XBLOCK_FIELD_DATA_WRAPPERS += (
1124 | "lms.djangoapps.courseware.field_overrides:OverrideModulestoreFieldData.wrap",
1125 | )
1126 |
1127 | MODULESTORE_FIELD_OVERRIDE_PROVIDERS += (
1128 | "courseware.self_paced_overrides.SelfPacedDateOverrideProvider",
1129 | )
1130 |
1131 | # PROFILE IMAGE CONFIG
1132 | PROFILE_IMAGE_BACKEND = config("PROFILE_IMAGE_BACKEND", default=PROFILE_IMAGE_BACKEND)
1133 | PROFILE_IMAGE_SECRET_KEY = config(
1134 | "PROFILE_IMAGE_SECRET_KEY", default=PROFILE_IMAGE_SECRET_KEY
1135 | )
1136 | PROFILE_IMAGE_MAX_BYTES = config(
1137 | "PROFILE_IMAGE_MAX_BYTES", default=PROFILE_IMAGE_MAX_BYTES, formatter=int
1138 | )
1139 | PROFILE_IMAGE_MIN_BYTES = config(
1140 | "PROFILE_IMAGE_MIN_BYTES", default=PROFILE_IMAGE_MIN_BYTES, formatter=int
1141 | )
1142 | PROFILE_IMAGE_DEFAULT_FILENAME = "images/profiles/default"
1143 | PROFILE_IMAGE_SIZES_MAP = config(
1144 | "PROFILE_IMAGE_SIZES_MAP", default=PROFILE_IMAGE_SIZES_MAP, formatter=json.loads
1145 | )
1146 |
1147 | # EdxNotes config
1148 |
1149 | EDXNOTES_PUBLIC_API = config("EDXNOTES_PUBLIC_API", default=EDXNOTES_PUBLIC_API)
1150 | EDXNOTES_INTERNAL_API = config("EDXNOTES_INTERNAL_API", default=EDXNOTES_INTERNAL_API)
1151 |
1152 | EDXNOTES_CONNECT_TIMEOUT = config(
1153 | "EDXNOTES_CONNECT_TIMEOUT", default=EDXNOTES_CONNECT_TIMEOUT, formatter=int
1154 | )
1155 | EDXNOTES_READ_TIMEOUT = config(
1156 | "EDXNOTES_READ_TIMEOUT", default=EDXNOTES_READ_TIMEOUT, formatter=int
1157 | )
1158 |
1159 | ##### Credit Provider Integration #####
1160 |
1161 | CREDIT_PROVIDER_SECRET_KEYS = config(
1162 | "CREDIT_PROVIDER_SECRET_KEYS", default={}, formatter=json.loads
1163 | )
1164 |
1165 | ##################### LTI Provider #####################
1166 | if FEATURES.get("ENABLE_LTI_PROVIDER"):
1167 | INSTALLED_APPS.append("lti_provider.apps.LtiProviderConfig")
1168 | AUTHENTICATION_BACKENDS.append("lti_provider.users.LtiBackend")
1169 |
1170 | LTI_USER_EMAIL_DOMAIN = config("LTI_USER_EMAIL_DOMAIN", default="lti.example.com")
1171 |
1172 | # For more info on this, see the notes in common.py
1173 | LTI_AGGREGATE_SCORE_PASSBACK_DELAY = config(
1174 | "LTI_AGGREGATE_SCORE_PASSBACK_DELAY",
1175 | default=LTI_AGGREGATE_SCORE_PASSBACK_DELAY,
1176 | formatter=int,
1177 | )
1178 |
1179 | ##################### Credit Provider help link ####################
1180 | CREDIT_HELP_LINK_URL = config("CREDIT_HELP_LINK_URL", default=CREDIT_HELP_LINK_URL)
1181 |
1182 | #### JWT configuration ####
1183 | JWT_AUTH.update(config("JWT_AUTH", default={}, formatter=json.loads))
1184 |
1185 | ################# PROCTORING CONFIGURATION ##################
1186 |
1187 | PROCTORING_BACKEND_PROVIDER = config(
1188 | "PROCTORING_BACKEND_PROVIDER", default=PROCTORING_BACKEND_PROVIDER
1189 | )
1190 | PROCTORING_SETTINGS = config(
1191 | "PROCTORING_SETTINGS", default=PROCTORING_SETTINGS, formatter=json.loads
1192 | )
1193 |
1194 | ################# MICROSITE ####################
1195 | MICROSITE_CONFIGURATION = config(
1196 | "MICROSITE_CONFIGURATION", default={}, formatter=json.loads
1197 | )
1198 | MICROSITE_ROOT_DIR = path(config("MICROSITE_ROOT_DIR", default=""))
1199 | # this setting specify which backend to be used when pulling microsite specific configuration
1200 | MICROSITE_BACKEND = config("MICROSITE_BACKEND", default=MICROSITE_BACKEND)
1201 | # this setting specify which backend to be used when loading microsite specific templates
1202 | MICROSITE_TEMPLATE_BACKEND = config(
1203 | "MICROSITE_TEMPLATE_BACKEND", default=MICROSITE_TEMPLATE_BACKEND
1204 | )
1205 | # TTL for microsite database template cache
1206 | MICROSITE_DATABASE_TEMPLATE_CACHE_TTL = config(
1207 | "MICROSITE_DATABASE_TEMPLATE_CACHE_TTL",
1208 | default=MICROSITE_DATABASE_TEMPLATE_CACHE_TTL,
1209 | formatter=int,
1210 | )
1211 |
1212 | # Offset for pk of courseware.StudentModuleHistoryExtended
1213 | STUDENTMODULEHISTORYEXTENDED_OFFSET = config(
1214 | "STUDENTMODULEHISTORYEXTENDED_OFFSET",
1215 | default=STUDENTMODULEHISTORYEXTENDED_OFFSET,
1216 | formatter=int,
1217 | )
1218 |
1219 | # Cutoff date for granting audit certificates
1220 | AUDIT_CERT_CUTOFF_DATE = config(
1221 | "AUDIT_CERT_CUTOFF_DATE", default=None, formatter=dateutil.parser.parse
1222 | )
1223 |
1224 | ################################ Settings for Credentials Service ################################
1225 |
1226 | CREDENTIALS_GENERATION_ROUTING_KEY = config(
1227 | "CREDENTIALS_GENERATION_ROUTING_KEY", default=HIGH_PRIORITY_QUEUE
1228 | )
1229 |
1230 | # The extended StudentModule history table
1231 | if FEATURES.get("ENABLE_CSMH_EXTENDED"):
1232 | INSTALLED_APPS.append("coursewarehistoryextended")
1233 |
1234 | API_ACCESS_MANAGER_EMAIL = config(
1235 | "API_ACCESS_MANAGER_EMAIL", default=API_ACCESS_MANAGER_EMAIL
1236 | )
1237 | API_ACCESS_FROM_EMAIL = config("API_ACCESS_FROM_EMAIL", default=API_ACCESS_FROM_EMAIL)
1238 |
1239 | # Mobile App Version Upgrade config
1240 | APP_UPGRADE_CACHE_TIMEOUT = config(
1241 | "APP_UPGRADE_CACHE_TIMEOUT", default=APP_UPGRADE_CACHE_TIMEOUT, formatter=int
1242 | )
1243 |
1244 | AFFILIATE_COOKIE_NAME = config("AFFILIATE_COOKIE_NAME", default=AFFILIATE_COOKIE_NAME)
1245 |
1246 | ############## Settings for LMS Context Sensitive Help ##############
1247 |
1248 | HELP_TOKENS_BOOKS = config(
1249 | "HELP_TOKENS_BOOKS", default=HELP_TOKENS_BOOKS, formatter=json.loads
1250 | )
1251 |
1252 |
1253 | ############## OPEN EDX ENTERPRISE SERVICE CONFIGURATION ######################
1254 | # The Open edX Enterprise service is currently hosted via the LMS container/process.
1255 | # However, for all intents and purposes this service is treated as a standalone IDA.
1256 | # These configuration settings are specific to the Enterprise service and you should
1257 | # not find references to them within the edx-platform project.
1258 |
1259 | # Publicly-accessible enrollment URL, for use on the client side.
1260 | ENTERPRISE_PUBLIC_ENROLLMENT_API_URL = config(
1261 | "ENTERPRISE_PUBLIC_ENROLLMENT_API_URL",
1262 | default=(LMS_ROOT_URL or "") + LMS_ENROLLMENT_API_PATH,
1263 | )
1264 |
1265 | # Enrollment URL used on the server-side.
1266 | ENTERPRISE_ENROLLMENT_API_URL = config(
1267 | "ENTERPRISE_ENROLLMENT_API_URL",
1268 | default=(LMS_INTERNAL_ROOT_URL or "") + LMS_ENROLLMENT_API_PATH,
1269 | )
1270 |
1271 | # Enterprise logo image size limit in KB's
1272 | ENTERPRISE_CUSTOMER_LOGO_IMAGE_SIZE = config(
1273 | "ENTERPRISE_CUSTOMER_LOGO_IMAGE_SIZE",
1274 | default=ENTERPRISE_CUSTOMER_LOGO_IMAGE_SIZE,
1275 | formatter=int,
1276 | )
1277 |
1278 | # Course enrollment modes to be hidden in the Enterprise enrollment page
1279 | # if the "Hide audit track" flag is enabled for an EnterpriseCustomer
1280 | ENTERPRISE_COURSE_ENROLLMENT_AUDIT_MODES = config(
1281 | "ENTERPRISE_COURSE_ENROLLMENT_AUDIT_MODES",
1282 | default=ENTERPRISE_COURSE_ENROLLMENT_AUDIT_MODES,
1283 | formatter=json.loads,
1284 | )
1285 |
1286 | # A support URL used on Enterprise landing pages for when a warning
1287 | # message goes off.
1288 | ENTERPRISE_SUPPORT_URL = config(
1289 | "ENTERPRISE_SUPPORT_URL", default=ENTERPRISE_SUPPORT_URL
1290 | )
1291 |
1292 | # A shared secret to be used for encrypting passwords passed from the enterprise api
1293 | # to the enteprise reporting script.
1294 | ENTERPRISE_REPORTING_SECRET = config(
1295 | "ENTERPRISE_REPORTING_SECRET", default=ENTERPRISE_REPORTING_SECRET
1296 | )
1297 |
1298 | # A default dictionary to be used for filtering out enterprise customer catalog.
1299 | ENTERPRISE_CUSTOMER_CATALOG_DEFAULT_CONTENT_FILTER = config(
1300 | "ENTERPRISE_CUSTOMER_CATALOG_DEFAULT_CONTENT_FILTER",
1301 | default=ENTERPRISE_CUSTOMER_CATALOG_DEFAULT_CONTENT_FILTER,
1302 | )
1303 |
1304 | ############## ENTERPRISE SERVICE API CLIENT CONFIGURATION ######################
1305 | # The LMS communicates with the Enterprise service via the EdxRestApiClient class
1306 | # The below environmental settings are utilized by the LMS when interacting with
1307 | # the service, and override the default parameters which are defined in common.py
1308 |
1309 | DEFAULT_ENTERPRISE_API_URL = None
1310 | if LMS_INTERNAL_ROOT_URL is not None:
1311 | DEFAULT_ENTERPRISE_API_URL = LMS_INTERNAL_ROOT_URL + "/enterprise/api/v1/"
1312 | ENTERPRISE_API_URL = config("ENTERPRISE_API_URL", default=DEFAULT_ENTERPRISE_API_URL)
1313 |
1314 | DEFAULT_ENTERPRISE_CONSENT_API_URL = None
1315 | if LMS_INTERNAL_ROOT_URL is not None:
1316 | DEFAULT_ENTERPRISE_CONSENT_API_URL = LMS_INTERNAL_ROOT_URL + "/consent/api/v1/"
1317 | ENTERPRISE_CONSENT_API_URL = config(
1318 | "ENTERPRISE_CONSENT_API_URL", default=DEFAULT_ENTERPRISE_CONSENT_API_URL
1319 | )
1320 |
1321 | ENTERPRISE_SERVICE_WORKER_USERNAME = config(
1322 | "ENTERPRISE_SERVICE_WORKER_USERNAME", default=ENTERPRISE_SERVICE_WORKER_USERNAME
1323 | )
1324 | ENTERPRISE_API_CACHE_TIMEOUT = config(
1325 | "ENTERPRISE_API_CACHE_TIMEOUT", default=ENTERPRISE_API_CACHE_TIMEOUT, formatter=int
1326 | )
1327 |
1328 | ############## ENTERPRISE SERVICE LMS CONFIGURATION ##################################
1329 | # The LMS has some features embedded that are related to the Enterprise service, but
1330 | # which are not provided by the Enterprise service. These settings override the
1331 | # base values for the parameters as defined in common.py
1332 |
1333 | ENTERPRISE_PLATFORM_WELCOME_TEMPLATE = config(
1334 | "ENTERPRISE_PLATFORM_WELCOME_TEMPLATE", default=ENTERPRISE_PLATFORM_WELCOME_TEMPLATE
1335 | )
1336 | ENTERPRISE_SPECIFIC_BRANDED_WELCOME_TEMPLATE = config(
1337 | "ENTERPRISE_SPECIFIC_BRANDED_WELCOME_TEMPLATE",
1338 | default=ENTERPRISE_SPECIFIC_BRANDED_WELCOME_TEMPLATE,
1339 | )
1340 | ENTERPRISE_TAGLINE = config("ENTERPRISE_TAGLINE", default=ENTERPRISE_TAGLINE)
1341 | ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS = set(
1342 | config(
1343 | "ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS",
1344 | default=ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS,
1345 | formatter=json.loads,
1346 | )
1347 | )
1348 | BASE_COOKIE_DOMAIN = config("BASE_COOKIE_DOMAIN", default=BASE_COOKIE_DOMAIN)
1349 |
1350 | ############## CATALOG/DISCOVERY SERVICE API CLIENT CONFIGURATION ######################
1351 | # The LMS communicates with the Catalog service via the EdxRestApiClient class
1352 | # The below environmental settings are utilized by the LMS when interacting with
1353 | # the service, and override the default parameters which are defined in common.py
1354 |
1355 | COURSES_API_CACHE_TIMEOUT = config(
1356 | "COURSES_API_CACHE_TIMEOUT", default=COURSES_API_CACHE_TIMEOUT, formatter=int
1357 | )
1358 |
1359 | # Add an ICP license for serving content in China if your organization is registered to do so
1360 | ICP_LICENSE = config("ICP_LICENSE", default=None, formatter=bool)
1361 |
1362 | ############## Settings for CourseGraph ############################
1363 | COURSEGRAPH_JOB_QUEUE = config("COURSEGRAPH_JOB_QUEUE", default=LOW_PRIORITY_QUEUE)
1364 |
1365 | ########################## Parental controls config #######################
1366 |
1367 | # The age at which a learner no longer requires parental consent, or None
1368 | # if parental consent is never required.
1369 | PARENTAL_CONSENT_AGE_LIMIT = config(
1370 | "PARENTAL_CONSENT_AGE_LIMIT", default=PARENTAL_CONSENT_AGE_LIMIT, formatter=int
1371 | )
1372 |
1373 | # Do NOT calculate this dynamically at startup with git because it's *slow*.
1374 | EDX_PLATFORM_REVISION = config("EDX_PLATFORM_REVISION", default=EDX_PLATFORM_REVISION)
1375 |
1376 | ########################## Extra middleware classes #######################
1377 |
1378 | # Allow extra middleware classes to be added to the app through configuration.
1379 | MIDDLEWARE_CLASSES.extend(
1380 | config("EXTRA_MIDDLEWARE_CLASSES", default=[], formatter=json.loads)
1381 | )
1382 |
1383 | ########################## Settings for Completion API #####################
1384 |
1385 | # Once a user has watched this percentage of a video, mark it as complete:
1386 | # (0.0 = 0%, 1.0 = 100%)
1387 | COMPLETION_VIDEO_COMPLETE_PERCENTAGE = config(
1388 | "COMPLETION_VIDEO_COMPLETE_PERCENTAGE",
1389 | default=COMPLETION_VIDEO_COMPLETE_PERCENTAGE,
1390 | formatter=float,
1391 | )
1392 | # The time a block needs to be viewed to be considered complete, in milliseconds.
1393 | COMPLETION_BY_VIEWING_DELAY_MS = config(
1394 | "COMPLETION_BY_VIEWING_DELAY_MS",
1395 | default=COMPLETION_BY_VIEWING_DELAY_MS,
1396 | formatter=int,
1397 | )
1398 |
1399 | ############### Settings for django-fernet-fields ##################
1400 | FERNET_KEYS = config("FERNET_KEYS", default=FERNET_KEYS, formatter=json.loads)
1401 |
1402 | ################# Settings for the maintenance banner #################
1403 | MAINTENANCE_BANNER_TEXT = config("MAINTENANCE_BANNER_TEXT", default=None)
1404 |
1405 | ############### Settings for Retirement #####################
1406 | RETIRED_USERNAME_PREFIX = config(
1407 | "RETIRED_USERNAME_PREFIX", default=RETIRED_USERNAME_PREFIX
1408 | )
1409 | RETIRED_EMAIL_PREFIX = config("RETIRED_EMAIL_PREFIX", default=RETIRED_EMAIL_PREFIX)
1410 | RETIRED_EMAIL_DOMAIN = config("RETIRED_EMAIL_DOMAIN", default=RETIRED_EMAIL_DOMAIN)
1411 | RETIREMENT_SERVICE_WORKER_USERNAME = config(
1412 | "RETIREMENT_SERVICE_WORKER_USERNAME", default=RETIREMENT_SERVICE_WORKER_USERNAME
1413 | )
1414 | RETIREMENT_STATES = config(
1415 | "RETIREMENT_STATES", default=RETIREMENT_STATES, formatter=json.loads
1416 | )
1417 |
1418 | ############################### Plugin Settings ###############################
1419 |
1420 | from openedx.core.djangoapps.plugins import (
1421 | plugin_settings,
1422 | constants as plugin_constants,
1423 | )
1424 |
1425 | plugin_settings.add_plugins(
1426 | __name__, plugin_constants.ProjectType.LMS, plugin_constants.SettingsType.AWS
1427 | )
1428 |
1429 | ########################## Derive Any Derived Settings #######################
1430 |
1431 | derive_settings(__name__)
1432 |
--------------------------------------------------------------------------------
/config/lms/docker_run_staging.py:
--------------------------------------------------------------------------------
1 | # This file includes overrides to build the `staging` environment for the LMS starting from the
2 | # settings of the `production` environment
3 |
4 | from docker_run_production import *
5 | from .utils import Configuration
6 |
7 | # Load custom configuration parameters from yaml files
8 | config = Configuration(os.path.dirname(__file__))
9 |
10 | LOGGING["handlers"]["sentry"]["environment"] = "staging"
11 |
12 | EMAIL_BACKEND = config(
13 | "EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
14 | )
15 |
--------------------------------------------------------------------------------
/config/lms/utils.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import yaml
4 | import os
5 |
6 | from django.core.exceptions import ImproperlyConfigured
7 |
8 |
9 | class Configuration(dict):
10 | """
11 | Try getting a setting from the settings.yml or secrets.yml files placed in
12 | the directory passed when initializing the configuration instance.
13 | """
14 |
15 | def __init__(self, dir=None, *args, **kwargs):
16 | """
17 | Initialize with the path to the directory in which the configuration is
18 | to be found.
19 | """
20 | super(Configuration, self).__init__(*args, **kwargs)
21 |
22 | if dir is None:
23 | self.settings = {}
24 |
25 | else:
26 | # Load the content of a `settings.yml` file placed in the current
27 | # directory if any. This file is where customizable settings are stored
28 | # for a given environment.
29 | try:
30 | with open(os.path.join(dir, "settings.yml")) as f:
31 | settings = yaml.load(f.read()) or {}
32 | except IOError:
33 | settings = {}
34 |
35 | # Load the content of a `secrets.yml` file placed in the current
36 | # directory if any. This file is where sensitive credentials are stored
37 | # for a given environment.
38 | try:
39 | with open(os.path.join(dir, "secrets.yml")) as f:
40 | credentials = yaml.load(f.read()) or {}
41 | except IOError:
42 | credentials = {}
43 |
44 | settings.update(credentials)
45 | self.settings = settings
46 |
47 | def __call__(self, var_name, formatter=str, *args, **kwargs):
48 | """
49 | The config returns in order of priority:
50 |
51 | - the value set in the secrets.yml file,
52 | - the value set in the settings.yml file,
53 | - the value set as environment variable
54 | - the value passed as default.
55 |
56 | If the value is passed as a string, a type is forced via the function passed in
57 | the "formatter" kwarg.
58 |
59 | Raise an "ImproperlyConfigured" error if the name is not found, except
60 | if the `default` key is given in kwargs (using kwargs allows to pass a
61 | default to None, which is different from not passing any default):
62 |
63 | $ config = Configuration('path/to/config/directory')
64 | $ config('foo') # raise ImproperlyConfigured error if `foo` is not defined
65 | $ config('foo', default='bar') # return 'bar' if `foo` is not defined
66 | $ config('foo', default=None) # return `None` if `foo` is not defined
67 | """
68 | try:
69 | value = self.settings[var_name]
70 | except KeyError:
71 | try:
72 | value = formatter(os.environ[var_name])
73 | except KeyError:
74 | if "default" in kwargs:
75 | value = kwargs["default"]
76 | else:
77 | raise ImproperlyConfigured(
78 | 'Please set the "{:s}" variable in a settings.yml file, a secrets.yml '
79 | "file or an environment variable.".format(var_name)
80 | )
81 | # If a formatter is specified, force the value but only if it was passed as a string
82 | if isinstance(value, basestring):
83 | value = formatter(value)
84 |
85 | return value
86 |
87 | def get(self, name, *args, **kwargs):
88 | """
89 | edX is loading the content of 2 json files to settings.ENV_TOKEN and settings.AUTH_TOKEN
90 | They have started calling these attributes anywhere in the code base, so we must make
91 | sure that the following call works (and the same for AUTH_TOKEN):
92 |
93 | settings.ENV_TOKEN.get('ANY_SETTING_NAME')
94 |
95 | That's what this method will do after we add this to our settings:
96 | ```
97 | config = Configuration('path/to/my/settings/directory.yml')
98 | ENV_TOKEN = config
99 | AUTH_TOKEN = config
100 | ```
101 | """
102 | try:
103 | default = args[0]
104 | except IndexError:
105 | # As a first approach, all defaults that are not provided by Open edX are set to None.
106 | # If this creates a problem, we can either:
107 | # - make sure we provide a value for this setting in our yaml files,
108 | # - make a PR to Open edX to provide a better default for this setting.
109 | default = None
110 | return self(name, default=default)
111 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.4"
2 |
3 | services:
4 | mysql:
5 | image: mysql:5.6
6 | ports:
7 | - "3316:3306"
8 | env_file: env.d/development
9 | command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
10 |
11 | mongodb:
12 | image: mongo:3.2
13 | # We use WiredTiger in all environments. In development environments we use small files
14 | # to conserve disk space, and disable the journal for a minor performance gain.
15 | # See https://docs.mongodb.com/v3.0/reference/program/mongod/#options for complete details.
16 | command: mongod --smallfiles --nojournal --storageEngine wiredTiger
17 |
18 | memcached:
19 | image: memcached:1.4
20 |
21 | mailcatcher:
22 | image: sj26/mailcatcher:latest
23 | ports:
24 | - "1080:1080"
25 |
26 | lms:
27 | build:
28 | context: .
29 | target: production
30 | image: edxapp:latest
31 | env_file: env.d/development
32 | environment:
33 | SERVICE_VARIANT: lms
34 | DJANGO_SETTINGS_MODULE: lms.envs.fun.docker_run
35 | volumes:
36 | - ./data/static/production:/edx/app/edxapp/staticfiles
37 | - ./data/media:/edx/var/edxapp/media
38 | - ./data/store:/edx/app/edxapp/data
39 | - ./config:/config
40 | depends_on:
41 | - mailcatcher
42 | - mysql
43 | - mongodb
44 | - memcached
45 | user: ${UID}:${GID}
46 |
47 | lms-dev:
48 | build:
49 | context: .
50 | target: development
51 | args:
52 | UID: ${UID}
53 | GID: ${GID}
54 | image: edxapp:dev
55 | env_file: env.d/development
56 | ports:
57 | - "8072:8000"
58 | volumes:
59 | - ./src/edx-platform:/edx/app/edxapp/edx-platform
60 | - ./data/static/development:/edx/app/edxapp/staticfiles
61 | - ./data/media:/edx/var/edxapp/media
62 | - ./data/store:/edx/app/edxapp/data
63 | - ./config:/config
64 | entrypoint: /usr/local/bin/entrypoint.sh
65 | command: >
66 | python manage.py lms runserver 0.0.0.0:8000 --settings=fun.docker_run_development
67 | depends_on:
68 | - mailcatcher
69 | - mysql
70 | - mongodb
71 | - memcached
72 |
73 | cms:
74 | image: edxapp:latest
75 | env_file: env.d/development
76 | environment:
77 | SERVICE_VARIANT: cms
78 | DJANGO_SETTINGS_MODULE: cms.envs.fun.docker_run
79 | volumes:
80 | - ./data/static/production:/edx/app/edxapp/staticfiles
81 | - ./data/media:/edx/var/edxapp/media
82 | - ./data/store:/edx/app/edxapp/data
83 | - ./config:/config
84 | depends_on:
85 | - lms
86 | user: ${UID}:${GID}
87 |
88 | cms-dev:
89 | image: edxapp:dev
90 | env_file: env.d/development
91 | ports:
92 | - "8082:8000"
93 | volumes:
94 | - ./src/edx-platform:/edx/app/edxapp/edx-platform
95 | - ./data/static/development:/edx/app/edxapp/staticfiles
96 | - ./data/media:/edx/var/edxapp/media
97 | - ./data/store:/edx/app/edxapp/data
98 | - ./config:/config
99 | entrypoint: /usr/local/bin/entrypoint.sh
100 | command: >
101 | python manage.py cms runserver 0.0.0.0:8000 --settings=fun.docker_run_development
102 | depends_on:
103 | - lms-dev
104 |
105 | nginx:
106 | image: nginx:1.13
107 | ports:
108 | - "8073:8071"
109 | - "8083:8081"
110 | volumes:
111 | - ./docker/files/etc/nginx/conf.d:/etc/nginx/conf.d:ro
112 | - ./data:/data:ro
113 | depends_on:
114 | - lms
115 | - cms
116 |
--------------------------------------------------------------------------------
/docker/files/etc/nginx/conf.d/cms.conf:
--------------------------------------------------------------------------------
1 | upstream cms-backend {
2 | server cms:8000 fail_timeout=0;
3 | }
4 |
5 | server {
6 | listen 8081;
7 | server_name localhost;
8 |
9 | # Prevent invalid display courseware in IE 10+ with high privacy settings
10 | add_header P3P 'CP="Open edX does not have a P3P policy."';
11 |
12 | client_max_body_size 100M;
13 |
14 | rewrite ^(.*)/favicon.ico$ /static/images/favicon.ico last;
15 |
16 | # Disables server version feedback on pages and in headers
17 | server_tokens off;
18 |
19 | location @proxy_to_cms_app {
20 | proxy_set_header X-Forwarded-Proto $scheme;
21 | proxy_set_header X-Forwarded-Port $server_port;
22 | proxy_set_header X-Forwarded-For $remote_addr;
23 |
24 | proxy_set_header Host $http_host;
25 |
26 | proxy_redirect off;
27 | proxy_pass http://cms-backend;
28 | }
29 |
30 | location / {
31 | try_files $uri @proxy_to_cms_app;
32 | }
33 |
34 | location ~ ^/static/(?P.*) {
35 | root /data/static/production;
36 | try_files /$file =404;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/docker/files/etc/nginx/conf.d/lms.conf:
--------------------------------------------------------------------------------
1 | upstream lms-backend {
2 | server lms:8000 fail_timeout=0;
3 | }
4 |
5 | server {
6 | listen 8071;
7 | server_name localhost;
8 |
9 | # Prevent invalid display courseware in IE 10+ with high privacy settings
10 | add_header P3P 'CP="Open edX does not have a P3P policy."';
11 |
12 | client_max_body_size 4M;
13 |
14 | rewrite ^(.*)/favicon.ico$ /static/images/favicon.ico last;
15 |
16 | # Disables server version feedback on pages and in headers
17 | server_tokens off;
18 |
19 | location @proxy_to_lms_app {
20 | proxy_set_header X-Forwarded-Proto $scheme;
21 | proxy_set_header X-Forwarded-Port $server_port;
22 | proxy_set_header X-Forwarded-For $remote_addr;
23 |
24 | proxy_set_header Host $http_host;
25 |
26 | proxy_redirect off;
27 | proxy_pass http://lms-backend;
28 | }
29 |
30 | location / {
31 | try_files $uri @proxy_to_lms_app;
32 | }
33 |
34 | # /login?next= can be used by 3rd party sites in
tags to
35 | # determine whether a user on their site is logged into edX.
36 | # The most common image to use is favicon.ico.
37 | location /login {
38 | if ( $arg_next ~* "favicon.ico" ) {
39 | return 403;
40 | }
41 | try_files $uri @proxy_to_lms_app;
42 | }
43 |
44 | # Need a separate location for the image uploads endpoint to limit upload sizes
45 | location ~ ^/api/profile_images/[^/]*/[^/]*/upload$ {
46 | try_files $uri @proxy_to_lms_app;
47 | client_max_body_size 1049576;
48 | }
49 |
50 | location ~ ^/media/(?P.*) {
51 | root /data/media;
52 | try_files /$file =404;
53 | expires 31536000s;
54 | }
55 |
56 | location ~ ^/static/(?P.*) {
57 | root /data/static/production;
58 | try_files /$file =404;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/docker/files/usr/local/bin/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 | # Development entrypoint
4 | #
5 |
6 | # Activate user's virtualenv
7 | source /edx/app/edxapp/venv/bin/activate
8 | exec "$@"
9 |
--------------------------------------------------------------------------------
/env.d/development:
--------------------------------------------------------------------------------
1 | # Django
2 | SERVICE_VARIANT: lms
3 | DJANGO_SETTINGS_MODULE: lms.envs.fun.docker_run
4 |
5 | # Database
6 | MYSQL_ROOT_PASSWORD=
7 | MYSQL_ALLOW_EMPTY_PASSWORD=yes
8 | MYSQL_DATABASE=edxapp
9 | MYSQL_USER=edxapp_user
10 | MYSQL_PASSWORD=password
11 |
12 | # Email
13 | EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
14 | EMAIL_HOST=mailcatcher
15 | EMAIL_PORT=1025
16 |
17 | # Python
18 | PYTHONUNBUFFERED=1
19 |
20 | # Queues
21 | CELERY_ALWAYS_EAGER=1
22 |
23 | # Features
24 | FEATURES={"AUTOMATIC_AUTH_FOR_TESTING": true, "RESTRICT_AUTOMATIC_AUTH": false}
25 |
--------------------------------------------------------------------------------