dbdock.config.json file controls all aspects of DBdocks. It is automatically generated by npx dbdock init but can be edited manually.
Structure
Database
Configuration for connecting to your PostgreSQL database.Storage
DBDock supports multiple storage providers.Local
Stores backups on the local filesystem.AWS S3
Stores backups in an Amazon S3 bucket.Cloudflare R2
Stores backups in Cloudflare R2.Cloudinary
Stores backups in Cloudinary.Backup Settings
Control how backups are created and retained.Backup Formats
DBDock supports multiple PostgreSQL backup formats:custom(default) - PostgreSQL custom binary format (.sql)plain- Plain SQL text format (.sql)directory- Directory format (.dir)tar- Tar archive format (.tar)
Encryption Key
Generate a secure 64-character hexadecimal encryption key:Retention Policy
Automatic cleanup to prevent storage bloat from frequent backups. How it works:- Keeps most recent
minBackups(safety net, never deleted) - Deletes backups exceeding
maxBackupslimit (oldest first) - Deletes backups older than
maxAgeDays(respecting minBackups) - Runs automatically after each backup (if
runAfterBackup: true) - Manual cleanup:
npx dbdock cleanup
- maxBackups: Maximum number of backups to keep.
- maxAgeDays: Delete backups older than this many days.
- minBackups: Always keep at least this many recent backups, regardless of age.
- runAfterBackup: If true, cleanup runs automatically after every successful backup.
- Always preserves
minBackupsmost recent backups - Shows preview before deletion
- Detailed logging of what was deleted
- Error handling for failed deletions
Alerts
Configure email and Slack notifications for backup events. Alerts work with both programmatic usage and CLI commands.Slack Configuration
- Create a Slack App or use an existing one.
- Enable “Incoming Webhooks”.
- Create a new Webhook URL for your channel.
- Run
npx dbdock initand paste the URL when prompted.
SMTP Provider Examples
Gmail:Note: For Gmail, you need to create an App Password instead of using your regular password.SendGrid:
Alert Content
Success alerts include:- Backup ID
- Database name
- Size (original and compressed)
- Duration
- Storage location
- Encryption status
- Error message
- Database details
- Timestamp
- Helpful troubleshooting tips
- ✅ Alerts work with programmatic usage (
createBackup()) - ✅ Alerts work with scheduled backups (cron jobs in your app)
- ✅ Alerts work with CLI commands (
npx dbdock backup) - Configuration is read from
dbdock.config.jsonautomatically - Multiple recipients supported in the
toarray for email - Alerts are sent asynchronously (won’t block backup completion)
Storage Permissions
AWS S3
Required IAM permissions for S3 storage:s3:PutObject- Upload backupss3:GetObject- Download backupss3:ListBucket- List available backupss3:DeleteObject- Delete old backups
dbdock_backups/ folder with format: backup-YYYY-MM-DD-HH-MM-SS-BACKUPID.sql