Skip to content

mfe checkpoint #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: mfe-checkpoint-head
Choose a base branch
from
Draft
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
39 changes: 25 additions & 14 deletions tutormfe/patches/local-docker-compose-dev-services
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# MFE apps
{% for app_name, app in iter_mfes() %}
{{ app_name }}:
image: "{{ DOCKER_REGISTRY }}overhangio/openedx-{{ app_name }}-dev:{{ MFE_VERSION }}"
ports:
- "{{ app["port"] }}:{{ app["port"] }}"
stdin_open: true
tty: true
volumes:
- ../plugins/mfe/apps/mfe/webpack.dev-tutor.config.js:/openedx/app/webpack.dev-tutor.config.js:ro
{%- for mount in iter_mounts(MOUNTS, app_name) %}
- {{ mount }}
{%- endfor %}
# Web proxy for load balancing and SSL termination
caddy:
image: {{ DOCKER_IMAGE_CADDY }}
restart: unless-stopped
ports:
- "{{ CADDY_HTTP_PORT }}:80"
{% if ENABLE_HTTPS and ENABLE_WEB_PROXY %}- "443:443"{% endif %}
environment:
default_site_port: "{% if not ENABLE_HTTPS or not ENABLE_WEB_PROXY %}:80{% endif %}"
volumes:
- ../apps/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
{% if ENABLE_HTTPS and ENABLE_WEB_PROXY %}- ../../data/caddy:/data{% endif %}
{% if not ENABLE_HTTPS %}
networks:
default:
# These aliases are for internal communication between containers when running locally
# with *.local.overhang.io hostnames.
aliases:
- "{{ LMS_HOST }}"
{{ patch("local-docker-compose-caddy-aliases")|indent(10) }}
{% endif %}
mfe:
image: {{ MFE_DOCKER_IMAGE }}
restart: unless-stopped
volumes:
- ../plugins/mfe/apps/mfe/Caddyfile:/etc/caddy/Caddyfile:ro
depends_on:
- lms
{% endfor %}
11 changes: 9 additions & 2 deletions tutormfe/patches/openedx-cms-development-settings
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# MFE-specific settings
{% for app_name, app in iter_mfes() %}
{% if app_name == "course-authoring" %}
COURSE_AUTHORING_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ app["port"] }}/course-authoring"
CORS_ORIGIN_WHITELIST.append("http://{{ MFE_HOST }}:{{ app["port"] }}")
COURSE_AUTHORING_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}:{{ app["port"] }}/course-authoring"
CORS_ORIGIN_WHITELIST.append("{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}:{{ app["port"] }}")
LOGIN_REDIRECT_WHITELIST.append("{{ MFE_HOST }}:{{ app["port"] }}")
CSRF_TRUSTED_ORIGINS.append("{{ MFE_HOST }}:{{ app["port"] }}")
{% endif %}
CORS_ORIGIN_WHITELIST.append("http://local.overhang.io:{{ app["port"] }}")
LOGIN_REDIRECT_WHITELIST.append("local.overhang.io:{{ app["port"] }}")
CSRF_TRUSTED_ORIGINS.append("local.overhang.io:{{ app["port"] }}")
{% endfor %}

LOGIN_REDIRECT_WHITELIST.append("{{ MFE_HOST }}")
CORS_ORIGIN_WHITELIST.append("{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}")
CSRF_TRUSTED_ORIGINS.append("{{ MFE_HOST }}")
11 changes: 7 additions & 4 deletions tutormfe/patches/openedx-lms-development-settings
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ MFE_CONFIG = {
# MFE-specific settings
{% for app_name, app in iter_mfes() %}
{% if app_name == "authn" %}
AUTHN_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ app["port"] }}/authn"
AUTHN_MICROFRONTEND_DOMAIN = "{{ MFE_HOST }}/authn"
AUTHN_MICROFRONTEND_URL = "http://local.overhang.io:1999"
AUTHN_MICROFRONTEND_DOMAIN = "local.overhang.io:1999"
MFE_CONFIG["DISABLE_ENTERPRISE_LOGIN"] = True
{% elif app_name == "account" %}
ACCOUNT_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ app["port"] }}/account"
Expand Down Expand Up @@ -58,7 +58,10 @@ MFE_CONFIG["SCHEDULE_EMAIL_SECTION"] = True
CORS_ORIGIN_WHITELIST.append("http://{{ MFE_HOST }}:{{ app["port"] }}")
LOGIN_REDIRECT_WHITELIST.append("{{ MFE_HOST }}:{{ app["port"] }}")
CSRF_TRUSTED_ORIGINS.append("{{ MFE_HOST }}:{{ app["port"] }}")
CORS_ORIGIN_WHITELIST.append("http://local.overhang.io:{{ app["port"] }}")
LOGIN_REDIRECT_WHITELIST.append("local.overhang.io:{{ app["port"] }}")
CSRF_TRUSTED_ORIGINS.append("local.overhang.io:{{ app["port"] }}")
{% endfor %}

{{ patch("mfe-lms-common-settings") }}
{{ patch("mfe-lms-development-settings") }}
LOGIN_REDIRECT_WHITELIST.append("{{ MFE_HOST }}")
CORS_ORIGIN_WHITELIST.append("{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}")
17 changes: 0 additions & 17 deletions tutormfe/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,6 @@ def is_mfe_enabled(mfe_name: str) -> bool:
)
)


# Build, pull and push {mfe}-dev images
for mfe_name, mfe_attrs in iter_mfes():
name = f"{mfe_name}-dev"
tag = "{{ DOCKER_REGISTRY }}overhangio/openedx-" + name + ":{{ MFE_VERSION }}"
tutor_hooks.Filters.IMAGES_BUILD.add_item(
(
name,
os.path.join("plugins", "mfe", "build", "mfe"),
tag,
(f"--target={mfe_name}-dev",),
)
)
tutor_hooks.Filters.IMAGES_PULL.add_item((name, tag))
tutor_hooks.Filters.IMAGES_PUSH.add_item((name, tag))


# init script
with open(
os.path.join(
Expand Down