Hello, everyone!
I’m excited to share some recent POC that I’ve been working on to enhance our OpenEdX deployment tool, Tutor. We’ve recognized the need to optimize the build time and stability of Micro-Frontend (MFE) applications, which has led me to develop a simple Tutor plugin to bring a local npm registry to the MFE’s build step.
Key Benefits:
- Faster Build Times: By hosting our npm packages locally, w reduce the dependency resolution time during MFE builds.
- Increased Stability: A local npm registry mitigates issues related to external npm outages or network problems, ensuring a more reliable build process.
I’ve chosen Verdaccio as the local NPM registry for our proof of concept. The plugin implements the following features:
- A local Docker Compose service with a volume for local npm caching: reference
- A default NPM_REGISTRY URL: reference
- Verdaccio Docker image declaration: reference
The outcomes of my local testing are as follows:
tutor images build mfe --no-cache
<verdaccio is filled by a cache>
<max 2 parallel processes>
took 12m 15s
tutor images build mfe --no-cache
<verdaccio is NOT filled by a cache>
<max 2 parallel processes>
took 13m 39s
tutor images build mfe --no-cache
<verdaccio is filled by a cache>
<no max parallel processes - use default docker context>
took 27m 17s
tutor images build mfe --no-cache
<verdaccio is disabled>
<max 2 parallel processes>
took 13m 32s
tutor images build mfe --no-cache
<verdaccio is disabled>
<no max parallel processes - use default docker context>
Build failed: getaddrinfo ENOTFOUND registry.npmjs.org
took 2m 44s
It seems that NOT having restrictions significantly degrades the performance of parallel builds. I’ll investigate it.
There are a couple of possible ways to use the proposed idea with Tutor:
- Move the plugin logic directly to the Tutor MFE plugin.
- Incorporate the idea into the Tutor core to be used by all services, not only by the MFE.
- Implement the idea without the need to add the local registry to the Docker Compose declaration (I’m not yet sure how this can be implemented).
P.S. The plugin is ready for use in building the openedx
image, as the NPM_REGISTRY
variable is utilized in the openedx
Dockerfile.
I encourage everyone to check out the work, provide feedback, and discuss how this can be further refined and utilized in your projects.
For a deeper dive into the implementation and to get involved with testing or enhancements, please visit the following link: Verdaccio Tutor plugin
@kmccormick @regis @MoisesGonzalezS FYI
Looking forward to your thoughts and feedback!