-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In development, the tutor-mfe plugin runs a separate container for every MFE. This runs `npm run start` for each of the 9 MFEs, which causes the developer laptops to crash and ice caps to melt. Here, we adopt a different solution. By default, all MFEs run in a single container, which is the same as the production container (with caddy). Only the Caddyfile is different. This effectively resolves the performance issue. But to allow developers to hack on invidual MFEs, we also need to run some of them in development mode, with `npm run start`. To do that, we run separately only those MFEs for which the developer has a bind-mounted directory that corresponds to the MFE repository. This allows developers to keep working on MFEs with the help of `tutor mounts ...` command.
- Loading branch information
Showing
5 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- [Improvement] Fix very high CPU and memory usage in development. We resolve this issue by running just a single container for all MFES, just like in production. To al;low developers to test their changes in Tutor, we run `npm run start` only for those MFEs that have a manual bind-mount that was created with `tutor mounts add .../frontend-app-mymfe`. (by @regisb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
# MFE apps | ||
{% for app_name, app in iter_mfes() %} | ||
{{ app_name }}: | ||
mfe: | ||
ports: | ||
{%- for app_name, app in iter_mfes() %} | ||
{%- if not iter_mounts(MOUNTS, app_name)|list %} | ||
- {{ app["port"] }}:8002 # {{ app_name }} | ||
{%- endif %} | ||
{%- endfor %} | ||
|
||
{%- for app_name, app in iter_mfes() %} | ||
{%- set mounts = iter_mounts(MOUNTS, app_name)|list %} | ||
{%- if mounts %} | ||
{{ app_name }}: # Work on this MFE for development | ||
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) %} | ||
{%- for mount in mounts %} | ||
- {{ mount }} | ||
{%- endfor %} | ||
restart: unless-stopped | ||
depends_on: | ||
- lms | ||
{% endfor %} | ||
{%- endif %} | ||
{%- endfor %} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters