Skip to content
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

MFE theming #64

Draft
wants to merge 2 commits into
base: main
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
36 changes: 21 additions & 15 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,58 +1,64 @@
[submodule "mfe/frontend-app-profile"]
path = mfe/frontend-app-profile
url = [email protected]:Abstract-Tech/community-theme-profile.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-learning"]
path = mfe/frontend-app-learning
url = [email protected]:Abstract-Tech/community-theme-learning.git
branch = community-theme.master
branch = community-theme.quince
[submodule "mfe/frontend-app-course_about"]
path = mfe/frontend-app-course_about
url = [email protected]:Abstract-Tech/community-theme-course-about.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-gradebook"]
path = mfe/frontend-app-gradebook
url = [email protected]:Abstract-Tech/community-theme-gradebook.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-account"]
path = mfe/frontend-app-account
url = [email protected]:Abstract-Tech/community-theme-account.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-home"]
path = mfe/frontend-app-home
url = [email protected]:Abstract-Tech/community-theme-home.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-component-footer"]
path = mfe/frontend-component-footer
url = [email protected]:Abstract-Tech/community-theme-footer.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-component-header"]
path = mfe/frontend-component-header
url = [email protected]:Abstract-Tech/community-theme-header.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/brand-openedx"]
path = mfe/brand-openedx
url = [email protected]:Abstract-Tech/community-theme-brand.git
branch = community-theme
[submodule "mfe/frontend-app-discussions"]
path = mfe/frontend-app-discussions
url = [email protected]:Abstract-Tech/community-theme-discussions.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-authn"]
path = mfe/frontend-app-authn
url = [email protected]:Abstract-Tech/community-theme-authn.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-course-authoring"]
path = mfe/frontend-app-course-authoring
url = [email protected]:Abstract-Tech/community-theme-course-authoring.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-communications"]
path = mfe/frontend-app-communications
url = [email protected]:Abstract-Tech/community-theme-communications.git
branch = community-theme.palm
branch = community-theme.quince
[submodule "mfe/frontend-app-ora-grading"]
path = mfe/frontend-app-ora-grading
url = [email protected]:Abstract-Tech/community-theme-ora-grading.git
branch = community-theme.palm


branch = community-theme.quince
[submodule "mfe/frontend-app-learning-themed"]
path = mfe/frontend-app-learning-themed
url = [email protected]:Abstract-Tech/community-theme-learning-themed.git
branch = community-theme.quince
[submodule "mfe/brand-openedx-themed"]
path = mfe/brand-openedx-themed
url = [email protected]:Abstract-Tech/community-theme-brand-themed.git
branch = community-theme
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CMS_OAUTH2_SECRET: 2icx54cdu9SJ77KMlZgHTWcm
CONTACT_EMAIL: [email protected]
DOCKER_IMAGE_CADDY: docker.io/library/caddy:2.7.5
DOCKER_IMAGE_OPENEDX: docker.io/abstract2tech/community-theme-openedx:17.0.0
EDX_PLATFORM_REPOSITORY: https://github.com/Abstract-Tech/edx-platform.git
EDX_PLATFORM_VERSION: community-theme
ENABLE_HTTPS: false
ENABLE_WEB_PROXY: true
ID: jxBish2U54zbLTe82GMVvnyO
Expand Down
1 change: 1 addition & 0 deletions mfe/brand-openedx-themed
Submodule brand-openedx-themed added at 7b068c
1 change: 1 addition & 0 deletions mfe/frontend-app-learning-themed
10 changes: 8 additions & 2 deletions plugins/community-mfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,21 @@ def mfe_forks(mfes):
"name": "course_about",
}
# Note: The changes of the following might not take effect due to tutor order of loading plugins
# This to change it you might need to edit the upstream pplugin at:
# This to change it you might need to edit the upstream plugin at:
# https://github.com/Abstract-Tech/openedx-tutor-plugins/blob/5556c1d5c55e1a0e95f36a9f0b89dbf21382f581/plugins/tutor-contrib-learner-dashboard-mfe/tutor_learner_dashboard_mfe/plugin.py#L20-L25
mfes["learner-dashboard"] = {
"repository": "https://github.com/Abstract-Tech/community-theme-learner-dashboard.git",
"version": "community-theme.quince",
"refs": "https://api.github.com/repos/abstract-tech/community-theme-learner-dashboard/git/refs/heads",
"port":1996,
}

mfes["learning-themed"] = {
"repository": "https://github.com/Abstract-Tech/community-theme-learning-themed",
"version": "community-theme.quince",
"refs": "https://api.github.com/repos/abstract-tech/community-theme-learning-themed/git/refs/heads",
"port": 2003,
"name": "learning-themed",
}
return mfes


Expand Down
96 changes: 96 additions & 0 deletions plugins/theming-mfe-local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
from tutor import hooks


hooks.Filters.ENV_PATCHES.add_items(
[
(
"caddyfile",
"""
microsite.{{ MFE_HOST }}{$default_site_port} preview.microsite.{{ MFE_HOST }}{$default_site_port} {
@favicon_matcher {
path_regexp ^/favicon.ico$
}
rewrite @favicon_matcher /theming/asset/images/favicon.ico

# Limit profile image upload size
handle_path /api/profile_images/*/*/upload {
request_body {
max_size 1MB
}
}

import proxy "lms:8000"

route /courses/*/about {
reverse_proxy "mfe:8002" {
rewrite /course_about/{uri}
header_up X-Forwarded-Port 80
}
}

route /course_about/* {
reverse_proxy "mfe:8002" {
header_up X-Forwarded-Port 80
}
}
route / {
reverse_proxy "mfe:8002" {
rewrite /home/{uri}
header_up X-Forwarded-Port 80
}
}

route /home/* {
reverse_proxy "mfe:8002" {
header_up X-Forwarded-Port 80
}
}
header * {
Content-Security-Policy "frame-ancestors microsite.{{ MFE_HOST }} *.microsite.{{ MFE_HOST }};"
}

handle_path /* {
request_body {
max_size 4MB
}
}
}

apps.microsite.{{ MFE_HOST }}{$default_site_port} {
respond / 204
request_body {
max_size 2MB
}
import proxy "mfe:8002"
}
""",
),
(
"openedx-lms-production-settings",
"""
LOGIN_REDIRECT_WHITELIST.append("apps.microsite.{{ LMS_HOST }}")
CORS_ORIGIN_WHITELIST.append("http://apps.microsite.{{ LMS_HOST }}")
CSRF_TRUSTED_ORIGINS.append("apps.microsite.{{ LMS_HOST }}")

LOGIN_REDIRECT_WHITELIST.append("microsite.{{ LMS_HOST }}")
CORS_ORIGIN_WHITELIST.append("http://microsite.{{ LMS_HOST }}")
CSRF_TRUSTED_ORIGINS.append("microsite.{{ LMS_HOST }}")

ALLOWED_HOSTS.append("microsite.{{ LMS_HOST }}")
""",
),
(
"mfe-dockerfile-post-npm-install-learning-themed",
"""
ADD https://api.github.com/repos/abstract-tech/community-theme-brand-themed/git/refs/heads/community-theme /tmp/gitref-brand
RUN npm install '@edx/brand@git+https://[email protected]/abstract-tech/community-theme-brand-themed.git#community-theme' --registry=$NPM_REGISTRY
""",
),
(
"local-docker-compose-caddy-aliases",
"""
- microsite.{{ LMS_HOST }}
""",
),
]
)