Quader Docs 0.176.0

Backup and restore

Back Quader up into a bucket of its own, verify the backups, and restore the whole installation from one or to a point in time.

On this page
Backup and restoreThe backup Job copies the database snapshot and every blob it references into a target bucket of its own. A restore loads a backup into a new, empty installation; a point-in-time restore recovers PostgreSQL through the platform. Both replay the revocation journal, which lies in the buckets of the object-store connections.snapshotreferenced blobsrestore Jobpoint-in-time recoveryreplayPostgreSQLbackup Job(CronJob)object-storeconnectionstarget bucket:backupsnew, emptyinstallationplatformarchive ofPostgreSQLrevocationjournal in theconnections'buckets
Layer Protects At worst you lose
Quader's backup Every row of one database snapshot and every blob it references What happened since the last backup, by default a day
Your platform's recovery PostgreSQL up to a time you choose, through archiving; deleted blobs, through bucket versioning Minutes
What you keep yourself The stored-secret keys (secrets.encryption), the export of the storage keys, your Helm values and Secrets Every sealed secret, and every encrypted blob, if the keys are lost

Both restores bring back the whole installation, never one repository or package. A backup holds no Valkey data, no keys or Secrets, no sessions or uploads in progress, and no audit events after its snapshot (those are in the log stream audit).

Set up the backup

yaml
backup:
  enabled: true                # default: false; CronJob <fullname>-backup
  schedule: "0 2 * * *"        # default
config:
  backup:
    target:
      bucket: quader-backups   # example: required, a bucket of its own
    retention:
      keep_last: 7             # default
    expected_interval: 24h     # default: for Overdue and QuaderBackupStale

The target must not be the bucket of an object-store connection on the same endpoint: the orphan sweep would delete the backups. The chart and every backup command refuse it. Prefer a bucket in another account, with Object Lock retention of at least keep_last times expected_interval.

The backup pod reaches With
The target The ServiceAccount's workload identity, or secrets.backupTarget
The connections' blobs Their credentials, or for a static one its read-only backupSource in secrets.storageConnections
PostgreSQL secrets.databaseBackup, else secrets.database with a warning

Warning

Keep a copy of secrets.encryption and the export of the storage keys (quader admin storage keys export) outside the cluster and away from the target. A restore stops when the key ring cannot open the backup, and without the key ring every encrypted blob is lost.

Every value: backup keys, Helm values.

The Backups tab

Who
holders of settings:read
Where
Admin area › System › System status › Backups

The tab changes nothing. It shows the last success, marked Overdue past 1.5 times the expected interval, or No backup yet. Below are the Last failure with its reason, the Run in progress with its phase and copied bytes, the Runs, and the Stored backups the newest run found. Start a backup now gives the kubectl command; one backup runs at a time. A drain ends a run as Interrupted, and the Job retries it.

Check that a backup restores

Only the backup Jobs hold the target's credentials, so run the command as a Job built from the CronJob:

shell
# example: verify the newest backup, deep
kubectl -n quader create job quader-backup-verify \
    --from=cronjob/quader-backup --dry-run=client -o json \
  | jq '.spec.template.spec.containers[0].args =
        ["backup", "verify", "--latest", "--deep"]' \
  | kubectl -n quader create -f -
kubectl -n quader logs -f job/quader-backup-verify

verify checks the manifest, the table files and every blob object; --deep downloads and hashes each. Findings exit 5 and fire QuaderBackupVerifyFindings. Encrypted blobs are checked by size and record, unless --key-ring <dir> decrypts them. Nothing verifies on a schedule, and only a restore into a second namespace proves the installation comes back. backup list and backup delete <id> run the same way. Without an installation, a backup is complete when <prefix>/backups/<id>/manifest.json exists in the target; the directory's name is the backup ID, such as 20261028T020000Z-7f3a.

Restore a backup

A restore goes into a new installation with an empty schema and empty connection prefixes. It applies the migrations and replays the revocation journal itself. quader backup restore checks first, and exits 6 naming the first that fails:

Check Holds when
Backup The manifest and every file it names are in the target
Version The image embeds the backup's migrations unchanged: restore with the version quader backup list shows
Keys secrets.encryption opens every key and storage key the backup needs
Database The schema exists, is empty and owned by the login; PostgreSQL is supported
Object store Every connection's prefix is empty and reachable; the blobs go to the first connection without drain: true
Journal A source connection's journal can be listed, or restore.skipRevocationJournal: true

If the old installation still runs, suspend its backup (backup.suspend: true) and stop it before clients switch over.

shell
# example: the backup ID; every role at zero
helm install quader quader/quader -n quader -f values.yaml \
  --version <version> \
  --set api.replicaCount=0 --set api.autoscaling.enabled=false \
  --set packages.replicaCount=0 \
  --set packages.autoscaling.enabled=false \
  --set worker.replicaCount=0 --set worker.autoscaling.enabled=false \
  --set restore.enabled=true \
  --set restore.backupId=20261028T020000Z-7f3a
kubectl -n quader wait --for=condition=complete job/quader-restore \
  --timeout=24h
# the normal values start the roles
helm upgrade quader quader/quader -n quader -f values.yaml \
  --version <version>

Set the same zero on every pool. A restore that is interrupted resumes in the Job's next pod; restore.extraArgs: [--check] only checks. After an exit that is not retried, fix the cause, delete the Job quader-restore and run the helm install again as helm upgrade; it resumes where it stopped.

Exit Means
0, 1 Success (also with warnings); failed, see the log
2, 3, 4 Usage error; another run writes the target; the target belongs to another installation
5, 6 Findings; a restore precondition
75 Temporary, retried

After the restore

  • The first backup into the old target exits 4: set backup.adoptTarget: true once, or use a new target.
  • Tokens created after the snapshot answer 401; packages published after it are gone; everyone signs in again.
  • Read the journal replay's output (below). Upstream, storage and format settings of repositories come back as at the snapshot (Known limitations).
  • Bastions declared in the values are applied again by the upgrade that turns restore.enabled off.
  • NuGet versions deleted after the snapshot are back as revived; a number published after it stays reserved for its bytes.

Restore to a point in time

This needs PostgreSQL archived to a bucket other than the connections', and each connection's bucket versioned (or a storage.gc.grace_period that covers the window). Declare the window as config.backup.recovery_window and object_versioning: a window longer than the grace period without versioning stops the start. The daily task backup-check (quader admin backup check) then reports the archive, its last outcome and the versioning, and a failure fires QuaderBackupCheckFailed.

  1. Upgrade with postRestore.hold=true and every role and pool at zero, delete running backup Jobs, and wait 30 seconds.
  2. Recover PostgreSQL into a new cluster at the time t (with CloudNativePG, bootstrap.recovery with recoveryTarget.targetTime).
  3. Upgrade again, still on hold, with the new config.database.host, postRestore.enabled=true and postRestore.restoredTo=<t>. Its Job ends sessions, gives the installation a new keyspace, verifies every blob, replays the journal from t and pauses deletions.
  4. If it reported missing blobs and the buckets are versioned, quader admin storage restore-versions --before <t> removes the newer delete markers.
  5. Upgrade with the normal values, which keep the new database host.
  6. Verify, then resume deletions:
shell
# example: a worker pod holds the release's configuration
kubectl -n quader exec deploy/quader-worker -- \
  quader admin maintenance resume-deletions

Access removed after the restore point

A restored database holds access as it was at the restore point. Both restores therefore replay the revocation journal, written to _journal/revocations/ in the connections' buckets: revoked tokens, disabled accounts, removed memberships, bindings and narrowed policies stay removed. The replay never grants access and deletes nothing.

Line Means Do
applied, already in effect, subject unknown The removal holds Nothing
skipped An update that only added access Grant it again if it should exist
suspended Applying it could widen access: the object is disabled Correct it and enable it (After a restore)
revived A deleted NuGet version is present Delete it again
unreadable A journal object could not be read Repeat that removal by hand

Entries not yet shipped (QuaderRevocationJournalBacklog), set aside (QuaderRevocationJournalQuarantined), or lost with the buckets are not replayed: repeat those removals from the log stream audit.

Read an encrypted bucket without Quader

With the export of the storage keys, the key ring's files and read access to the bucket, quader admin storage offline reads an encrypted connection from any machine, without a database:

shell
# example: one line per object, one blob by its SHA-256, a whole copy
quader admin storage offline list --connection-file archive.yaml \
  --keys quader-storage-keys.json --key-ring keyring/
quader admin storage offline get <sha256> --out artifact.tgz \
  --connection-file archive.yaml \
  --keys quader-storage-keys.json --key-ring keyring/
quader admin storage offline pull --connection-file archive.yaml \
  --to archive-copy/

archive.yaml is the connection's element of config.storage.connections. Copy an encrypted bucket only with pull or a tool that keeps object metadata: each object's key is there.