Skip to content

Backup and Recovery 🟑 BETA

Backup and recovery protect the database, the secret store, the bot buckets and the host configuration.

Where this topic sits in the Developer guide

What to Backup

Asset Source of truth Recovery object
Application database PostgreSQL on port 5432 pg_dump archive
Secrets Vault on port 8200 (or OpenBao) Raft snapshot from the bundled binary
Bot files OtterIO buckets {bot}.gbai / {org}.gborg oc copy of each bucket
Configuration /opt/gbo/conf/ on the host Encrypted copy outside the repo
Local models Installer cache under botserver-installers/ Re-seeded from the pinned URLs

Quick Backup Commands

  1. Dump the database with pg_dump -U postgres -F c -f /tmp/backup.dump <dbname>.
  2. Snapshot the secret store with the bundled OpenBao binary (raft storage).
  3. Copy every bucket with oc cp --recursive into /tmp/.
  4. Archive configuration and certificates to an encrypted file in /tmp/.
  5. Record the product version from the root Cargo.toml alongside the archive.

Database Backup (PostgreSQL)

A custom-format dump (-F c) is the supported restore input; restore it with pg_restore -U postgres -d <dbname> <file>. A plain SQL dump is also produced by pg_dump when a readable file is preferable. Never edit an applied migration; schema changes go through diesel migration run and botschema (root AGENTS.md, Diesel Schema Ownership).

Vault Backup

Use the bundled OpenBao binary to take a raft snapshot. Keep the unseal key at /tmp/vault-unseal-key-gb and the root token at /tmp/vault-token-gb; never write either into the repository or into documentation. A sealed Vault blocks bootstrap until it is unsealed three times in one session (root AGENTS.md, Deploy in Prod Gotchas).

Object Storage Backup (OtterIO)

Credentials come from secret/gbo/drive in Vault; configure oc against the internal API on port 9100 and copy whole buckets. On desktop the same buckets are local files under the stack path; copy them while the sidecar is stopped.

Configuration Backup

Back up /opt/gbo/conf/ and the host config under /tmp before any edit. Certificates are encrypted at rest; keep them out of git. A Caddy change is validated with caddy validate before it is reloaded (root AGENTS.md, Publishing and Production Operations).

Full System Backup

A complete backup contains the database dump, the Vault snapshot, the bucket copies, the encrypted configuration and a manifest with the product version and component pins from botserver/3rdparty.toml. Take it before a component swap or a host upgrade.

Disaster Recovery

  1. Snapshot the current container before changing anything.
  2. Recreate the stack from a clean install of the pinned components.
  3. Restore the database, then the secret store, then the buckets.
  4. Unseal the secret store and verify bootstrap completes.
  5. Check /health and one chat turn before declaring recovery complete.

Backup Verification

A backup that has never been restored is not a backup. Restore into a throwaway stack, verify database integrity and drive contents, then destroy the throwaway stack. Checksum the archive before and after transfer.

Cloud Backup Integration

Remote copies are optional. If a remote is used, encrypt before upload and verify the checksum after transfer. Do not put credentials or internal hostnames in this book.

Retention Policy

Keep daily, weekly and monthly archives for a bounded period and delete the rest. Cleanup runs outside the repository; no backup artifact is committed to git.

See Also

Component pins and checksums are in botserver/3rdparty.toml; host paths and service ports are in root AGENTS.md.

Limits

  • Secrets and unseal keys live only under /tmp/; a repository copy is forbidden.
  • Production changes require explicit approval; a backup alone does not authorise a swap.
  • There is no backup script in scripts/ that this page can cite β€” the commands above use the tools shipped with the stack.
  • Restoring over a live root is never supported; stage and swap instead.