Enable daily backups by default on fresh deploys#1202
Conversation
Sets a default backup cron (03:00 daily, keep 7) when unconfigured, so a new deploy isn't one volume wipe from data loss. Env-overridable via PRIMO_BACKUP_CRON; only set when empty so an admin-UI schedule isn't clobbered.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe settings migration now sets default backup scheduling when ChangesBackup default scheduling
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@migrations/1757326540_settings.go`:
- Around line 26-35: The migration in the settings bootstrap path updates
`settings.Backups.Cron` and `settings.Backups.CronMaxKeep` but ignores the
result of `app.Save(settings)`, so a failed write can be silently skipped.
Update this migration to check and return the error from `app.Save(settings)`
instead of discarding it, using the existing migration logic around
`settings.Backups.Cron` and `settings.Backups.CronMaxKeep` to keep the save
atomic and stop the migration on failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0c94fc4f-298f-4920-8602-828e9926e3be
📒 Files selected for processing (1)
migrations/1757326540_settings.go
Return the app.Save(settings) error so a failed write aborts the migration instead of leaving a fresh install without the backup schedule.
What
Sets a default backup schedule when none is configured, so a fresh deploy isn't one volume wipe away from total data loss.
0 3 * * *(daily at 03:00),CronMaxKeep = 7, applied in the settings migration.PRIMO_BACKUP_CRON.settings.Backups.Cronis empty, so a schedule configured through the admin UI is never clobbered.Caveat
Backups land on the
pb_datavolume (backups/dir) — a floor, not off-site protection. For durable backups, configureBackups.S3.Summary by CodeRabbit