Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
feat: mount local frontend libs into frontend containers
Browse files Browse the repository at this point in the history
Should allow installation of local versions of NPM
packages via module.config.js, allowing frontend devs
to test out frontend library changes within devstack.
  • Loading branch information
kdmccormick committed Jul 27, 2021
1 parent ca727ba commit 7f981f6
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docker-compose-host-nfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,51 @@ services:
volumes:
- ${DEVSTACK_WORKSPACE}/registrar:/edx/app/registrar/registrar
frontend-app-course-authoring:
extends:
file: microfrontend.yml
service: microfrontend-with-nfs-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-course-authoring:/edx/app/frontend-app-course-authoring:cached
- frontend_app_course_authoring_node_modules:/edx/app/frontend-app-course-authoring/node_modules
frontend-app-gradebook:
extends:
file: microfrontend.yml
service: microfrontend-with-nfs-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-gradebook:/edx/app/frontend-app-gradebook:cached
- frontend_app_gradebook_node_modules:/edx/app/frontend-app-gradebook/node_modules
frontend-app-learning:
extends:
file: microfrontend.yml
service: microfrontend-with-nfs-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-learning:/edx/app/frontend-app-learning:cached
- frontend_app_learning_node_modules:/edx/app/frontend-app-learning/node_modules
frontend-app-library-authoring:
extends:
file: microfrontend.yml
service: microfrontend-with-nfs-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-library-authoring:/edx/app/frontend-app-library-authoring:cached
- frontend_app_library_authoring_node_modules:/edx/app/frontend-app-library-authoring/node_modules
frontend-app-payment:
extends:
file: microfrontend.yml
service: microfrontend-with-nfs-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-payment:/edx/app/frontend-app-payment:cached
- frontend_app_payment_node_modules:/edx/app/frontend-app-payment/node_modules
frontend-app-program-console:
extends:
file: microfrontend.yml
service: microfrontend-with-nfs-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-program-console:/edx/app/frontend-app-program-console:cached
- frontend_app_program_console_node_modules:/edx/app/frontend-app-program-console/node_modules
frontend-app-publisher:
extends:
file: microfrontend.yml
service: microfrontend-with-nfs-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-publisher:/edx/app/frontend-app-publisher:cached
- frontend_app_publisher_node_modules:/edx/app/frontend-app-publisher/node_modules
Expand Down
21 changes: 21 additions & 0 deletions docker-compose-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,51 @@ services:
- edxapp_uploads:/edx/var/edxapp/uploads
- ${DEVSTACK_WORKSPACE}/src:/edx/src:cached
frontend-app-course-authoring:
extends:
file: microfrontend.yml
service: microfrontend-with-host-mounted-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-course-authoring:/edx/app/frontend-app-course-authoring:cached
- frontend_app_course_authoring_node_modules:/edx/app/frontend-app-course-authoring/node_modules
frontend-app-gradebook:
extends:
file: microfrontend.yml
service: microfrontend-with-host-mounted-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-gradebook:/edx/app/frontend-app-gradebook:cached
- frontend_app_gradebook_node_modules:/edx/app/frontend-app-gradebook/node_modules
frontend-app-learning:
extends:
file: microfrontend.yml
service: microfrontend-with-host-mounted-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-learning:/edx/app/frontend-app-learning:cached
- frontend_app_learning_node_modules:/edx/app/frontend-app-learning/node_modules
frontend-app-library-authoring:
extends:
file: microfrontend.yml
service: microfrontend-with-host-mounted-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-library-authoring:/edx/app/frontend-app-library-authoring:cached
- frontend_app_library_authoring_node_modules:/edx/app/frontend-app-library-authoring/node_modules
frontend-app-payment:
extends:
file: microfrontend.yml
service: microfrontend-with-host-mounted-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-payment:/edx/app/frontend-app-payment:cached
- frontend_app_payment_node_modules:/edx/app/frontend-app-payment/node_modules
frontend-app-program-console:
extends:
file: microfrontend.yml
service: microfrontend-with-host-mounted-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-program-console:/edx/app/frontend-app-program-console:cached
- frontend_app_program_console_node_modules:/edx/app/frontend-app-program-console/node_modules
frontend-app-publisher:
extends:
file: microfrontend.yml
service: microfrontend-with-host-mounted-libs
volumes:
- ${DEVSTACK_WORKSPACE}/frontend-app-publisher:/edx/app/frontend-app-publisher:cached
- frontend_app_publisher_node_modules:/edx/app/frontend-app-publisher/node_modules
Expand Down
61 changes: 60 additions & 1 deletion microfrontend.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,71 @@
# This file contains configuration common too all microfrontends
# This file contains configuration common to all microfrontends.

version: "2.1"

services:

# Micro-frontend service template that mounts a list of frontend libraries
# from the host, if they exist.
microfrontend-with-host-mounted-libs:
extends:
file: microfrontend.yml
service: microfrontend
# This list should be kept synced with `microfrontend-with-nfs-libs`.
volumes:
- ${DEVSTACK_WORKSPACE}/brand-edx.org:/edx/app/brand-edx.org:cached
- ${DEVSTACK_WORKSPACE}/brand-openedx:/edx/app/brand-openedx:cached
- ${DEVSTACK_WORKSPACE}/frontend-platform:/edx/app/frontend-platform:cached
- ${DEVSTACK_WORKSPACE}/paragon:/edx/app/paragon:cached

# Micro-frontend service template that uses NFS to mount frontend libraries,
# if they exist.
microfrontend-with-nfs-libs:
extends:
file: microfrontend.yml
service: microfrontend
# This list should be kept synced with `microfrontend-with-host-mounted-libs`.
# The NFS volumes here need to be defined in the `volumes` section of the file.
volumes:
- brand-edxorg-nfs:/edx/app/brand-edx.org:cached
- brand-openedx-nfs:/edx/app/brand-openedx:cached
- frontend-platform-nfs:/edx/app/frontend-platform:cached
- paragon-nfs:/edx/app/paragon:cached

# Base micro-frontend service template.
# Defines the underlying image and command to install+run frontend.
# Does not mount any host folders.
microfrontend:
command: bash -c 'npm install; while true; do npm start; sleep 2; done'
stdin_open: true
tty: true
image: node:12
environment:
- NODE_ENV=development

# NFS volumes to mount micro-frontend libraries.
# These have no effect for devstack users not using NFS.
volumes:
brand-edxorg-nfs:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: :${DEVSTACK_WORKSPACE}/brand-edx.org
brand-openedx-nfs:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: :${DEVSTACK_WORKSPACE}/brand-openedx
frontend-platform-nfs:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: :${DEVSTACK_WORKSPACE}/frontend-platform
paragon-nfs:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: :${DEVSTACK_WORKSPACE}/paragon

0 comments on commit 7f981f6

Please sign in to comment.