Files
Heimdall/skills/backup-restore/SKILL.md
T
arnaud.dartois af7a1b9585
Heimdall Gitea / Detect CI scope (push) Successful in 5s
Heimdall Gitea / Build and tests (push) Successful in 17m6s
Heimdall Gitea / Build and scan server image (push) Skipped
Heimdall Gitea / Build and scan agent image (push) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Skipped
Heimdall Gitea / Publish versioned installer release (push) Skipped
Heimdall Gitea / CI policy (push) Successful in 2s
docs: describe scheduled S3 mirror client (#360)
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-13 10:01:35 +01:00

5.5 KiB

name, description
name description
backup-restore Validate Heimdall PostgreSQL and protected-volume backups using isolated Compose projects and the production backup/restore scripts.

Heimdall backup and restore

For an explicitly authorized real backup/restore operation, follow Infisical secrets and retrieve only the selected environment's required key. Use generated credentials and disposable volumes for acceptance.

Use this workflow when changing docker/scripts/backup*.sh, docker/scripts/restore*.sh, the backup Compose, or the disaster-recovery runbook.

Project-specific behavior

  • PostgreSQL backups use docker/scripts/backup.sh and restores use restore.sh. Supply credentials through a generated POSTGRES_PASSWORD_FILE or a generated environment file; never reuse docker/.env, production secrets, or live volumes.
  • backup-protected-data.sh archives the Central data volume, including local objects and dp-keys. Restore with restore-protected-data.sh only while Central is stopped. The script overlays files and deliberately keeps unrelated target files.
  • Preserve the entire Data Protection ring and dp-cert.pfx together. Expired keys can still be required to unprotect stored payloads; never replace/delete one file as part of a restore. Heimdall has no validated manual rotation process for the certificate that protects the ring at rest; keep certificate rotation separate until tested against existing payloads. See docker/backup/README.md.
  • PostgreSQL and protected-volume archives are separate snapshots. The application does not coordinate them into one atomic point in time.
  • The scheduled backup Compose installs Alpine aws-cli, bash, and GNU coreutils; it does not install MinIO Client (mc). backup-rustfs.sh uses aws s3 sync in this shipped container and only selects mc mirror when mc is already present in a customized environment. Keep docker/backup/README.md aligned with this effective default and never document a retired mc download as an installer step.
  • The scheduled Compose sets TZ to Europe/Paris by default. Cron times in docker-compose.backup.yml use the container timezone, while scripts use UTC for archive timestamps and retention cutoffs. Document both clocks separately and describe any changed TZ as an operator configuration, not as UTC scheduling.
  • test-backup-restore.sh uses a named isolated network, tmpfs for its disposable PostgreSQL data directory, and a temporary host directory. Its cleanup must leave no container, network, or anonymous volume.

Acceptance

  1. Read docker/backup/README.md and docker/scripts/test-backup-restore.sh before changing the flow.
  2. Run the script and require all assertions to pass, including row/FK integrity, object/key digests, and Data Protection key permissions.
  3. For changes to volume-level restore or Compose behavior, build a disposable Compose project from the checkout with unique project name, generated credentials, and generated named volumes. Dump from one PostgreSQL volume and restore into a different volume; check a known row. Archive and remove synthetic files from the protected volume, restore them, and compare digests and key permissions.
  4. Measure only the synthetic restore duration and label it as a local fixture measurement. Do not present it as a production RTO. Derive the configured backup interval separately; do not imply it is a measured production RPO. For actual RPO/RTO drills, use the timestamp, resource, host, and repeated-run procedure in docker/backup/README.md and record the operator-approved target separately.
  5. Install an EXIT cleanup trap before build/start. Tear down only the disposable project with docker compose -p <name> down --volumes --remove-orphans; query its Compose project labels and confirm zero containers, volumes, and networks. Remove generated files even on a failed assertion. These fixtures use upstream PostgreSQL/RustFS images and build no local image unless a recipe change explicitly adds one; retain those upstream images. If adding a local build, record its unique tag and remove/verify that exact tag in the same trap after teardown. Never use --rmi all or broad prune commands.
  6. The scheduled backup image installs Alpine's aws-cli, bash, and GNU coreutils (date -d retention cutoffs do not work in BusyBox), not MinIO Client. backup-rustfs.sh therefore uses aws s3 sync; its mc mirror branch is only a fallback when a customized image already provides mc. Do not rely on the retired MinIO client download URL. The AWS CLI path passes configured S3 credentials explicitly for each invocation.
  7. Validate S3 behavior with a disposable RustFS service, unique Compose project/network/volumes and generated keys. Create a synthetic row, run backup.sh, verify both dated and latest.sql.gz objects, mutate the row, then run restore.sh --latest --yes and verify the prior value. Add ancient synthetic daily and weekly keys and confirm both retention jobs delete them. Also exercise backup-protected-data.sh upload and backup-rustfs.sh mirror/manifest where changed.
  8. Keep real-volume production recovery and production RPO/RTO open until validated on their actual service and data.

These backup recipes use shared upstream PostgreSQL/RustFS images and do not build a Heimdall image by default; retain those base images. Record local image tags: none for such a run. If a changed recipe adds any local build, tag it uniquely for the Compose project and remove/verify that exact tag after teardown in the same EXIT trap, even on failure. Do not use image-prune commands.