Repository navigation
fix(backup): enforce B2 retention so nightly dumps can't exceed the storage cap - #202
Merged
Merged
Conversation
…torage cap backup.sh copied a new ~380 MB pg_dump to Backblaze B2 every night and pruned nothing, so the bucket grew unbounded and hit the 10 GB storage cap on 2026-09-09 — two nights of backups silently failed with 403 storage_cap_exceeded, and the Sunday weekly had already been dead since May. Add retention that runs BEFORE the upload (keep last NIGHTLY_KEEP=14 / WEEKLY_KEEP=6, both env-overridable), so a bucket sitting at the cap trims itself and self-heals instead of wedging. Critically, set `hard_delete = true` and run `rclone cleanup`: on a versioned B2 bucket `rclone delete` only hides objects and the hidden versions keep counting toward the cap — the exact reason a plain prune didn't free space during the incident. Co-Authored-By: Claude Opus 4.8 <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.
Why
scripts/backup.shshipped a new ~380 MBpg_dumpto Backblaze B2 every night and pruned nothing. Thekibarometer-backupsbucket grew unbounded and hit the 10 GB storage cap on 2026-09-09 — two nights (09-09, 09-10) failed silently with403 storage_cap_exceeded, and the Sunday weekly snapshot had been dead since May. Live data was never at risk; the offsite copy just stopped updating.What
NIGHTLY_KEEP(14) andWEEKLY_KEEP(6) dumps — both env-overridable. Pruning runs before the upload (toKEEP-1, so the new dump restoresKEEP), so a bucket already at the cap trims itself and self-heals instead of wedging.hard_delete = trueand runrclone cleanup. On a versioned B2 bucket,rclone deleteonly hides objects and the hidden versions keep counting toward the cap — which is why a manual prune during the incident didn't clear403untilrclone cleanuppurged the hidden versions.head.Notes
sh -nclean. I'll exercise it live (docker exec kiba-backup /backup.sh) once the account-level B2 cap is cleared and this is deployed.🤖 Generated with Claude Code