Backups accumulate. A retention policy decides what to keep and what to delete. This page walks through common patterns.Documentation Index
Fetch the complete documentation index at: https://docs.dbdock.xyz/llms.txt
Use this file to discover all available pages before exploring further.
The three knobs
Every DBdock retention policy combines three numbers:| Field | What it does |
|---|---|
maxBackups | Hard cap on total count — oldest first |
maxAgeDays | Delete anything older than N days |
minBackups | Safety net — never go below this count |
minBackups: 5, nothing is deleted.
See dbdock cleanup for the command that applies the policy.
Pattern 1 — minimal (small side project)
Pattern 2 — standard production (daily backups)
Pattern 3 — compliance (long retention)
For SOC 2, HIPAA, or similar frameworks that require 1+ year retention.Pattern 4 — hourly with tiered retention
High-churn databases where 24h RPO isn’t enough. Run backups hourly:- A separate DBdock config that writes to a different storage prefix with longer
maxAgeDays - Or manual promotion — copy a daily backup to a “long-term” prefix outside
dbdock_backups/
Pattern 5 — grandfather-father-son (classic)
Not natively supported by DBdock’s 3-knob policy, but achievable with external tooling:- Son (daily): 7 days
- Father (weekly): 4 weeks
- Grandfather (monthly): 12 months
Choosing values
maxBackups vs maxAgeDays
Both apply — the tighter one wins:
maxBackups: 30,maxAgeDays: 30, daily schedule → 30 backups (both match)maxBackups: 30,maxAgeDays: 365, daily schedule → 30 backups (maxBackupswins)maxBackups: 365,maxAgeDays: 30, hourly schedule → ~720 backups (maxAgeDayswins)
minBackups
- Development:
3 - Staging:
5 - Production:
7or higher
runAfterBackup
true(default) — cleanup runs right after each successful backup. Keeps storage tidy automatically.false— cleanup only runs whendbdock cleanupis invoked manually. Useful if you have a separate retention orchestration.
Monitoring retention
runAfterBackup or the cron.
Even better, have your alerting check:
See also
dbdock cleanup
Apply the retention policy.
Production checklist
Pre-flight for prod deployment.

