Ref. [Open edX discussions] [Working Groups/Build-Test-Release] Deploying microfrontends (MFEs) in a single container

“”"

I now see with despair every Tutor update invoking “npm install” umpteen times.

Hmmmm this should not be the case. MFE need to be rebuilt (with npm run build) every time their configuration changes, by definition, but rebuilding should not trigger calls to npm install. Can you give more details on what exactly is going on? Maybe in a separate topic on the Tutor forums: https://discuss.overhang.io/
“”"

I’m not a great Docker specialist, but from line 25 in tutor-mfe/Dockerfile at master · overhangio/tutor-mfe · GitHub it’s clear, that after “tutor local quickstart” (for example to update to a new version of Tutor), for each MFE all the corresponding node_modules are being pulled from the registry.

We have now I think 4 or so MFE, but in the future with many more MFE, this build process will take forever.

There seems not te be a good solution for this, maybe some form of only rebuilding MFE’s that have changed, and not all of them?

@insad I’m not sure I understand the problem you are describing.

When you run tutor local quickstart, your mfe image(s) are rebuilt even if there are no changes?

The current behaviour I see when I run tutor local quickstart is that yes there is an attempt to build the images but the caching works when there are no changes. So there is no time being spent on building the image(s).

=> CACHED [gradebook-dev 1/2] RUN git clone https://github.com/Dicey-tech/frontend-app-gradebook --branch koa-deploy --depth 1 .                                                                           0.0s
 => CACHED [gradebook-dev 2/2] RUN npm install --verbose --registry=https://registry.npmjs.org/                                                                                                             0.0s
 => CACHED [gradebook 1/2] COPY ./env/production /openedx/env/production                                                                                                                                    0.0s
 => CACHED [gradebook 2/2] RUN sh -c "set -a && source /openedx/env/production && npm run build"                                                                                                            0.0s
 => CACHED [stage-21  6/13] COPY --from=gradebook /openedx/app/dist /openedx/dist/gradebook

At this moment, I’m running the installer (v.12.1.3) and watching carefully the output.

I see over and over again the npm install command, can’t determine if the packages come from cache or are pulled from the registry, most take some hundred ms, others around a second, not unlike when do a npm install for my own projects.

What I do see however - and it takes many seconds to complete - is over and over again for cwebp-bin, gifsicle, mozjpeg and optipng-bin, that they are being compiled from source (node lib/install.js - compiling from source).

Another line where over and over the process stalls during many seconds is:

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db