[Fix] Preserve operator Compose overrides via an explicit registry owned by the host CLI - #1584
Open
mrubens wants to merge 5 commits into
Open
[Fix] Preserve operator Compose overrides via an explicit registry owned by the host CLI#1584mrubens wants to merge 5 commits into
mrubens wants to merge 5 commits into
Conversation
…s survive every path Replaces glob discovery with an explicit COMPOSE_FILE registry in .env managed by `roomote override add|remove|list`; routes the installer, systemd unit, and managed deploy/upgrade scripts through the CLI; makes `roomote upgrade` refresh the CLI and systemd unit; includes overrides in backup bundles; threads ROOMOTE_DOCKER_BIN through every docker invocation; and moves backup/restore EXIT-trap state to globals.
Contributor
|
No code issues found. See task
Reviewed 2c667bc |
Contributor
Author
|
@zarnivoop Fable came up with this as an alternative to #1496, curious to hear what you think |
…ive reboots on nonstandard Docker installs
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.
Summary
Operator Compose overrides currently survive only some code paths, and fixes to the host CLI or systemd unit never reach existing deployments. This PR makes the override mechanism explicit, persisted state and makes
roomote upgradeself-delivering, instead of patching individual call sites.It is an alternative to #1496, implementing the same goal one level deeper. The core ideas:
COMPOSE_FILEin/opt/roomote/.env(the variable docker compose itself honors), managed by a newroomote override add|remove|listcommand. Ordering is operator-controlled and visible, stray files in/opt/roomotecan't silently join production config,override addvalidates the merged config before recording anything, and a registered-but-missing file fails loudly with the fix spelled out.compose()builds the-flist from the registry, and every other surface routes through the CLI: the installer (roomote sync-unit+roomote compose config/pull+roomote up), the systemd unit (ExecStart=/usr/local/bin/roomote up), and the manageddeploy/scripts/deploy.sh/upgrade.shremote blocks (which now ship the CLI and callroomote compose ...). No path can drop overrides because no path constructs its own compose command anymore. Aroomote composepassthrough covers arbitrary operations.roomote upgradenow refreshes/usr/local/bin/roomotefrom the target release (atomic replace,bash -nguard against truncated downloads) and rewrites the systemd unit via the new CLI'ssync-unit. Both are staged into the rollback dir and restored if the upgrade fails. Existing installs need one last installer rerun (or managed redeploy) to receive this release; from here on, upgrades carry CLI and unit fixes themselves.config/compose-overrides/androomote restoreputs them back before the first compose call against the restored.env. Image-identity collection deliberately stays base-file-only so a locally built override image (the motivating Caddy DNS-plugin case) cannot block backups or upgrades; override images are documented as operator-managed for recovery.ROOMOTE_DOCKER_BINin.envand every invocation (compose,docker run/pull/inspect/ps/stop/tag) goes through it, not just the wrapper — so a snap Docker outside systemd's or sudo's PATH works for backup/restore/upgrade too, not only forup.cleanup_backup/cleanup_restoreare top-level functions reading onlybackup_*/restore_*globals (bash pops function locals before EXIT traps run underset -e), with a single cleanup body shared by the success and failure paths. This fixes the interrupted-backup restart bug and the same latent leak in restore (decryptedpostgres.sqlleft on disk after a failed restore).Tests
deploy/host/tests/compose-overrides.sh— registry parsing, ordering, stray-file exclusion,override add/remove/list, loud failure on missing registered filesdeploy/host/tests/compose-docker-path.sh—ROOMOTE_DOCKER_BINhonored from the environment and from.envdeploy/host/tests/backup-failed-restart.sh— interrupted backup restarts services (with overrides) from the EXIT trap, nounbound variable, override staged in the bundledeploy/host/tests/restore-failed-cleanup.sh— failed restore cleans its staging dir and passphrase temp filedeploy/host/tests/upgrade-refresh.sh— upgrade installs the new CLI, rewrites the unit, seedsCOMPOSE_FILE/ROOMOTE_DOCKER_BINon pre-registry installs, and preserves overridesdeploy/host/tests/upgrade-failed-pull.sh— extended: a failed upgrade also restores the previous CLI and unitdeploy/host/tests/backup-restore.integration.sh— full real-Docker backup/restore cycle passes unchangeddeploy/ci/validate-deployment-artifacts.mjs— new asserts that the installer and both managed scripts route through the host CLI and contain no rawdocker compose --env-fileinvocationsDocs updated in
SELF_HOSTING.mdandapps/docs/self-hosting.mdx.