Backups
How Dekka backs up PostgreSQL databases and volumes, where the backups are kept, and how to restore one.
Dekka takes one backup of every running PostgreSQL database each day and keeps it for seven days. You can also take a backup of a database or a volume yourself, which is kept for 30 days. Volumes are only backed up when you ask, and Redis and object storage aren't backed up.
Change the schedule or how long backups are kept
Each database's backups setting holds a schedule of daily or off, and retention_days between 1 and 90. Change it with PATCH /v1/resources/{id}, which replaces the whole spec, so send every other setting as it is.
curl -X PATCH https://api.dekka.cloud/v1/resources/$DATABASE_ID \
-H "Authorization: Bearer $DEKKA_API_KEY" \
--json '{ "spec": { "version": "16", "memory_mib": 256, "storage_mib": 1024, "tcp_proxy": false,
"backups": { "schedule": "daily", "retention_days": 14 } } }'Take a backup now
Select the database, open Data and choose Back up now under Backups. For a volume, choose Back up now in the Volume section of the service's settings. The list under each shows every backup with its size and when it expires.
curl -X POST https://api.dekka.cloud/v1/resources/$DATABASE_ID/backups \
-H "Authorization: Bearer $DEKKA_API_KEY"For a volume, send the same request to /v1/volumes/{id}/backups. A backup moves from pending through running to completed, or to failed with an error, and only one backup of the same database or volume can run at a time. GET on the same paths lists backups, newest first, with their size, when they expire and where they're kept.
Restore a backup
Choose Restore next to a backup, type the name Dekka asks for and choose Restore and replace. Restoring replaces the database's or volume's current data with the backup, and anything written since the backup was taken is lost, so Dekka asks for the database's name, or for the name of the service the volume belongs to, as confirmation. Connected services may see errors until the restore finishes.
curl https://api.dekka.cloud/v1/backups/$BACKUP_ID/restore \
-H "Authorization: Bearer $DEKKA_API_KEY" \
--json '{ "confirm": "db" }'Only a completed backup can be restored, and the request returns the restore operation so you can follow it.