Feature: configuration setting `PREVIEW_LMS_BASE`

discussion: https://discuss.overhang.io/t/new-settings-variable/1973/4
This commit is contained in:
Crist 2021-10-04 20:14:28 +08:00 committed by Régis Behmo
parent c1e63c873a
commit e3788257db
9 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,8 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Feature] Add configuration setting `PREVIEW_LMS_BASE` for custom preview domain.
## v12.1.3 (2021-09-28)
- [Bugfix] Fix 500 error during user registration.

View File

@ -188,7 +188,7 @@ When ``ENABLE_HTTPS`` is ``true``, the whole Open edX platform will be reconfigu
The following DNS records must exist and point to your server::
LMS_HOST (e.g: myopenedx.com)
preview.LMS_HOST (e.g: preview.myopenedx.com)
PREVIEW_LMS_HOST (e.g: preview.myopenedx.com)
CMS_HOST (e.g: studio.myopenedx.com)
Thus, **this feature will (probably) not work in development** because the DNS records will (probably) not point to your development machine.

View File

@ -184,7 +184,7 @@ The containerized web server (`Caddy <https://caddyserver.com/>`__) needs to lis
tutor config save --set RUN_CADDY=false --set NGINX_HTTP_PORT=81
In this example, the nginx container port would be mapped to 81 instead of 80. You must then configure the web proxy on the host. As of v11.0.0, configuration files are no longer provided for automatic configuration of your web proxy. Basically, you should setup a reverse proxy to `localhost:NGINX_HTTP_PORT` from the following hosts: LMS_HOST, preview.LMS_HOST, CMS_HOST, as well as any additional host exposed by your plugins.
In this example, the nginx container port would be mapped to 81 instead of 80. You must then configure the web proxy on the host. As of v11.0.0, configuration files are no longer provided for automatic configuration of your web proxy. Basically, you should setup a reverse proxy to `localhost:NGINX_HTTP_PORT` from the following hosts: LMS_HOST, PREVIEW_LMS_HOST, CMS_HOST, as well as any additional host exposed by your plugins.
.. warning::
In this setup, the Nginx HTTP port will be exposed to the world. Make sure to configure your server firewall to block unwanted connections to your server's `NGINX_HTTP_PORT`. Alternatively, you can configure the Nginx container to accept only local connections::

View File

@ -3,7 +3,7 @@
header_up X-Forwarded-Port {{ 443 if ENABLE_HTTPS else 80 }}
}
}
preview.{{ LMS_HOST }}{% if not ENABLE_HTTPS %}:80{% endif %} {
{{ PREVIEW_LMS_HOST }}{% if not ENABLE_HTTPS %}:80{% endif %} {
reverse_proxy nginx:80
}
{{ CMS_HOST }}{% if not ENABLE_HTTPS %}:80{% endif %} {

View File

@ -5,7 +5,7 @@ upstream lms-backend {
server {
listen 80;
server_name {{ LMS_HOST }} preview.{{ LMS_HOST }};
server_name {{ LMS_HOST }} {{ PREVIEW_LMS_HOST }};
access_log /var/log/nginx/access.log tutor;
client_max_body_size 4M;

View File

@ -9,7 +9,7 @@
{{ patch("common-env-features", separator=",\n", suffix=",")|indent(4) }}
{{ patch("cms-env-features", separator=",\n", suffix=",")|indent(4) }}
"CERTIFICATES_HTML_VIEW": true,
"PREVIEW_LMS_BASE": "preview.{{ LMS_HOST }}",
"PREVIEW_LMS_BASE": "{{ PREVIEW_LMS_HOST }}",
"ENABLE_COURSEWARE_INDEX": true,
"ENABLE_CSMH_EXTENDED": false,
"ENABLE_LEARNER_RECORDS": false,

View File

@ -9,7 +9,7 @@
{{ patch("common-env-features", separator=",\n", suffix=",")|indent(4) }}
{{ patch("lms-env-features", separator=",\n", suffix=",")|indent(4) }}
"CERTIFICATES_HTML_VIEW": true,
"PREVIEW_LMS_BASE": "preview.{{ LMS_HOST }}",
"PREVIEW_LMS_BASE": "{{ PREVIEW_LMS_HOST }}",
"ENABLE_CORS_HEADERS": true,
"ENABLE_COURSE_DISCOVERY": true,
"ENABLE_COURSEWARE_SEARCH": true,

View File

@ -4,7 +4,7 @@ from cms.envs.devstack import *
LMS_BASE = "{{ LMS_HOST }}:8000"
LMS_ROOT_URL = "http://" + LMS_BASE
FEATURES["PREVIEW_LMS_BASE"] = "preview." + LMS_BASE
FEATURES["PREVIEW_LMS_BASE"] = "{{ PREVIEW_LMS_HOST }}:8000"
{% include "apps/openedx/settings/partials/common_cms.py" %}

View File

@ -20,6 +20,7 @@ RUN_MYSQL: true
RUN_REDIS: true
RUN_SMTP: true
CMS_HOST: "studio.{{ LMS_HOST }}"
PREVIEW_LMS_HOST: "preview.{{ LMS_HOST }}"
CONTACT_EMAIL: "contact@{{ LMS_HOST }}"
OPENEDX_AWS_ACCESS_KEY: ""
OPENEDX_AWS_SECRET_ACCESS_KEY: ""