Backups¶
Back it up¶
compose.production.yaml
services:
postgres:
x-stackgres:
backup: true # (1)!
- The database enters the backups of the platform. When they run, how long they are kept, and where they go belong to the platform.
Generated on every release. You never write this file or see it. Inside the SGCluster:
configurations:
backups:
- cronSchedule: 0 7 * * * # (1)!
retention: 7
sgObjectStorage: spaces
reconciliationTimeout: 300
- Schedule, retention, and destination come from the platform, not from your file.
Restore it¶
Start the database from a backup.
compose.production.yaml
services:
postgres:
x-stackgres:
initialData:
restore:
fromBackup:
name: my-app-20260929 # (1)!
target: immediate
- A backup of this database, taken by the platform. Its name belongs to one environment, so declare it in that environment's file.
Generated on every release. You never write this file or see it. Inside the SGCluster:
initialData:
restore:
fromBackup:
name: my-app-20260929
target: immediate
| Behavior | Detail |
|---|---|
| Once | The backup fills the database when it is created. Later releases keep the data |
| Your databases are there already | They are not created again. Users, permissions, and extensions are still applied |
| Migrations wait | A lifecycle hook runs only when the restore is done |