Repository navigation
Description
Current status, September 22
Backup capture shipped in #444; guarded restore is being reviewed in #481. Restore still needs authenticated/TLS Redis handling, credential-safe errors and recovery from an interrupted restore. Encryption, retention and the previous-release destroy-and-restore drill remain later slices, so neither PR closes this issue.
Original requirements
Goal
Turn Orbit’s current backup advice into a reproducible, automated recovery contract covering Postgres, object storage, configuration, and release upgrades.
This is a sibling workstream under #388. It covers the remaining recovery and operator-documentation portions of DB-001, REL-001, REL-002, and DOC-001 in docs/open-source-readiness.md.
Current boundary
The current self-hosting guide says:
- durable application state lives in Postgres and uploaded files live in object storage
- Redis is disposable
- managed Postgres providers may take automatic backups
- a self-hoster should run
pg_dumpand restore it somewhere once
That is sound advice, but it is not yet a supported product contract. There is no upstream backup command, coordinated snapshot procedure, restore validator, scheduled recovery test, retention model, or proof that a database dump and object-store copy describe the same recoverable installation.
Recovery model
Document and enforce the data classes before writing scripts.
Durable and required
- Postgres application data, including auth, memberships, workspaces, issues, docs, integrations, MCP grants, and migration ledger
- object-storage uploads and versions required by the supported deletion/recovery policy
- installation/bootstrap state introduced by Deployment: secure first-owner bootstrap and portable initial authentication #393
- operator-supplied configuration that cannot be regenerated safely
Regenerable or disposable
- Redis fan-out and ephemeral coordination state
- application images, which must be recoverable from immutable release digests
- static assets contained in images
- caches and temporary build/runtime files
Do not back up raw ephemeral access tokens merely because a directory exists. Define every included table/object/config value deliberately.
Deliverables
1. Upstream backup command
Provide one supported command or container entry point, for example:
orbit backup create
or a documented equivalent under scripts//deploy/.
It must:
- verify the installation is on a supported migration state
- record Orbit version, source revision, image digests, migration hashes, database version, and backup format version
- create a consistent Postgres backup using a format suitable for verified restore
- copy or snapshot the object-storage bucket in a way that preserves every object needed by application rows
- include only the minimal configuration metadata needed to restore, never plaintext runtime secrets by default
- produce a manifest containing file/object hashes and counts
- write to an operator-selected destination
- fail atomically from the operator’s perspective: an incomplete backup is marked incomplete and cannot be mistaken for restorable output
- return nonzero when either database or object-store capture fails
If strict point-in-time consistency across Postgres and object storage cannot be guaranteed in the first release, document the bounded consistency model and implement reconciliation on restore. Do not call two unrelated copy commands a consistent snapshot without evidence.
2. Encryption and secret handling
Backups can contain sensitive customer content, password hashes, OAuth credentials, MCP grants, email addresses, and attachments.
The supported workflow must:
- support encryption before data leaves the host
- avoid placing encryption keys or database passwords in process arguments, logs, manifest files, or shell history
- permit integration with an operator-managed secret source
- document key rotation and recovery-key custody
- distinguish encrypted backup archives from image signatures/provenance
- never upload a backup to Noveum infrastructure without an explicit operator action
Credential-at-rest encryption remains tracked separately by SEC-015; backup encryption does not replace it.
3. Restore command
Provide a supported command or container entry point, for example:
orbit backup restore <manifest>
It must:
- verify archive and object hashes before mutation
- verify backup format and Orbit compatibility
- refuse an unsupported downgrade or unknown future format
- restore only into an explicitly selected target installation/database/bucket
- require destructive confirmation bound to the target identity
- prevent accidental restore into production when the operator intended a test environment
- restore Postgres and object storage in a documented order
- run migration compatibility checks after restore
- reconcile missing, extra, or versioned objects according to a stated policy
- leave the target unavailable/unready if validation fails
- emit a machine-readable result without printing secrets
4. Restore validation
A restore is not successful merely because pg_restore exits zero.
Add an application-aware validator that checks at least:
- migration ledger hashes and catalog drift
- user, organization, membership, team, issue, project, doc, and attachment referential integrity
- every referenced stored object exists and can be read with the expected size/type constraints
- no object required by a live row is silently missing
- installation/bootstrap state is internally consistent
- authentication can load an existing account without creating a bootstrap window
- MCP grants retain their workspace binding and revocation state
- Redis starts empty without data loss
- application health/readiness becomes green only after validation succeeds
5. Scheduled backups and retention
Provide a platform-neutral scheduling example and a retention command/policy.
Cover:
- hourly/daily/weekly examples without assuming Vercel cron
- retention by age and count
- deletion of incomplete and expired backups
- legal hold or operator pinning
- destination quota/full-disk behavior
- alerting on failed or stale backups
- clock/time-zone handling
- cleanup that cannot delete the newest known-good backup accidentally
Do not put a scheduler inside every web replica. Use one explicit job/command that external schedulers, Kubernetes CronJobs, systemd timers, or app platforms can invoke.
6. Continuous recovery drill
CI or a scheduled workflow must prove recovery, not only backup creation.
At least nightly or per release candidate:
- deploy the previous supported Orbit release
- create representative users, memberships, issues, comments, projects, docs, integrations, MCP grants, and file attachments through supported product/API paths
- create an encrypted backup
- destroy the test database and bucket
- restore into a blank environment
- start the candidate release and run required migrations
- verify all representative data and authorization boundaries
- verify attachments byte-for-byte
- verify revoked sessions/grants remain revoked
- verify two-browser realtime after Redis starts empty
- record backup size, restore duration, and the exact image/migration versions
The drill must fail loudly when any referenced object, database row, migration, or permission check differs.
7. Upgrade and recovery matrix
For every stable release, document and test:
- fresh install
- previous stable → current stable
- backup on previous stable → restore on previous stable → upgrade
- backup on previous stable → direct restore into current stable, if supported
- interrupted migration and documented forward-repair
- application rollback when no irreversible schema change occurred
- explicit refusal when rollback is unsafe
Do not promise arbitrary-version restores. State the supported window and format-version policy.
8. Operator runbooks
Add tested runbooks for:
- routine backup
- routine restore into a test environment
- complete host loss
- database corruption
- object-storage loss
- leaked backup encryption key
- failed migration
- accidental workspace/user deletion where recovery is supported
- region/provider migration
- validation failure after restore
Every command shown in documentation should either run in CI or be generated from the same source as the tested command.
Acceptance criteria
- A blank self-hosted deployment can create a backup using only documented commands.
- The backup contains a versioned manifest with hashes and no raw secrets.
- The archive can be encrypted with operator-controlled keys.
- A target-identity guard prevents accidental destructive restore.
- A complete environment can be destroyed and recovered from backup.
- All application data and uploaded files survive byte-for-byte where applicable.
- Redis can be discarded and rebuilt without loss of durable state.
- Existing users can sign in after restore; no new first-owner bootstrap window opens.
- Workspace isolation, invitations, integrations, and MCP grant binding/revocation remain correct.
- The previous-supported-release recovery/upgrade matrix passes automatically.
- A deliberately corrupted database archive, object, manifest, hash, encryption key, and incompatible version each cause a safe failure.
- Documentation includes measured recovery time and storage-size examples from the automated drill, clearly labelled as examples rather than guarantees.
Likely files
- new backup/restore commands under
scripts/ordeploy/ - production image entry points from Deployment: publish production images and a complete Compose stack #392
packages/db/src/migrate/and drift/catalog verification- storage service/client code for object listing and verification
- a versioned backup manifest schema under
packages/shared .github/workflows/for scheduled recovery drillsdocs/self-hosting.mddocs/configuration.md- new backup, restore, upgrade, and incident runbooks
SECURITY.md
Not part of this issue
- Provider-native managed backup implementation for every cloud
- Redis persistence as a durable application requirement
- Restoring data that was never included in a verified backup
- Credential-at-rest encryption for live integrations, tracked by SEC-015
- General retention behavior inside the Orbit product, tracked by REL-001 where applicable
Review boundary
Split implementation into focused pull requests:
- backup manifest and Postgres/object capture
- guarded restore and application-aware validation
- scheduled retention and encrypted destination examples
- previous-release recovery/upgrade drill and operator runbooks
Do not change the stable self-hosting claim until an automated destroy-and-restore drill succeeds against a production-shaped deployment.
Activity
Pallavikumarimdb commentedon Sep 5, 2026
@imshashank Can I work on this issue?
imshashank commentedon Sep 6, 2026
@Pallavikumarimdb Yes please go ahead. This is a big task so may take some time, if you want any help let me know.
I would recommend planning this first and maybe sharing that plan. Or feel free to start as you may like.
Pallavikumarimdb commentedon Sep 7, 2026
Hi @imshashank,
Thank you! I have put together a technical plan to prove backup, restore, upgrade, and disaster recovery for self-hosted Orbit, addressing DB-001, REL-001, REL-002, and DOC-001.
To keep reviews fast, focused, and safe, I propose splitting this 13-point task into 4 consecutive pull requests matching the issue review boundaries:
Proposed PR Breakdown:
PR 1: Backup Manifest Schema, Database Dump, Object Capture, and Atomic Backup CLI
@orbit/sharedwith format version, git SHA, image digests, migration ledger, database version, and S3 checksums.pg_dump -Fc) and S3 object capture with a documented bounded-consistency model..incompletemarker and nonzero exit code on failure).bun run backup:createunderscripts/backup/create.ts.PR 2: Guarded Restore Engine, Format Compatibility, and Application-Aware Validator
bun run backup:restore).--confirm-destructive-restore-target=<target>) to prevent accidental production overwrite./api/healthunready (503) until validation succeeds; emits machine-readable JSON results without secrets.PR 3: Backup Encryption, Scheduled Retention, and Platform-Neutral Schedulers
bun run backup:prune) with age/count rules, stale cleanup, legal-hold pinning, destination quota handling, and protection for the newest good backup.PR 4: Continuous Recovery Drill in CI, 7-Scenario Upgrade Matrix, and 10 Operator Runbooks
docs/runbooks/and updateddocs/self-hosting.md.Clarifying Questions:
bun run backup:create,bun run backup:restoreunderscripts/backup/) or packaged under a dedicated CLI package/binary (e.g.@orbit/cli)?Please let me know if this breakdown and direction look good, and I will begin work on PR 1!
fix(backup): coordinate snapshots, preserve libpq parameters, and use…
fix(backup): coordinate snapshots, preserve libpq parameters, and use…
fix(backup): coordinate snapshots, preserve libpq parameters, and use…
fix(backup): coordinate snapshots, preserve libpq parameters, and use…
fix(backup): coordinate snapshots, preserve libpq parameters, and use…
feat(backup): manifest schema, database dump, and atomic capture CLI (#…