Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build an image that uses runtime configuration #1

Closed
wants to merge 2 commits into from

Conversation

kdmccormick
Copy link
Owner

@kdmccormick kdmccormick commented Aug 4, 2022

Update: work is continued over here: overhangio#69

Description

  • Add MFE_ENABLE_CONFIG_API as a boolean plugin setting.
  • Add MFE_ENV_COMMON as a plugin setting.
    • This setting represents the config values that are shared across MFEs.
    • It contains "production" and "development" dictionaries.
    • The default values were taken directly from env/production and env/development.
    • Individual config values can still be overriden per-MFE by setting
      MFE_<APPNAME>_MFE_APP["env"].
  • When MFE_ENABLE_CONFIG_API==True, use the new run-time config system:
    • In env/production and env/development, only render MFE_CONFIG_API_URL.
      • For production, set the MFE_CONFIG_API_URL=https://<mfe_hostname>/api/mfe_config/v1. Then, configure Caddy to forward this request to LMS. We must do this because the MFE does not know the LMS's base URL before it gets a response from the MFE Config API (thanks @ghassanmas for the idea).
      • For development, set MFE_CONFIG_API_URL=http://local.overhang.io:8000/api/mfe_config/v1. This is based on the assumption that LMS is always at local.overhang.io:8000 when using dev mode.
    • For each MFE, set the correct APP_ID in:
      • env/production.override, for production
      • dev/docker-compose.yml as an environment variable, for development
    • In the LMS's common.py settings file, render the contents of MFE_ENV_COMMON and MFE_<APPNAME>_MFE["env"] for the MFE Config API to serve.
  • When MFE_ENABLE_CONFIG_API==False, use build-time config, just as tutor-mfe did before:
    • Render the contents of MFE_ENV_COMMON directly into env/production and env/development
    • Render the contents of MFE_<APPNAME>_MFE["env"] into:
      • env/production.override for production
      • dev/docker-compose.yml as environment variables, for development

To do

  • Address "TODO" comments.
  • Document newMFE_ENV_COMMON and MFE_ENABLE_CONFIG_API settings in the README.
  • Test this thoroughly in dev, local, and k8s mode.
  • Close this PR and re-open it against overhangio/tutor-mfe with a better commit message.
  • Making the image automatically build and push to docker.io/overhangio/tutor-mfe

Links

@kdmccormick kdmccormick force-pushed the kdmccormick/mfe-runtime-config branch from debb806 to 84ac352 Compare August 4, 2022 18:24
@kdmccormick kdmccormick changed the base branch from master to nightly August 4, 2022 18:24
@kdmccormick kdmccormick changed the base branch from nightly to master August 4, 2022 18:25
@kdmccormick kdmccormick changed the base branch from master to nightly August 4, 2022 18:25
@kdmccormick kdmccormick force-pushed the kdmccormick/mfe-runtime-config branch 5 times, most recently from 345d68d to 6353a97 Compare August 5, 2022 20:11
@kdmccormick kdmccormick force-pushed the kdmccormick/mfe-runtime-config branch 8 times, most recently from 290e082 to 1c56c83 Compare August 23, 2022 19:06
@kdmccormick kdmccormick force-pushed the kdmccormick/mfe-runtime-config branch from 1c56c83 to 63c9c72 Compare August 24, 2022 18:32
@kdmccormick
Copy link
Owner Author

closed in favor of #2

@kdmccormick kdmccormick closed this Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create small MFE base image using runtime MFE config system
1 participant