fix: honor retention for all backup formats (+ ERB view migration) #2

Merged
james merged 2 commits from fix/retention-period into main 2026-07-23 19:48:42 +00:00
Owner

Retention fix (the bug)

Baktainer wasn't honoring its retention period. BackupRotation only globbed and parsed *.{sql,sql.gz}, so newer backup formats that live in the same backup_dir/YYYY-MM-DD/ tree were never matched and accumulated forever:

  • Volume archives — <name>-volumes-<ts>.tar / .tar.gz
  • zstd-compressed dumps — .sql.zst
  • Encrypted backups — trailing .encrypted

Centralized the recognized-backup pattern in BACKUP_FILE_REGEX (container + unix timestamp, base sql/tar, optional .gz/.zst, optional .encrypted) and routed every rotation path through it: age-, count- and space-based cleanup, statistics, and empty-directory pruning. Added regression coverage for each previously-unmatched format.

Bundled: ERB view migration + supporting modules

To keep this branch self-consistent and green, it also carries the in-progress refactor:

  • Static *.html pages → Sinatra ERB views under app/views/ (dashboard/users/profile/backups) via a shared layout; / now renders erb :dashboard.
  • Pluggable compression (gzip/zstd), secret stores (env/file/label/vault), and extracted metadata/strategy/notification/streaming helpers.
  • Specs updated accordingly (dashboard route now asserts rendered ERB output).

Tests

1007 examples, 0 failures, 3 pending.

🤖 Generated with Claude Code

## Retention fix (the bug) Baktainer wasn't honoring its retention period. `BackupRotation` only globbed and parsed `*.{sql,sql.gz}`, so newer backup formats that live in the same `backup_dir/YYYY-MM-DD/` tree were never matched and accumulated forever: - Volume archives — `<name>-volumes-<ts>.tar` / `.tar.gz` - zstd-compressed dumps — `.sql.zst` - Encrypted backups — trailing `.encrypted` Centralized the recognized-backup pattern in `BACKUP_FILE_REGEX` (container + unix timestamp, base `sql`/`tar`, optional `.gz`/`.zst`, optional `.encrypted`) and routed **every** rotation path through it: age-, count- and space-based cleanup, statistics, and empty-directory pruning. Added regression coverage for each previously-unmatched format. ## Bundled: ERB view migration + supporting modules To keep this branch self-consistent and green, it also carries the in-progress refactor: - Static `*.html` pages → Sinatra ERB views under `app/views/` (dashboard/users/profile/backups) via a shared layout; `/` now renders `erb :dashboard`. - Pluggable compression (gzip/zstd), secret stores (env/file/label/vault), and extracted metadata/strategy/notification/streaming helpers. - Specs updated accordingly (dashboard route now asserts rendered ERB output). ## Tests `1007 examples, 0 failures, 3 pending`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Backup rotation only globbed and parsed *.{sql,sql.gz}, so volume
archives (*-volumes-*.tar[.gz]), zstd-compressed dumps (*.sql.zst) and
encrypted backups (*.encrypted) were never matched. They accumulated
indefinitely and the configured retention period appeared to be ignored.

Centralize the recognized-backup pattern in BACKUP_FILE_REGEX (container +
timestamp, any base format, optional compression, optional encryption) and
route every rotation path through it: age-, count- and space-based cleanup,
statistics, and empty-directory pruning. Add regression coverage for each
previously-unmatched format.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feat: migrate UI to ERB views and add compression/secrets/strategy modules
All checks were successful
CI Pipeline / test (pull_request) Successful in 59s
CI Pipeline / build (pull_request) Has been skipped
380b56e3b7
Bundles the in-progress refactor alongside the retention fix so the branch
is self-consistent and green:

- Replace static *.html pages with Sinatra ERB views under app/views/
  (dashboard, users, profile, backups) rendered through a shared layout;
  the "/" route now renders erb :dashboard instead of reading dashboard.html.
- Add pluggable compression (gzip/zstd) via Compression::* strategies.
- Add secret stores (env/file/label/vault) under Secrets::*.
- Extract backup metadata builder, strategy validator, notification message
  builder, and streaming command executor.
- Update specs to match (dashboard route now asserts rendered ERB output).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
james merged commit fc2a374e1e into main 2026-07-23 19:48:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
james/baktainer!2
No description provided.