Schedule database dumps
The Helm chart can run pg_dump on a schedule and upload each dump to S3-compatible storage. Use it for Postgres databases that Orchard does not back up itself, such as the control-plane database, so that you have a copy off the cluster. Databases that Orchard manages have their own backups and point-in-time restore.
The chart creates one CronJob for each target.
Prerequisites
Section titled “Prerequisites”- Access to the chart values for the instance.
- A bucket in S3-compatible storage.
Set up dumps
Section titled “Set up dumps”-
Create a Secret for the storage credentials. The default name is
database-dumps-r2. The Secret needs the keysACCESS_KEY_IDandACCESS_SECRET_KEY. -
Create a Secret that holds the database password for each target. The default key is
password. -
Add the following to your chart values:
databaseDumps:enabled: trueschedule: '15 2 * * *'destination:bucket: my-dumpsendpointURL: https://s3.example.comtargets:- name: orchardhost: postgres.orchard.svc.cluster.localdatabase: orcharduser: orchardpasswordSecret:name: orchard-postgres -
Apply the chart.
Verify the job
Section titled “Verify the job”To list the CronJobs, run the following command:
kubectl get cronjobs -A | grep dump-Each CronJob is named dump-<target name>. Each dump uses the pg_dump custom format.
Values
Section titled “Values”| Key | Default | Description |
|---|---|---|
databaseDumps.enabled | false | Creates the CronJobs. |
databaseDumps.schedule | 15 2 * * * | The cron schedule, unless a target sets its own schedule. |
databaseDumps.image | postgres:17.12-alpine | The dump image. Keep the Postgres major version at or above the server’s. |
databaseDumps.uploaderImage | amazon/aws-cli:2.40.2 | The upload image. |
databaseDumps.destination.bucket | Empty | The bucket. Required when there are targets. |
databaseDumps.destination.prefix | platform-dumps | The key prefix. |
databaseDumps.destination.endpointURL | Empty | The S3 endpoint, for storage other than AWS. |
databaseDumps.destination.secretName | database-dumps-r2 | The Secret with the storage credentials. |
databaseDumps.destination.keep | 0 | The number of dumps to keep for each target. 0 keeps every dump. |
databaseDumps.targets | Empty | The databases to dump. |
Each target needs name, host, database, user, and passwordSecret.name. The optional keys are port (default 5432), namespace (default the top-level namespace value, orchard), schedule, and passwordSecret.key (default password).
Each dump goes to <prefix>/<target name>/<UTC timestamp>.dump in the bucket.
Related resources
Section titled “Related resources”- Go to production - Back up the control-plane database and prepare an instance for real users.
- Add S3 storage - Configure the object storage that database backups and uploads use.