Backup & Recovery
Protect your data with automated backup policies for Droplets, databases, and volumes.
Create a Backup Policy
Database Backup (Daily)
curl -X POST http://localhost:8080/api/v1/backup/policies \
-H "Content-Type: application/json" \
-d '{
"name": "daily-pg-backup",
"resource_type": "database",
"resource_id": "db_your_id",
"schedule": "0 2 * * *",
"retention_days": 30
}'
This creates a daily backup at 2:00 AM, retaining backups for 30 days.
Droplet Backup (Weekly)
curl -X POST http://localhost:8080/api/v1/backup/policies \
-H "Content-Type: application/json" \
-d '{
"name": "weekly-vm-snapshot",
"resource_type": "droplet",
"resource_id": "dpl_your_id",
"schedule": "0 3 * * 0",
"retention_days": 90
}'
Volume Backup (Every 6 Hours)
curl -X POST http://localhost:8080/api/v1/backup/policies \
-H "Content-Type: application/json" \
-d '{
"name": "frequent-data-backup",
"resource_type": "volume",
"resource_id": "vol_your_id",
"schedule": "0 */6 * * *",
"retention_days": 14
}'
Schedule Reference
| Cron Expression | Frequency |
|---|
0 2 * * * | Daily at 2 AM |
0 */6 * * * | Every 6 hours |
0 3 * * 0 | Weekly on Sunday at 3 AM |
0 2 1 * * | Monthly on the 1st at 2 AM |
0 */1 * * * | Every hour |
Trigger a Manual Backup
curl -X POST http://localhost:8080/api/v1/backup/jobs \
-H "Content-Type: application/json" \
-d '{"policy_id": "bp_your_policy_id"}'
Monitor Backup Jobs
curl http://localhost:8080/api/v1/backup/jobs
[
{
"id": "job_001",
"policy_id": "bp_a1b2c3d4",
"status": "completed",
"size_bytes": 104857600,
"started_at": "2024-01-15T02:00:00Z",
"finished_at": "2024-01-15T02:05:23Z"
}
]
Restore from Backup
Restore a Droplet Snapshot
curl -X POST http://localhost:8080/api/v1/droplets/dpl_your_id/snapshots/snap_id/restore
Restore a Database
For PostgreSQL databases using CloudNativePG, point-in-time recovery (PITR) is available. Contact the admin to initiate a PITR restore.
Managing Policies
Update a Policy
curl -X PATCH http://localhost:8080/api/v1/backup/policies/bp_your_id \
-H "Content-Type: application/json" \
-d '{
"retention_days": 60,
"schedule": "0 1 * * *"
}'
Disable a Policy
curl -X PATCH http://localhost:8080/api/v1/backup/policies/bp_your_id \
-H "Content-Type: application/json" \
-d '{"enabled": false}'
Delete a Policy
curl -X DELETE http://localhost:8080/api/v1/backup/policies/bp_your_id
Deleting a policy does not delete existing backup data. Old backups are retained until their retention period expires.
Best Practices
- Use multiple backup frequencies — daily for databases, weekly for VMs
- Set appropriate retention — longer for production, shorter for development
- Test restores regularly — verify that backups can actually be restored
- Monitor job status — set up webhooks to alert on backup failures
- Separate backup storage — use object storage on a different node if possible