Skip to content

Support npm start on host for MFE development #25

@kdmccormick

Description

@kdmccormick

Background

There are ~9 MFEs enabled by default in tutor-mfe now, and that number grows every release. In prod, all MFEs share one container, so it's not problem. In dev, though, we spin up one container per MFE. This consumes an absurd number of resources, and probably isn't necessary since MFEs seem to run fine on everyone's maching with a simple npm clean-install && npm start.

Here's a good illustration of the problem:
https://discuss.openedx.org/t/after-installing-a-tutor-nightly-system-is-working-slow-which-container-can-i-stop-temporary/10681

In addition to resource consumption, making changes to MFE code in Docker containers through bind-mounts is unnecessarily complex. It'd be better if developers could just edit MFE code on their host and see the changes manifest immediately.

Tasks

Prototype an overhaul of tutor-mfe's dev mode that solves this problem, something along the lines of:

  • One central Docker container serving all MFEs, similar to prod.
  • When a dev wants to work on an MFE, they clone it, run "some command", and run npm start. Tutor should allow them to see the MFE that they npm started rather than the MFE pre-build MFE from the Docker container. The rest of the MFEs should continue to be served from the Docker container.
  • We're not sure what "some command" would be, but ideally, it would do something to "switch" Tutor over to the host instance of the MFE instead of the container instance of the MFE.
  • There should be an inverse to "some command" which switches Tutor back to using the pre-built container MFE.

Rationale

  • On one hand, all MFEs should run bundled together by default, so that the Tutor Dev offering works out-of-the-box without consuming too many resources.
  • On the other hand, it should be easy to edit an MFE's code locally, so devs can quickly fix bugs and iterate on features.

Goals:

Notes

Read @brian-smith-tcril 's comment here: openedx-unsupported/wg-developer-experience#154 (comment)

Metadata

Metadata

Assignees

Labels

enhancementRelates to new features or improvements to existing featurestutorRequires a change to Tutor

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions