-
Notifications
You must be signed in to change notification settings - Fork 10
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
Make it possible to change configuration variables at runtime #536
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #536 +/- ##
==========================================
- Coverage 57.55% 57.30% -0.25%
==========================================
Files 86 86
Lines 3652 3687 +35
Branches 816 836 +20
==========================================
+ Hits 2102 2113 +11
- Misses 1541 1565 +24
Partials 9 9 ☔ View full report in Codecov by Sentry. |
An attempt to summarize an offline discussion:This doesn't seem to translate into an actual runtime configuration file. The values of What we want is an actual separate file with only configuration variables, which is loaded from the web server as the React application starts. This file should be editable during runtime, using any editor, like e.g. vim, and the changes should take effect merely by hard-reloading the application in your browser. When deployed as a container, said configuration file should be generated from the container's environment variables as the container starts. An example of a current production-oriented deployment can be found in https://github.com/Uninett/argus-docker/blob/master/frontend/Dockerfile . This is a two-stage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested this with argus-docker, and in our PaaS environment by updating the K8s deployment definitions for a review site, and things seem to be working smoothly - and everything has fewer deploy steps now that the same docker image can be used for all deployments.
Updating docs and ensuring there is good error feedback if the runtime-config is missing or broken is all that is left to do, IMO.
I've added Uninett/argus-docker#3 to track this when it hits a new release (presumably as 1.13.0) |
This updates the docker production image to be a fully operational nginx server which serves the statically built Argus front-end. Now that runtime configuration is supported, the updated image will produce a runtime config file from the same environment variables that were originally expected by the frontend build process, and ensure it's in the correct location before starting nginx.
For handling of fixed values, required and optional values and easy stripping of unknown config values provided by users
in DEV env: config file can still be added to overwrite defaults but is not required anymore
It is no longer required in dev
cbee817
to
00c44ea
Compare
The image runtime has significantly changed, simplifying deployment.
Co-authored-by: Morten Brekkevold <morten.brekkevold@sikt.no>
5925579
to
cada1ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we're there now! Time for a 1.13 release, @hmpf! :)
Fixes #456?
The implementation here is heavily inspired by the global config option described here https://profinit.eu/en/blog/build-once-deploy-many-in-react-dynamic-configuration-properties/
Implemented changes:
runtime-config.json
fileExpected behaviour:
/public/runtime-config.json
is added. Updating/public/runtime-config.json
at runtime will immediately trigger changes to the application when running the application in dev viadocker-compose up
.%FRONTEND_BASE_URL%/runtime-config.json
file must be served or else the app will not run.Following is to be expected when
runtime-config.json
is provided:backendUrl
andcookieDomain
are required, otherwise the app will fail.frontendVersion
orapiVersion
values are provided, they are silently ignored.Further work: