Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,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)
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.
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ With these changes, Tutor will no longer listen to ports 80 and 443 on the host.

It is then your responsibility to configure the web proxy on the host. There are too many use cases and proxy vendors, so Tutor does not provide configuration files that will work for everyone. You should configure your web proxy to:

- Capture traffic for the following hostnames: LMS_HOST, CMS_HOST, as well as any additional host exposed by your plugins (MFE_HOST, CREDENTIALS_HOST, etc.). See each plugin documentation for more information.
- Capture traffic for the following hostnames: LMS_HOST, PREVIEW_LMS_HOST, CMS_HOST, as well as any additional host exposed by your plugins (MFE_HOST, CREDENTIALS_HOST, etc.). See each plugin documentation for more information.
- If SSL/TLS is enabled:
- Perform SSL/TLS termination using your own certificates.
- Forward http traffic to https.
Expand Down
2 changes: 2 additions & 0 deletions tutor/commands/jobs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def assign_theme(name, domain):
"{{ LMS_HOST }}:8000",
"{{ CMS_HOST }}",
"{{ CMS_HOST }}:8001",
"{{ PREVIEW_LMS_HOST }}",
"{{ PREVIEW_LMS_HOST }}:8000",
]
for domain_name in domain_names:
python_command += f"assign_theme('{theme_name}', '{domain_name}')\n"
Expand Down
16 changes: 16 additions & 0 deletions tutor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,19 @@ def _update_enabled_plugins_on_unload(_plugin: str, _root: str, config: Config)
Note that this action must be performed after the plugin has been unloaded, hence the low priority.
"""
save_enabled_plugins(config)


@hooks.Actions.CONFIG_LOADED.add()
def _check_preview_lms_host(config: Config) -> None:
"""
This will check if the PREVIEW_LMS_HOST is a subdomain of LMS_HOST.
if not, prints a warning to notify the user.
"""

lms_host = get_typed(config, "LMS_HOST", str, "")
preview_lms_host = get_typed(config, "PREVIEW_LMS_HOST", str, "")
if not preview_lms_host.endswith("." + lms_host):
fmt.echo_alert(
f'Warning: PREVIEW_LMS_HOST="{preview_lms_host}" is not a subdomain of LMS_HOST="{lms_host}". '
"This configuration is not typically recommended and may lead to unexpected behavior."
)
2 changes: 1 addition & 1 deletion tutor/templates/apps/caddy/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{{ patch("caddyfile-proxy")|indent(4) }}
}

{{ LMS_HOST }}{$default_site_port} {
{{ LMS_HOST }}{$default_site_port}, {{ PREVIEW_LMS_HOST }}{$default_site_port} {
@favicon_matcher {
path_regexp ^/favicon.ico$
}
Expand Down
1 change: 1 addition & 0 deletions tutor/templates/apps/openedx/config/cms.env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ FEATURES:
{{ patch("common-env-features")|indent(2) }}
{{ patch("cms-env-features")|indent(2) }}
CERTIFICATES_HTML_VIEW: true
PREVIEW_LMS_BASE: "{{ PREVIEW_LMS_HOST }}"
ENABLE_CSMH_EXTENDED: false
ENABLE_LEARNER_RECORDS: false
ENABLE_LIBRARY_INDEX: true
Expand Down
1 change: 1 addition & 0 deletions tutor/templates/apps/openedx/config/lms.env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ FEATURES:
{{ patch("common-env-features")|indent(2) }}
{{ patch("lms-env-features")|indent(2) }}
CERTIFICATES_HTML_VIEW: true
PREVIEW_LMS_BASE: "{{ PREVIEW_LMS_HOST }}"
ENABLE_CSMH_EXTENDED: false
ENABLE_COMBINED_LOGIN_REGISTRATION: true
ENABLE_GRADE_DOWNLOADS: true
Expand Down
2 changes: 2 additions & 0 deletions tutor/templates/apps/openedx/settings/cms/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
SOCIAL_AUTH_EDX_OAUTH2_KEY = "{{ CMS_OAUTH2_KEY_SSO_DEV }}"
SOCIAL_AUTH_EDX_OAUTH2_PUBLIC_URL_ROOT = LMS_ROOT_URL

FEATURES["PREVIEW_LMS_BASE"] = "{{ PREVIEW_LMS_HOST }}:8000"

# Setup correct webpack configuration file for development
WEBPACK_CONFIG_PATH = "webpack.dev.config.js"

Expand Down
1 change: 1 addition & 0 deletions tutor/templates/apps/openedx/settings/lms/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

ALLOWED_HOSTS = [
ENV_TOKENS.get("LMS_BASE"),
FEATURES["PREVIEW_LMS_BASE"],
"lms",
]
CORS_ORIGIN_WHITELIST.append("{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}")
Expand Down
1 change: 1 addition & 0 deletions tutor/templates/config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ MYSQL_PORT: 3306
MYSQL_ROOT_USERNAME: "root"
NPM_REGISTRY: "https://registry.npmjs.org/"
PLATFORM_NAME: "My Open edX"
PREVIEW_LMS_HOST: "preview.{{ LMS_HOST }}"
REDIS_HOST: "redis"
REDIS_PORT: 6379
REDIS_USERNAME: ""
Expand Down