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

feat: upgrade to quince #156

Merged
merged 95 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
8b55b31
docs: change quickstart to launch
Sep 20, 2022
d6241d3
Merge remote-tracking branch 'origin/master' into nightly
Oct 3, 2022
2e8cf0d
Merge remote-tracking branch 'origin/master' into nightly
Nov 7, 2022
a0f22c8
Merge remote-tracking branch 'origin/master' into nightly
Nov 7, 2022
3e766a4
Merge remote-tracking branch 'origin/master' into nightly
Nov 7, 2022
11088ee
Merge remote-tracking branch 'origin/master' into nightly
Nov 8, 2022
c94c952
Merge remote-tracking branch 'origin/master' into nightly
Nov 8, 2022
882f94f
Merge remote-tracking branch 'origin/master' into nightly
Nov 10, 2022
037a239
Merge remote-tracking branch 'origin/master' into nightly
Nov 14, 2022
c86fa2b
Merge remote-tracking branch 'origin/master' into nightly
Nov 16, 2022
f4129d1
Merge remote-tracking branch 'origin/master' into nightly
Nov 17, 2022
9ad9263
feat: enable dynamic config
ghassanmas Oct 12, 2022
33677c4
chore: fix filter deprecation warning
regisb Dec 8, 2022
d470e87
ci: push mfe image on release
regisb Dec 8, 2022
bee2faa
docs: mfe is now run as usual on k8s
regisb Dec 8, 2022
1894b5e
fix: mfe containers now depend on lms to start
regisb Dec 8, 2022
6eb91dd
chore: get rid of deprecated feature flag
regisb Dec 8, 2022
14fa773
fix: profile url when accessed from other MFEs
regisb Dec 8, 2022
c615991
fix: do not enable learner records
regisb Dec 8, 2022
13b5b20
fix: lower MFE config API cache timeout
regisb Dec 8, 2022
1eb86e0
feat: Add support for the Course Authoring MFE
Nov 18, 2022
5e2da85
feat: Add support for the Discussions MFE
Nov 28, 2022
7e06203
fix: add missing CSRF configuration
Dec 9, 2022
3175718
feat: add support for the authn MFE
Dec 7, 2022
7f905ec
fix: Don't rebuild image on `local start`
Dec 12, 2022
590b5c3
Merge remote-tracking branch 'origin/master' into nightly
Dec 12, 2022
5841831
Merge remote-tracking branch 'origin/master' into nightly
Dec 13, 2022
4b0e547
Merge remote-tracking branch 'origin/master' into nightly
Dec 13, 2022
dff9962
Merge remote-tracking branch 'origin/master' into nightly
Dec 14, 2022
e819a63
Merge remote-tracking branch 'origin/master' into nightly
Dec 14, 2022
1ae93f5
Merge remote-tracking branch 'origin/master' into nightly
Dec 15, 2022
a06461e
Merge remote-tracking branch 'origin/master' into nightly
Dec 15, 2022
462ac87
Merge remote-tracking branch 'origin/master' into nightly
Dec 23, 2022
af1dbd5
Merge remote-tracking branch 'origin/master' into nightly
Jan 9, 2023
4a055d7
Merge remote-tracking branch 'origin/master' into nightly
Jan 20, 2023
eb07d17
Merge remote-tracking branch 'origin/master' into nightly
Jan 26, 2023
8589359
Merge remote-tracking branch 'origin/master' into nightly
Feb 27, 2023
feb8162
Merge remote-tracking branch 'origin/master' into nightly
Mar 9, 2023
81d382a
Merge remote-tracking branch 'origin/master' into nightly
Mar 10, 2023
19d3e61
Merge remote-tracking branch 'origin/master' into nightly
May 11, 2023
d4c8a84
Merge remote-tracking branch 'origin/master' into nightly
May 11, 2023
d7e79e9
Merge remote-tracking branch 'origin/master' into nightly
May 16, 2023
e00b11d
Merge remote-tracking branch 'origin/master' into nightly
May 16, 2023
41a5365
Merge remote-tracking branch 'origin/master' into nightly
May 17, 2023
b84a08f
Merge remote-tracking branch 'origin/master' into nightly
May 19, 2023
033436a
Merge remote-tracking branch 'origin/master' into nightly
May 22, 2023
6d3f09d
Merge remote-tracking branch 'origin/master' into nightly
May 26, 2023
02f53d3
Merge remote-tracking branch 'origin/master' into nightly
May 26, 2023
4745014
Merge remote-tracking branch 'origin/master' into nightly
May 26, 2023
3a4b9d1
feat: upgrade to Palm
regisb Apr 12, 2023
e053460
Merge remote-tracking branch 'origin/master' into nightly
Jun 14, 2023
be676c9
Merge remote-tracking branch 'origin/master' into nightly
Jun 14, 2023
30109c6
Merge remote-tracking branch 'origin/master' into nightly
Jun 16, 2023
d0cda5a
Merge remote-tracking branch 'origin/master' into nightly
Jun 23, 2023
5db943c
Merge remote-tracking branch 'origin/master' into nightly
arbrandes Jun 27, 2023
e3326d9
fix: on nightly, use the refs URL for branches
arbrandes Jun 27, 2023
4865447
Merge remote-tracking branch 'origin/master' into nightly
Jun 27, 2023
ce5521a
fix: development status is stable
regisb Jun 27, 2023
30fd24b
Revert "fix: on nightly, use the refs URL for branches"
arbrandes Jun 28, 2023
9a9ae9d
Merge remote-tracking branch 'origin/master' into nightly
arbrandes Jun 28, 2023
ae0c50a
fix: nightly version suffix
arbrandes Jun 28, 2023
c287909
Merge remote-tracking branch 'origin/master' into nightly
arbrandes Aug 7, 2023
a017426
Merge remote-tracking branch 'origin/master' into nightly
Aug 9, 2023
59b005a
Merge remote-tracking branch 'origin/master' into nightly
Aug 15, 2023
dd1b48e
Merge remote-tracking branch 'origin/master' into nightly
Aug 27, 2023
4bb1316
Merge remote-tracking branch 'origin/master' into nightly
Aug 28, 2023
93ba8b5
Merge remote-tracking branch 'origin/master' into nightly
Aug 28, 2023
8bd9c2f
Merge remote-tracking branch 'origin/master' into nightly
Sep 5, 2023
20b2977
Merge remote-tracking branch 'origin/master' into nightly
Sep 22, 2023
ae60b2d
fix: remove trailing slash from PUBLIC_PATH env var
ormsbee Oct 3, 2023
2fc1ead
chore: mark compatibility with python 3.12
regisb Oct 3, 2023
120e18a
Merge remote-tracking branch 'origin/master' into nightly
Oct 6, 2023
86fcac3
Merge remote-tracking branch 'origin/master' into nightly
Oct 6, 2023
03cc8e9
Merge remote-tracking branch 'origin/master' into nightly
Nov 1, 2023
054b3f9
Merge remote-tracking branch 'origin/master' into nightly
Nov 6, 2023
1b7dee4
Merge remote-tracking branch 'origin/master' into nightly
Nov 14, 2023
0202379
feat: add atlas pull for the communications app
OmarIthawi Sep 29, 2023
3c433a4
feat: add support for the Learner Dashboard MFE
arbrandes Nov 16, 2023
ad6be1c
Merge remote-tracking branch 'origin/master' into nightly
Nov 20, 2023
4a2df3c
Merge branch 'master' into nightly
regisb Nov 20, 2023
a8e2064
Merge remote-tracking branch 'origin/master' into nightly
Nov 28, 2023
c93271d
Merge remote-tracking branch 'origin/master' into nightly
Dec 5, 2023
d0e1005
Merge branch 'master' into nightly
regisb Dec 7, 2023
bda7db7
fix: append trailing slash to PUBLIC_PATH
arbrandes Dec 6, 2023
e899a07
Merge remote-tracking branch 'origin/master' into nightly
Dec 7, 2023
31022b9
Fix: Fix get_mfe() usage for learner-dashboard
arbrandes Dec 7, 2023
7f2a04f
fix: Fix Account and Learner Dashboard URLs
arbrandes Dec 7, 2023
aa62ada
feat: allow post npm build patch in Dockerfile
Danyal-Faheem Dec 8, 2023
a4a4fc5
Merge remote-tracking branch 'origin/master' into nightly
Dec 8, 2023
78f8c38
feat: Enable the new discussion sidebar in the Learning MFE
arbrandes Dec 8, 2023
e7277ed
Merge remote-tracking branch 'origin/master' into nightly
Dec 8, 2023
c4ed70c
fix: rate limiting caused by git repos cache check
gabor-boros Dec 4, 2023
2e4c3f7
local.overhang.io -> local.edly.io
regisb Dec 9, 2023
d38c731
fix: get_mfes cache clearing
regisb Dec 9, 2023
28d0d53
feat: upgrade to quince
regisb Oct 11, 2023
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ instructions, because git commits are used to generate release notes:

<!-- scriv-insert-here -->

<a id='changelog-17.0.0'></a>
## v17.0.0 (2023-12-09)

- 💥Upgrade to Quince (by @regisb).
- [Improvement] Added Makefile and test action to repository and formatted code with Black and isort. (by @CodeWithEmad)
- [Feature] Add support for the Learner Dashboard MFE. (by @arbrandes)
- [Bugfix] Append trailing slash to PUBLIC_PATH, as its absence breaks some MFEs. (by @arbrandes)
- [Feature] Added patch to allow changes to Dockerfile after the npm build has completed. (by @Danyal-Faheem)
- [Bugfix] Auto-build "mfe" image during `dev/local launch` in nightly. (by @regisb)
- [Bugfix] Specify port for dev server to listen on (by @michaelwheeler)
- [Feature] Enable the new per-unit discussions sidebar in the Learning MFE. (by @arbrandes)
- [Bugfix] Support MFE remotes that are not on GitHub. (by @gabor-boros and @regisb)
- 💥[Bugfix] Bypass rate-limiting when checking for upstream git changes. To achieve that, we use the `ADD --keep-git-dir` option, which is only compatible with BuildKit 0.11, from January 2023. Also, we get rid of the `get_github_refs_path` function. (by @gabor-boros and @regisb)

<a id='changelog-16.1.3'></a>
## v16.1.3 (2023-12-07)

Expand Down
23 changes: 14 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ In addition, this plugin comes with a few MFEs which are enabled by default:
- `Course Authoring <https://github.com/openedx/frontend-app-course-authoring/>`__
- `Discussions <https://github.com/openedx/frontend-app-discussions/>`__
- `Gradebook <https://github.com/openedx/frontend-app-gradebook/>`__
- `Learner Dashboard <https://github.com/openedx/frontend-app-learner-dashboard/>`__
- `Learning <https://github.com/openedx/frontend-app-learning/>`__
- `ORA Grading <https://github.com/openedx/frontend-app-ora-grading/>`__
- `Profile <https://github.com/openedx/frontend-app-profile/>`__
Expand Down Expand Up @@ -52,7 +53,7 @@ Account
.. image:: https://raw.githubusercontent.com/overhangio/tutor-mfe/master/screenshots/account.png
:alt: Account MFE screenshot

An MFE to manage account-specific information for every LMS user. Each user's account page is available at ``http(s)://{{ MFE_HOST }}/account``. For instance, when running locally: https://apps.local.overhang.io/account.
An MFE to manage account-specific information for every LMS user. Each user's account page is available at ``http(s)://{{ MFE_HOST }}/account``. For instance, when running locally: https://apps.local.edly.io/account.

Communications
~~~~~~~~~~~~~~
Expand Down Expand Up @@ -84,7 +85,15 @@ Gradebook
.. image:: https://raw.githubusercontent.com/overhangio/tutor-mfe/master/screenshots/gradebook.png
:alt: Gradebook MFE screenshot

This instructor-only MFE is for viewing individual and aggregated grade results for a course. To access this MFE, go to a course → Instructor tab → Student Admin → View gradebook. The URL should be: ``http(s)://{{ MFE_HOST }}/gradebook/{{ course ID }}``. When running locally, the gradebook of the demo course is available at: http://apps.local.overhang.io/gradebook/course-v1:edX+DemoX+Demo_Course
This instructor-only MFE is for viewing individual and aggregated grade results for a course. To access this MFE, go to a course → Instructor tab → Student Admin → View gradebook. The URL should be: ``http(s)://{{ MFE_HOST }}/gradebook/{{ course ID }}``. When running locally, the gradebook of the demo course is available at: http://apps.local.edly.io/gradebook/course-v1:edX+DemoX+Demo_Course

Learner Dashboard
~~~~~~~~~~~~~~~~~

.. image:: https://raw.githubusercontent.com/overhangio/tutor-mfe/master/screenshots/learner-dashboard.png
:alt: Learner Dashboard MFE screenshot

The Learner Dashboard MFE provides a clean and functional interface to allow learners to view all of their open enrollments, as well as take relevant actions on those enrollments.

Learning
~~~~~~~~
Expand All @@ -108,7 +117,7 @@ Profile
.. image:: https://raw.githubusercontent.com/overhangio/tutor-mfe/master/screenshots/profile.png
:alt: Profile MFE screenshot

Edit and display user-specific profile information. The profile page of every user is visible at ``http(s)://{{ MFE_HOST }}/profile/u/{{ username }}``. For instance, when running locally, the profile page of the "admin" user is: http://apps.local.overhang.io/profile/u/admin.
Edit and display user-specific profile information. The profile page of every user is visible at ``http(s)://{{ MFE_HOST }}/profile/u/{{ username }}``. For instance, when running locally, the profile page of the "admin" user is: http://apps.local.edly.io/profile/u/admin.


MFE management
Expand All @@ -129,14 +138,10 @@ Other MFE developers can take advantage of this plugin to deploy their own MFEs.
"repository": "https://github.com/myorg/mymfe",
"port": 2001,
"version": "me/my-custom-branch", # optional, will default to the Open edX current tag.
"refs": https://api.github.com/repos/myorg/mymfe/git/refs/heads", # optional
}
return mfes

The MFE assets will then be bundled in the "mfe" Docker image whenever it is rebuilt with ``tutor images build mfe``. Providing a ``refs`` URL will ensure the build cache for that MFE is invalidated whenever a change is detected upstream at the git version in question. You can use the `GitHub references API`_ or the `GitLab branches API`_ for this.

.. _GitHub references API: https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#get-a-reference
.. _GitLab branches API: https://docs.gitlab.com/ee/api/branches.html#get-single-repository-branch
The MFE assets will then be bundled in the "mfe" Docker image whenever it is rebuilt with ``tutor images build mfe``.

Assets will be served at ``http(s)://{{ MFE_HOST }}/mymfe``. Developers are free to add extra template patches to their plugins, as usual: for instance LMS setting patches to make sure that the LMS correctly connects to the MFEs.

Expand Down Expand Up @@ -314,7 +319,7 @@ Tutor makes it possible to run any MFE in development mode. For instance, to run

tutor dev start profile

Then, access http://apps.local.overhang.io:1995/profile/u/YOURUSERNAME
Then, access http://apps.local.edly.io:1995/profile/u/YOURUSERNAME

You can also bind-mount your own fork of an MFE. For example::

Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/20231208_132545_mpwheel_mfe_dev_ports.md

This file was deleted.

Binary file added screenshots/learner-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def load_about():
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.8",
install_requires=["tutor>=16.1.2,<17.0.0"],
extras_require={"dev": ["tutor[dev]>=16.1.2,<17.0.0"]},
install_requires=["tutor>=17.0.0,<18.0.0"],
extras_require={"dev": ["tutor[dev]>=17.0.0,<18.0.0"]},
entry_points={"tutor.plugin.v1": ["mfe = tutormfe.plugin"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion tutormfe/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "16.1.3"
__version__ = "17.0.0"
2 changes: 1 addition & 1 deletion tutormfe/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

from tutor.core.hooks import Filter

MFE_ATTRS_TYPE = t.Dict[t.Literal["repository", "refs", "port"], t.Union["str", int]]
MFE_ATTRS_TYPE = t.Dict[t.Literal["repository", "port", "version"], t.Union["str", int]]

MFE_APPS: Filter[dict[str, MFE_ATTRS_TYPE], []] = Filter()
2 changes: 1 addition & 1 deletion tutormfe/patches/openedx-cms-development-settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
COURSE_AUTHORING_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}/course-authoring"
CORS_ORIGIN_WHITELIST.append("http://{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}")
LOGIN_REDIRECT_WHITELIST.append("{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}")
CSRF_TRUSTED_ORIGINS.append("{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}")
CSRF_TRUSTED_ORIGINS.append("http://{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}")
2 changes: 1 addition & 1 deletion tutormfe/patches/openedx-cms-production-settings
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ COURSE_AUTHORING_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}htt

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 }}")
CSRF_TRUSTED_ORIGINS.append("{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}")
3 changes: 3 additions & 0 deletions tutormfe/patches/openedx-lms-common-settings
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ FEATURES['ENABLE_AUTHN_MICROFRONTEND'] = True
{% if get_mfe("communications") %}
FEATURES['ENABLE_NEW_BULK_EMAIL_EXPERIENCE'] = True
{% endif %}
{% if get_mfe("learner-dashboard") %}
LEARNER_HOME_MFE_REDIRECT_PERCENTAGE = 100
{% endif %}
9 changes: 7 additions & 2 deletions tutormfe/patches/openedx-lms-development-settings
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ MFE_CONFIG["DISABLE_ENTERPRISE_LOGIN"] = True
{% endif %}

{% if get_mfe("account") %}
ACCOUNT_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ get_mfe("account")["port"] }}/account"
ACCOUNT_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ get_mfe("account")["port"] }}/account/"
MFE_CONFIG["ACCOUNT_SETTINGS_URL"] = ACCOUNT_MICROFRONTEND_URL
{% endif %}

Expand All @@ -42,13 +42,18 @@ MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = True

{% if get_mfe("discussions") %}
DISCUSSIONS_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ get_mfe("discussions")["port"] }}/discussions"
MFE_CONFIG["DISCUSSIONS_MFE_BASE_URL"] = DISCUSSIONS_MICROFRONTEND_URL
DISCUSSIONS_MFE_FEEDBACK_URL = None
{% endif %}

{% if get_mfe("gradebook") %}
WRITABLE_GRADEBOOK_URL = "http://{{ MFE_HOST }}:{{ get_mfe("gradebook")["port"] }}/gradebook"
{% endif %}

{% if get_mfe("learner-dashboard") %}
LEARNER_HOME_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ get_mfe("learner-dashboard")["port"] }}/learner-dashboard/"
{% endif %}

{% if get_mfe("learning") %}
LEARNING_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ get_mfe("learning")["port"] }}/learning"
MFE_CONFIG["LEARNING_BASE_URL"] = "http://{{ MFE_HOST }}:{{ get_mfe("learning")["port"] }}"
Expand All @@ -73,7 +78,7 @@ MFE_CONFIG["SCHEDULE_EMAIL_SECTION"] = True
# {{ app_name }} MFE
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"] }}")
CSRF_TRUSTED_ORIGINS.append("http://{{ MFE_HOST }}:{{ app["port"] }}")
{% endfor %}

{{ patch("mfe-lms-common-settings") }}
Expand Down
9 changes: 7 additions & 2 deletions tutormfe/patches/openedx-lms-production-settings
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MFE_CONFIG["DISABLE_ENTERPRISE_LOGIN"] = True
{% endif %}

{% if get_mfe("account") %}
ACCOUNT_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/account"
ACCOUNT_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/account/"
MFE_CONFIG["ACCOUNT_SETTINGS_URL"] = ACCOUNT_MICROFRONTEND_URL
{% endif %}

Expand All @@ -43,13 +43,18 @@ MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = True

{% if get_mfe("discussions") %}
DISCUSSIONS_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/discussions"
MFE_CONFIG["DISCUSSIONS_MFE_BASE_URL"] = DISCUSSIONS_MICROFRONTEND_URL
DISCUSSIONS_MFE_FEEDBACK_URL = None
{% endif %}

{% if get_mfe("gradebook") %}
WRITABLE_GRADEBOOK_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/gradebook"
{% endif %}

{% if get_mfe("learner-dashboard") %}
LEARNER_HOME_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/learner-dashboard/"
{% endif %}

{% if get_mfe("learning") %}
LEARNING_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/learning"
MFE_CONFIG["LEARNING_BASE_URL"] = "{{ "https" if ENABLE_HTTPS else "http" }}://{{ MFE_HOST }}/learning"
Expand All @@ -71,7 +76,7 @@ MFE_CONFIG["SCHEDULE_EMAIL_SECTION"] = True

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 }}")
CSRF_TRUSTED_ORIGINS.append("{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}")

{{ patch("mfe-lms-common-settings") }}
{{ patch("mfe-lms-production-settings") }}
54 changes: 21 additions & 33 deletions tutormfe/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,65 +29,45 @@
},
}


def get_github_refs_path(name: str) -> str:
"""
Generate a URL to access refs in heads (nightly) or tags (stable) via Github API.
Args:
name (str): Consisted of the repository owner and the repository name, as a string in 'owner/repo' format.

Returns:
str: A string URL to the Github API, pointing to heads if version_suffix is set, tags otherwise.

"""

return f"https://api.github.com/repos/{name}/git/refs/{'heads' if __version_suffix__ else 'tags'}"


CORE_MFE_APPS: dict[str, MFE_ATTRS_TYPE] = {
"authn": {
"repository": "https://github.com/openedx/frontend-app-authn",
"refs": get_github_refs_path("openedx/frontend-app-authn"),
"repository": "https://github.com/openedx/frontend-app-authn.git",
"port": 1999,
},
"account": {
"repository": "https://github.com/openedx/frontend-app-account",
"refs": get_github_refs_path("openedx/frontend-app-account"),
"repository": "https://github.com/openedx/frontend-app-account.git",
"port": 1997,
},
"communications": {
"repository": "https://github.com/openedx/frontend-app-communications",
"refs": get_github_refs_path("openedx/frontend-app-communications"),
"repository": "https://github.com/openedx/frontend-app-communications.git",
"port": 1984,
},
"course-authoring": {
"repository": "https://github.com/openedx/frontend-app-course-authoring",
"refs": get_github_refs_path("openedx/frontend-app-course-authoring"),
"repository": "https://github.com/openedx/frontend-app-course-authoring.git",
"port": 2001,
},
"discussions": {
"repository": "https://github.com/openedx/frontend-app-discussions",
"refs": get_github_refs_path("openedx/frontend-app-discussions"),
"repository": "https://github.com/openedx/frontend-app-discussions.git",
"port": 2002,
},
"gradebook": {
"repository": "https://github.com/openedx/frontend-app-gradebook",
"refs": get_github_refs_path("openedx/frontend-app-gradebook"),
"repository": "https://github.com/openedx/frontend-app-gradebook.git",
"port": 1994,
},
"learner-dashboard": {
"repository": "https://github.com/openedx/frontend-app-learner-dashboard.git",
"port": 1996,
},
"learning": {
"repository": "https://github.com/openedx/frontend-app-learning",
"refs": get_github_refs_path("openedx/frontend-app-learning"),
"repository": "https://github.com/openedx/frontend-app-learning.git",
"port": 2000,
},
"ora-grading": {
"repository": "https://github.com/openedx/frontend-app-ora-grading",
"refs": get_github_refs_path("openedx/frontend-app-ora-grading"),
"repository": "https://github.com/openedx/frontend-app-ora-grading.git",
"port": 1993,
},
"profile": {
"repository": "https://github.com/openedx/frontend-app-profile",
"refs": get_github_refs_path("openedx/frontend-app-profile"),
"repository": "https://github.com/openedx/frontend-app-profile.git",
"port": 1995,
},
}
Expand All @@ -109,6 +89,14 @@ def get_mfes() -> dict[str, MFE_ATTRS_TYPE]:
return MFE_APPS.apply({})


@tutor_hooks.Actions.PLUGIN_LOADED.add()
def _clear_get_mfes_cache(_name: str) -> None:
"""
Don't forget to clear cache, or we'll have some strange surprises...
"""
get_mfes.cache_clear()


def iter_mfes() -> t.Iterable[tuple[str, MFE_ATTRS_TYPE]]:
"""
Yield:
Expand Down
19 changes: 12 additions & 7 deletions tutormfe/templates/mfe/build/mfe/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# syntax=docker/dockerfile:1
# https://hub.docker.com/_/node/tags
FROM docker.io/node:18.16.0-bullseye-slim AS base
FROM docker.io/node:18.19.0-bullseye-slim AS base

RUN apt update \
&& apt install -y git \
Expand All @@ -17,7 +18,7 @@ RUN apt update \

RUN mkdir -p /openedx/app /openedx/env
WORKDIR /openedx/app
ENV PATH ./node_modules/.bin:${PATH}
ENV PATH /openedx/app/node_modules/.bin:${PATH}

######## i18n strings
FROM base AS i18n
Expand All @@ -34,10 +35,7 @@ RUN echo "copying i18n data" \
######## {{ app_name }} (git)
FROM base AS {{ app_name }}-git
{#- Invalidate the build cache if a change is detected upstream #}
{%- if app.get("refs") %}
ADD {{ app["refs"] }}/{{ app.get("version", MFE_COMMON_VERSION) }} /tmp/gitref-{{ app_name }}
{%- endif %}
RUN git clone {{ app["repository"] }} --branch {{ app.get("version", MFE_COMMON_VERSION) }} --depth 1 .
ADD --keep-git-dir=true {{ app["repository"] }}#{{ app.get("version", MFE_COMMON_VERSION) }} .

######## {{ app_name }} (src)
# Empty layer with just the repo at the root, for build-time bind-mounts
Expand All @@ -63,11 +61,18 @@ ARG NPM_REGISTRY={{ NPM_REGISTRY }}
ENV CPPFLAGS=-DPNG_ARM_NEON_OPT=0
{#- We define this environment variable to bypass an issue with the installation of pact https://github.com/pact-foundation/pact-js-core/issues/264 #}
ENV PACT_SKIP_BINARY_INSTALL=true
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/root/.npm,sharing=shared {% endif %}npm clean-install --no-audit --no-fund --registry=$NPM_REGISTRY
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm clean-install --no-audit --no-fund --registry=$NPM_REGISTRY
{{ patch("mfe-dockerfile-post-npm-install") }}
{{ patch("mfe-dockerfile-post-npm-install-{}".format(app_name)) }}
COPY --from={{ app_name }}-src / /openedx/app
COPY --from={{ app_name }}-i18n /openedx/app/src/i18n/messages /openedx/app/src/i18n/messages

# Whenever a new MFE supports Atlas, it should be added to this list.
# When all MFEs support Atlas, this if-statement should be removed.
{% if app_name in ["communications"] %}
RUN make OPENEDX_ATLAS_PULL=true pull_translations
{% endif %}

EXPOSE {{ app['port'] }}

# Configuration needed at build time
Expand Down
8 changes: 8 additions & 0 deletions tutormfe/templates/mfe/tasks/lms/init
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ site-configuration unset --domain={{ LMS_HOST }}:8000 ENABLE_PROFILE_MICROFRONTE
./manage.py lms waffle_delete --flags learner_profile.redirect_to_microfrontend
{% endif %}

{% if is_mfe_enabled("learner-dashboard") %}
(./manage.py lms waffle_flag --list | grep learner_home_mfe.enabled) || ./manage.py lms waffle_flag learner_home_mfe.enabled --create --everyone
{% else %}
./manage.py lms waffle_delete --flags learner_home_mfe.enabled
{% endif %}

{% if is_mfe_enabled("learning") %}
(./manage.py lms waffle_flag --list | grep course_home.course_home_mfe_progress_tab) || ./manage.py lms waffle_flag --create --everyone course_home.course_home_mfe_progress_tab
{% else %}
Expand All @@ -40,12 +46,14 @@ site-configuration unset --domain={{ LMS_HOST }}:8000 ENABLE_PROFILE_MICROFRONTE
(./manage.py lms waffle_flag --list | grep discussions.enable_moderation_reason_codes ) || ./manage.py lms waffle_flag --create --everyone discussions.enable_moderation_reason_codes
(./manage.py lms waffle_flag --list | grep discussions.enable_reported_content_email_notifications ) || ./manage.py lms waffle_flag --create --everyone discussions.enable_reported_content_email_notifications
(./manage.py lms waffle_flag --list | grep discussions.enable_learners_stats ) || ./manage.py lms waffle_flag --create --everyone discussions.enable_learners_stats
(./manage.py lms waffle_flag --list | grep discussions.enable_new_structure_discussions ) || ./manage.py lms waffle_flag --create --everyone discussions.enable_new_structure_discussions
{% else %}
./manage.py lms waffle_delete --flags discussions.enable_discussions_mfe
./manage.py lms waffle_delete --flags discussions.enable_learners_tab_in_discussions_mfe
./manage.py lms waffle_delete --flags discussions.enable_moderation_reason_codes
./manage.py lms waffle_delete --flags discussions.enable_reported_content_email_notifications
./manage.py lms waffle_delete --flags discussions.enable_learners_stats
./manage.py lms waffle_delete --flags discussions.enable_new_structure_discussions
{% endif %}

{% if is_mfe_enabled("ora-grading") %}
Expand Down
Loading