fix(backup): '&&' line-leading in folded YAML crashed the backup service - #439
Merged
Conversation
The backup service entrypoint is a ">" folded scalar, but its inner lines are indented deeper than `while true; do`, so YAML preserves their newlines instead of folding them to spaces. That put `&&` at the start of a line, so /bin/sh got `Syntax error: "&&" unexpected` and the container crash-looped — no DB backups were ever written (backups/ empty). Move `&&` to the end of the pg_dump line so it reads as a valid line continuation. Verified: the service now stays Up and writes a valid gzipped pg_dump (`-- PostgreSQL database dump`) with `backup: wrote …`. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The
backupservice (profiles: ["backup"]) crash-loops and writes zero backups —backups/stays empty.Its entrypoint is a
>folded scalar, but the inner lines are indented deeper thanwhile true; do, so YAML preserves their newlines instead of folding them to spaces. That leaves&&at the start of a line, so/bin/shreportsSyntax error: "&&" unexpectedand the container restart-loops. No automated DB backups are taken (data-safety gap).Fix
Move
&&to the end of thepg_dumpline so it's a valid line continuation (… .sql.gz &&\n echo …), regardless of how YAML folds the block:Verification (real run)
docker compose --profile backup up -d backup:Restarting).brainiac-<ts>.sql.gz(~160 KB);gzip -tpasses; content starts-- PostgreSQL database dump.backup: wrote brainiac-<ts>.sql.gz— no&&syntax error.One-line compose change; no app/schema impact.
🤖 Generated with Claude Code