Repository navigation
docker: share the config file with the mounted source via symlink - #211
Merged
Merged
Conversation
The start script used to copy /etc/vizd/config.ini into the data dir on
every start, so admin-UI edits stayed inside the container and the mounted
source never changed.
node_admin writes the config atomically: canonicalize the path, create a
temp file next to the resolved target, then rename. A symlink from
$HOME/config.ini to /etc/vizd/config.ini therefore routes those writes
straight into the mounted source, without touching the node code.
Requirements, both checked in the image before this lands:
* /etc/vizd must be a DIRECTORY mount (rename over a file mount point
fails with EBUSY);
* that directory must be writable by the node user (mkstemp lives there),
otherwise admin config apply fails with EACCES. The script now prints a
loud warning at startup instead of letting the operator discover it
from a rejected UI action.
A regular config file left by the old cp is replaced once, so upgrades keep
working.
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.
What
The image start script (
share/vizd/vizd.sh) copied the config into the data dir on every start:cp /etc/vizd/config.ini $HOME/config.iniSo an admin-UI edit written by the node into
$HOME/config.ininever reached the mounted source, and the next restart silently reverted it.This replaces the copy with a symlink, so there is one config file:
ln -sfn /etc/vizd/config.ini "$HOME/config.ini"node_admin::write_config_atomic()canonicalizes the path (bfs::canonical), creates its temp file next to the resolved target, then renames. Through the symlink those writes land in/etc/vizd/config.ini, i.e. directly in the mounted host source. No C++ changes.Deployment requirements (both are real, both were measured)
/etc/vizdmust be a directory mount. A file mount (…/config.ini → /etc/vizd/config.ini) makesrename()over the mount point fail withEBUSY. The prod node already mounts a directory (/root/vizconfig → /etc/vizd); theviz-hubmirror currently mounts the file and needsdocker-composechanged to a directory.vizd.mkstemplives next to the target. The prod dir isroot:root 0755, so the node (uid 1001) getsEACCES. The script now prints a loud startup warning instead of leaving the operator to discover it from a rejected UI action.Upgrade path: a regular config file left by the old
cpis replaced once at startup, so existing volumes keep working.Verified
In the real
vizblockchain/vizd:latestimage (no rebuild needed for the check):readlink=/etc/vizd/config.ini;vizdviamktemp+mvin/etc/vizdlands in the host file (content changed on the host side);0755/etc/vizd, the new startup warning fires with the uid.Not verified here: the full image build / PR CI — that runs on this PR.