Repository navigation
Overlay per-deployment config instead of editing the tracked copies - #16
Merged
Merged
Conversation
Both MCRIT containers mounted the tracked config/ read-only over the installed package's mcrit/config/, so the only way to set a deployment's own values - an AUTH_TOKEN, an external MongoDB - was to edit files this repository tracks. Every pull then either conflicted with those edits or quietly reverted them, and config/ stopped being a reviewable default. The containers now assemble their configuration instead of mounting it: config/ is mounted at /opt/mcrit/config.default and the untracked config.local/ at /opt/mcrit/config.local, and entry_common.sh, sourced by all three entry scripts, copies the defaults into the package's config directory and then copies the overlay on top. A file in config.local/ replaces the shipped module of the same name, so it is copied whole rather than merged; .gitignore keeps everything there out of commits except the README explaining it. The development compose file keeps the old read-only mount, because /opt/mcrit is a host checkout there and assembling would write into the developer's tree. Assembling makes a second problem visible: an MCRIT upgrade can define settings that config/ has not caught up with, and the assembled module then silently lacks them. The image keeps the stock configuration at /opt/config.stock, and the startup check compares the module-level and class-level upper-case names of each stock module against the assembled one, printing a warning per module that has fallen behind. It does not descend into function bodies, where an upper-case name is a local, and a module that fails to parse is reported and skipped so one broken override does not hide the rest. It warns rather than fails: a missing setting means running on something other than an upstream default, which is not a reason to refuse to start. Verified on a built stack: all services come up healthy, the assembled mcrit/config/ holds the eight shipped modules, /entry_test.sh passes 191 tests with 91 deselected, and no warning appears for the configuration as shipped. Dropping STORAGE_MONGODB_FLAGS from a config.local/StorageConfig.py produced the expected warning, and an unparsable second override was reported by name while the first warning still printed. The development compose file was run end to end: the API answers on 8000, MCRITweb on 5000, and no assembly happens. shellcheck and hadolint are clean. Closes #8
danielplohmann
previously approved these changes
Sep 23, 2026
danielplohmann
left a comment
Collaborator
There was a problem hiding this comment.
Approved — CI green (build-test, lint, changelog gate, TUNING.md mirror). Reviewed in detail on #13; the increments here are small and sit on that base.
r0ny123
dismissed
danielplohmann’s stale review
September 23, 2026 14:34
The merge-base changed after approval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is stacked on #13 and will be rebased once that merges; 388e014 is the commit to read, everything before it belongs to that pull request. Both MCRIT containers mounted the tracked config/ directory read-only over the installed package's mcrit/config/, which meant that setting anything a deployment actually needs - an AUTH_TOKEN, an external MongoDB, a different cache budget - was an edit to files this repository tracks. Every subsequent pull then either conflicted with those edits or silently reverted them, and config/ stopped being a default anyone could review, because in practice no deployment was running it unmodified.
The containers now assemble their configuration rather than mounting it. config/ is mounted at /opt/mcrit/config.default and an untracked config.local/ at /opt/mcrit/config.local, and entry_common.sh, sourced by all three entry scripts, copies the defaults into the package's config directory and then copies the overlay on top. Whole modules are copied rather than merged, which is the honest granularity for Python configuration: a file in config.local/ is a copy of the shipped module with some values changed, so the mechanism has no way to be subtly wrong about what won. .gitignore keeps everything in that directory out of commits except a README explaining it. The development compose file keeps the old read-only mount, because /opt/mcrit is a host checkout there and assembling would write into the developer's own working tree. Assembling makes a second problem visible, and the same script reports it: the image keeps the stock configuration the installed MCRIT ships at /opt/config.stock, and at startup each container compares the module-level and class-level upper-case names of every stock module against the assembled one and prints a warning for each module that has fallen behind. It warns rather than fails, since a missing setting means running on something other than an upstream default, not a reason to refuse to start.
Verified on a stack built from this branch: all five services come up healthy, the assembled mcrit/config/ holds the eight shipped modules, the test entrypoint passes 191 unit tests with 91 mongo tests deselected, and no drift warning appears for the configuration as shipped, which is the case that matters. The warning was exercised by putting a copy of StorageConfig.py into config.local/ with STORAGE_MONGODB_FLAGS deleted, which produced exactly that name in the warning; adding a second, deliberately unparsable override showed it reported by name while the first module's warning still printed, so one broken file does not hide the rest. The development compose file was run end to end as well: the API answers on 8000, MCRITweb on 5000, and no assembly happens there. shellcheck and hadolint are clean.
The check reads names, not values, so a setting present with a stale value is not drift it can see, and it does not look for settings the deployment defines that MCRIT has dropped. It parses rather than imports, which is why it cannot be fooled by a module that has side effects but also why it only sees assignments and not anything computed. Names bound inside function bodies are ignored, since an upper-case name there is a local. The overlay itself has no merge and no templating; a deployment that wants one value changed still copies a whole module and carries the rest of it, which is a deliberate trade against a configuration format this repository would then own.
Closes #8