restoreproof.yml

The runner reads one file, restoreproof.yml, which lists the drills to run. Each drill restores one backup source into a throwaway database and applies its checks.

Full example

version: 1
drills:
  - name: prod-postgres            # unique per org, [a-z0-9-]{1,64}
    engine: postgres               # postgres | mysql
    engine_version: "16"           # docker image tag for the throwaway DB
    source:                        # exactly one of:
      s3:                          # S3-compatible; picks the newest object under prefix
        bucket: my-backups
        prefix: pg/prod/
        region: eu-central-1
        endpoint: ""               # optional (R2, B2, MinIO)
        # credentials from standard AWS env vars
      file: ./backup.dump          # local path
      command: "pg_dump ..."       # shell command writing dump to stdout
    format: custom                 # postgres: custom | plain ; mysql: plain   (gzip auto-detected by .gz)
    checks:
      min_tables: 10
      tables:                      # per-table assertions
        - name: public.users
          min_rows: 1000
        - name: public.orders
          min_rows: 1
      queries:                     # SQL that must return a single truthy value
        - name: recent orders exist
          sql: "select count(*) > 0 from orders where created_at > now() - interval '2 days'"
      max_restore_seconds: 900     # RTO target; exceeded => check fails
      max_backup_age_hours: 26     # RPO target; based on object LastModified / file mtime

Top-level keys

KeyRequiredDescription
versionYesConfig format version. Must be 1.
drillsYesList of drills. restoreproof drill runs all of them, or only the one named with --drill.

Drill keys

KeyRequiredDescription
nameYesUnique per organization. Lowercase letters, digits and hyphens, 1 to 64 characters.
engineYespostgres or mysql.
engine_versionYesVersion tag for the throwaway database image, for example "16". Quote it in YAML.
sourceYesExactly one of s3, file or command. See below.
formatYesPostgres: custom or plain. MySQL: plain. Gzip is detected from a .gz extension.
checksYesChecks to run after the restore. See below.

Backup sources

Set exactly one. A source that sets more than one, or none, fails validation with exit code 2.

s3

Reads from an S3-compatible bucket. The runner selects the newest object under prefix.

KeyRequiredDescription
bucketYesBucket name.
prefixYesKey prefix. The newest object under it is restored.
regionYesRegion, for example eu-central-1.
endpointNoCustom endpoint for R2, B2, MinIO and other S3-compatible services. Empty for AWS.

Credentials come from the standard AWS environment variables, such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, or from an OIDC role assumed earlier in the job. The GitHub Actions guide shows the OIDC setup.

file

A local path to a dump file, relative to the working directory. Useful when an earlier step in your job has already downloaded the backup.

source:
  file: ./backup.dump

command

A shell command that writes the dump to stdout. Use this when the dump is produced on demand, for example from a live replica. The command runs in your job, so its credentials and network access are yours to manage.

source:
  command: "pg_dump --format=custom --dbname=$REPLICA_URL"

Formats

  • Postgres: custom for pg_dump --format=custom output, restored with pg_restore; plain for SQL text.
  • MySQL: plain for SQL dump output.
  • Compression: a file ending in .gz is decompressed automatically.

Checks

KeyDescription
min_tablesMinimum number of user tables in the restored database.
tables[].nameTable to check, schema-qualified, for example public.users.
tables[].min_rowsMinimum row count for that table.
queries[].nameLabel shown in the report.
queries[].sqlSQL that must return a single truthy value, for example true or a non-zero count.
max_restore_secondsRTO target. The check fails if the restore takes longer.
max_backup_age_hoursRPO target. Age is taken from the object’s last-modified time, or the file’s modification time. The check fails if the backup is older.

The restore itself is always a check. A drill that fails to restore fails regardless of the other checks.

Environment variables

VariableDescription
RESTOREPROOF_API_KEYYour API key. Needed to report results. Without it, the CLI runs locally and prints the report only.
RESTOREPROOF_API_URLService URL. Defaults to https://restoreproof.org. Override it to point at a different deployment.
RESTOREPROOF_TARGET_DSNConnection string for an existing database to restore into, used by the Kubernetes sidecar mode. When it is set, the runner does not start Docker.

CLI commands

restoreproof drill [--config restoreproof.yml] [--drill NAME] [--no-report] [--output report.json]
restoreproof validate [--config ...]
restoreproof version
  • drill runs all drills, or the one named with --drill. --no-report skips sending results. --output writes the JSON report to a file.
  • validate checks the config file without running anything.
  • version prints the CLI version.

Exit codes

CodeMeaning
0All drills passed.
1At least one drill failed.
2Configuration or usage error.

Throwaway database

By default the runner starts a database container with docker run --rm -d, using postgres:<version> or mysql:<version>. It binds a random localhost port and uses a random password. The container is removed after the drill, including when the drill fails. In Kubernetes, set RESTOREPROOF_TARGET_DSN to use a database sidecar instead.