Repository navigation
fix: recover per-app config after database loss instead of deleting it - #126
Merged
Merged
Conversation
PruneOrphanSidecars ran on boot before the reconciler re-created app rows, so on an empty DB every app's simpledeploy.yml was deleted. A sidecar is now an orphan only when its folder has no docker-compose.yml, no app row and no tombstone, and nothing is pruned while the DB has no apps. ReconcileDBFromFS skips apps without a row (the reconciler imports them). A DR import of config.yml marks the first-boot seed done so a failed import can no longer overwrite config.yml/secrets.yml from the partial DB.
Move serve's boot-time configsync steps into initConfigSync and reloadConfigFromFS (same order) so a test can run them.
…ne rule) config-sidecars.md claimed config.yml holds bcrypt hashes at 0600 and that master_secret lives in data_dir/.secret; hashes are in secrets.yml (0600), config.yml/simpledeploy.yml are 0644, master_secret is in config.yaml. Document secrets sidecars, the orphan prune rule, the reconciler-driven per-app import, and that files win over the DB.
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.
Found by un-skipping the disaster-recovery E2E spec (26a), which had been skipped with a TODO.
Bug: after the database was lost and SimpleDeploy restarted, boot ran
PruneOrphanSidecarsbefore the reconciler re-created app rows. With an empty apps table every<app>/simpledeploy.ymllooked orphaned and was deleted, so alert rules, backup configs and access grants were lost, contrary to docs/operations/config-sidecars.md. Server log on restart:Fix
docker-compose.yml, no app row (active or archived) and no archive tombstone. Nothing is pruned while the DB has no apps, or when a check fails; a stale file is safer than lost config.ReconcileDBFromFSskips apps without a row (the reconciler creates the row and imports the sidecar).config.ymlmarks the first-boot seed done, so a failed or partial import can no longer overwriteconfig.yml/secrets.ymlfrom the partial DB.Tests: configsync recovery tests, reconciler recovery after DB wipe with boot-time prune, a CLI boot-sequence test (DB wipe, restart, config restored), malformed config.yml guard. Full
go test ./...passes.Docs: config-sidecars.md corrected (file layout incl.
secrets.ymlandsimpledeploy.secrets.yml, file modes, prune rule).