Skip to content

Commit

Permalink
feat: add support to quince (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrrypg authored Jun 3, 2024
1 parent 5b7eb9d commit 6811d69
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 85 deletions.
35 changes: 9 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ for MFEs.

| Open edX release | Tutor version | Tutor MFE Version | Plugin release |
|------------------|-------------------|--------------------------------------|----------------|
| Nutmeg | `>=14.0, <15` | `edunext/[email protected]` | 14.x.x |
| Olive | `>=15.0, <16` | `edunext/[email protected]` | 15.x.x |
| Palm | `>=16.0, <17` | `edunext/[email protected]` | 16.x.x |
| Nutmeg | `>=14.0, <15` | `edunext/[email protected]` | 14.x.x |
| Olive | `>=15.0, <16` | `edunext/[email protected]` | 15.x.x |
| Palm | `>=16.0, <17` | `edunext/[email protected]` | 16.x.x |
| Quince | `>=17.0, <18` | `openedx/[email protected]` | 17.x.x |

## Installation

Expand All @@ -37,26 +38,10 @@ bundles of each MFE and simply serve a small index.html file through caddy.

We use webpack's
[`output.publicPath`](https://webpack.js.org/configuration/output/#outputpublicpath)
to accomplish this. Due to current limitations in the building scripts
we need to use custom versions of `frontend-platform` that include a backport of
[`openedx/frontend-platform#568`](https://github.com/openedx/frontend-platform/pull/568)
for releases previous to Quince.

The following is a list of supported MFEs for the current plugin version, each MFE is a
custom fork hosted by eduNEXT. You might use your own fork, but you must include the backport
mentioned before.

- Learning: [`eduNEXT/frontend-app-learning@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-learning/tree/ednx-release/palma.master)
- Profile: [`eduNEXT/frontend-app-profile@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-profile/tree/ednx-release/palma.master)
- Authn: [`eduNEXT/frontend-app-authn@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-authn/tree/ednx-release/palma.master)
- Account: [`eduNEXT/frontend-app-account@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-account/tree/ednx-release/palma.master)
- Discussions: [`eduNEXT/frontend-app-discussions@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-discussions/tree/ednx-release/palma.master)
- Gradebook: [`eduNEXT/frontend-app-gradebook@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-gradebook/tree/ednx-release/palma.master)
- Ora Grading: [`eduNEXT/frontend-app-ora-grading@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-ora-grading/tree/ednx-release/palma.master)
- Communications: [`eduNEXT/frontend-app-communications@ednx-release/palma.master`](https://github.com/eduNEXT/frontend-app-communications/tree/ednx-release/palma.master)

In addition, we need to use a custom version of `tutor-mfe` that includes the patch
`mfe-dockerfile-production-final` introduced in [`overhangio/tutor-mfe#179`](https://github.com/overhangio/tutor-mfe/pull/179).
to accomplish this. An important fix to make use of this was merged in fronted-platform
[v5.5.1](https://github.com/openedx/frontend-platform/releases/tag/v5.5.1), so
it's a prerequisite that your MFEs come with this version installed. This is the
case for all the MFEs supported by default by Tutor from Quince on-wards.

### Building Caveats

Expand All @@ -65,9 +50,7 @@ the MFE docker image if we set it's value to a specific CDN endpoint.
To avoid this limitation we use a script
[`docker-entrypoint.sh`](tutormfe_extensions/templates/mfe/build/mfe/docker-entrypoint.sh)
to dinamically change a placeholder value used in `publicPath` each time the container is
started. The plugin relies on a few Tutor patches that aren't available in Tutor v15 to do this,
for that reason make sure you use the version specified in the Installation section.

started.

Once you enable the plugin you can build an image with a _"dynamic"_ `publicPath`.
By default the placeholder will be replaced by an empty string, which was the original value.
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def load_about():
long_description=load_readme(),
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.7",
install_requires=["tutor"],
python_requires=">=3.8",
install_requires=["tutor>=17.0.2", "tutor-mfe>=17.0.1"],
entry_points={
"tutor.plugin.v1": [
"mfe_extensions = tutormfe_extensions.plugin"
Expand All @@ -51,9 +51,10 @@ def load_about():
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)
2 changes: 1 addition & 1 deletion tutormfe_extensions/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "16.0.0"
__version__ = "17.0.0"
63 changes: 8 additions & 55 deletions tutormfe_extensions/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from glob import glob

import click
import pkg_resources
import importlib_resources
from tutor import config as tutor_config
from tutor import hooks
from tutormfe.hooks import MFE_APPS
Expand All @@ -17,56 +17,8 @@
# CONFIGURATION
########################################

CORE_MFES_CONFIG = {
"MFE_LEARNING_MFE_APP": {
"name": "learning",
"repository": "https://github.com/eduNEXT/frontend-app-learning",
"port": 2000,
"version": "ednx-release/palma.master",
},
"MFE_ACCOUNT_MFE_APP": {
"name": "account",
"repository": "https://github.com/eduNEXT/frontend-app-account",
"port": 1997,
"version": "ednx-release/palma.master",
},
"MFE_AUTHN_MFE_APP": {
"name": "authn",
"repository": "https://github.com/eduNEXT/frontend-app-authn",
"port": 1999,
"version": "ednx-release/palma.master",
},
"MFE_DISCUSSIONS_MFE_APP": {
"name": "discussions",
"repository": "https://github.com/eduNEXT/frontend-app-discussions",
"port": 2002,
"version": "ednx-release/palma.master",
},
"MFE_GRADEBOOK_MFE_APP": {
"name": "gradebook",
"repository": "https://github.com/eduNEXT/frontend-app-gradebook",
"port": 1994,
"version": "ednx-release/palma.master",
},
"MFE_PROFILE_MFE_APP": {
"name": "profile",
"repository": "https://github.com/eduNEXT/frontend-app-profile",
"port": 1995,
"version": "ednx-release/palma.master",
},
"MFE_ORA_GRADING_MFE_APP": {
"name": "ora-grading",
"repository": "https://github.com/eduNEXT/frontend-app-ora-grading",
"port": 2003,
"version": "ednx-release/palma.master",
},
"MFE_COMMUNICATIONS_MFE_APP": {
"name": "communications",
"repository": "https://github.com/eduNEXT/frontend-app-communications",
"port": 2004,
"version": "ednx-release/palma.master",
}
}
CORE_MFES_CONFIG = {}


def validate_mfe_config(mfe_setting_name: str):
if mfe_setting_name.startswith("MFE_") and mfe_setting_name.endswith("_MFE_APP"):
Expand Down Expand Up @@ -153,8 +105,9 @@ def _manage_mfes_from_config(mfe_list):
# and add it to the CLI_DO_INIT_TASKS filter, which tells Tutor to
# run it as part of the `init` job.
for service, template_path in MY_INIT_TASKS:
full_path: str = pkg_resources.resource_filename(
"tutormfe_extensions", os.path.join("templates", *template_path)
full_path: str = str(
importlib_resources.files("tutormfe_extensions")
/ os.path.join("templates", *template_path)
)
with open(full_path, encoding="utf-8") as init_task_file:
init_task: str = init_task_file.read()
Expand Down Expand Up @@ -221,7 +174,7 @@ def _manage_mfes_from_config(mfe_list):
hooks.Filters.ENV_TEMPLATE_ROOTS.add_items(
# Root paths for template files, relative to the project root.
[
pkg_resources.resource_filename("tutormfe_extensions", "templates"),
str(importlib_resources.files("tutormfe_extensions") / "templates"),
]
)

Expand Down Expand Up @@ -249,7 +202,7 @@ def _manage_mfes_from_config(mfe_list):
# apply a patch based on the file's name and contents.
for path in glob(
os.path.join(
pkg_resources.resource_filename("tutormfe_extensions", "patches"),
str(importlib_resources.files("tutormfe_extensions") / "patches"),
"*",
)
):
Expand Down

0 comments on commit 6811d69

Please sign in to comment.