Skip to content

Backups and recovery ​

Storage ​

Add an S3-compatible storage under Backups (Cloudflare R2, Backblaze B2, AWS S3, MinIO or any other) with an access key limited to one bucket. Orbit writes, reads and deletes a probe object before accepting it.

A Space on another server works too, without an account anywhere else. Choose it under Backups → Add storage, or take the suggestion the backups page makes when one of your Spaces runs on a different server than the data. Orbit creates a bucket called orbit-backups inside that Space, with an access key that reaches only that bucket, and checks it like any storage. Backups travel over the cluster network between your servers. The Space's own files and its own backups never include them.

  • A database on the Space's own server cannot use it: both would go down with that server, so Orbit refuses it and the backups page leaves it unchecked.
  • The Space cannot be removed while it keeps backups; point those databases at another storage first.
  • Losing the Space's server loses the copies kept there. For data you cannot lose, keep an S3-compatible service too.
  • PostgreSQL's point-in-time archive still needs an S3-compatible service. A database whose backups go to a Space restores to the moment of each backup.

Create a destination in Cloudflare R2 ​

An installation administrator can choose Backups → Add storage → Create in Cloudflare R2. Connect Cloudflare in DNS settings first, with a zone belonging to the account you want to use. Orbit lists the accounts from those zones; sharing a DNS zone with a workspace does not grant permission to create account-level resources.

Give the destination a name and choose the account. The connected token needs Workers R2 Storage Write and Account API Tokens Write for that account. R2 must already be enabled in Cloudflare. Storage and requests follow your Cloudflare plan; Orbit does not enable billing or buy a plan.

Orbit creates a uniquely named private bucket in the default jurisdiction, then an account-owned token with Workers R2 Storage Bucket Item Write scoped only to that bucket. It derives the S3 credentials, stores them sealed and writes, reads and deletes a probe object. Only after the probe succeeds is the destination ready for a backup policy. Normal backups use the restricted S3 key, so they do not depend on keeping the broader provisioning permissions.

If setup fails, read the operation's evidence, correct the permission or connectivity problem and retry. Retry preserves the bucket and any saved credentials. If an interruption lost a token's one-time value, Orbit revokes only a token whose name and bucket-only policy exactly match that setup, then creates a replacement. It never deletes the bucket. Accounts or tokens with ambiguous permissions require review in Cloudflare.

Once ready, use Keep a copy off this server to select the databases and Spaces to protect. Run a backup and wait for its restore test to pass before treating the new destination as verified. The existing S3 option remains available for manually configured credentials and other providers.

The integration follows Cloudflare's R2 credential and bucket policy documentation and account token creation API.

The policy ​

Each database has its own: when it runs, in which time zone, how long backups are kept or how many copies to keep and where they go. Keeping backups on the server itself protects against mistakes, not against losing the server.

  • When: every hour or every few hours at a chosen minute, every day at a chosen time, on chosen weekdays, or a custom cron (30 2 * * 1-5). A database is backed up at most once an hour.
  • Time zone: any IANA zone (America/Sao_Paulo, Europe/Berlin). Daylight saving changes are followed: a time that a change skips runs when the clock jumps.
  • Retention: keep backups for 1 to 365 days, or keep the last 1 to 365 good copies. The default remains seven days. Seven days of hourly backups means about 168 copies; seven daily copies means about seven days. Manual and scheduled backups follow the same policy, so manual backups shorten the time covered by a count.
  • Cleanup: after every backup that was stored, whatever its restore test said, and once a day for every database with backups turned on. Count retention keeps the newest verified copies and copies whose restore test passed, was skipped or ran out of time; failed attempts do not displace them. It then removes extra copies and failed attempts from Orbit and storage. Pending backups and the newest good copy are always protected. Deleting a database deletes its copies from storage too. With bucket versioning, deletes may leave older object versions: configure the provider’s lifecycle rules to remove those versions too.
  • Restore tests: after every backup, on the first backup of each day, on the first of each week, or never. See Restore tests.
  • The policy shows the next three backups before you save it.

Is it safe? ​

Every database and Space card answers three questions about its backups:

  • On a schedule: backups are on and have a schedule.
  • Off this server: they go to an S3 storage that is ready, so a copy survives losing the server the data lives on. Backups kept on the same server do not.
  • Restore tested: a restore test passed in the last 14 days.

Each answer is green or amber, and the first amber one comes with what to do next. Outside production, backups that are off read as a choice: the card says so instead of showing three amber answers. When databases or Spaces keep their only backup on the server they run on, the overview says how many and on which server, with a link to the backups.

Keep a copy off the server, on the Backups page, fixes them together. Choose a ready storage, keep the databases and Spaces you want selected, and Send changes each one's destination to that storage, one at a time, and takes a backup there right away unless you clear the option. Each line says when its backups go to the storage, or why the change failed. Backups already taken stay where they are until retention removes them. Without a ready storage, the panel asks you to add one first: any S3-compatible service outside your servers works, such as Cloudflare R2, which has a free tier, Backblaze B2 or AWS S3.

A new database starts with nightly backups. When the workspace has a ready S3 storage, they go there from the first one; otherwise the dialog says they stay on the server until you add one. Every backup gets a restore test unless you choose a different cadence in restore tests.

Verified backups ​

A backup only shows as verified after Orbit downloaded it again and restored it in an isolated container that nothing can reach. A backup that fails that test stays stored but unverified, and the operation shows why. A backup that was not tested shows as Not restore-tested.

A backup is a pg_dump in custom format for PostgreSQL, a mysqldump file for MySQL, a mongodump --archive --gzip file for MongoDB, an RDB file for Redis or a tar of the objects for a Space. It is uploaded with its SHA-256 and read back before it counts as stored.

For PostgreSQL and MySQL, pg_dump and mysqldump run in a short-lived container next to the database, on the same server and with a memory limit of its own, so the dump normally has a separate memory budget. If Orbit cannot start that container, it falls back to the database container and records the reason as a warning in the operation log. MongoDB and Spaces run their tools in the database's client container for the same reason.

When the database is restarting ​

Before taking a snapshot, Orbit waits up to three minutes for the database pod to be ready. For CloudNativePG, the cluster must also report a healthy phase and its primary must be ready. PostgreSQL shutdown, startup and recovery errors, refused connections and temporary MySQL disconnects trigger up to three retries, spaced across a five-minute retry window. Each retry discards any partial dump; imports are not retried this way.

If the database stays unavailable, the operation reports backupDatabaseRestarting with the pod’s last termination, exit code and restart count, recent Kubernetes events and the CloudNativePG phase and reason. An OOMKilled termination also offers the database’s memory settings and any open memory incident. Fix the reported cause, wait for the database to become ready, then retry the backup.

Restore tests ​

A restore test copies the backup into a fresh, isolated database, restores it and counts its tables and rows, keys for Redis or objects for a Space. Its log shows how long each part took: starting the database, copying the backup in, restoring and counting.

  • How often: by default, after every backup when the database is backed up at most once a day, and on the first backup of each day when it is backed up more often. The policy can choose after every backup, daily, weekly or never. Days and weeks follow the policy's time zone.
  • After a failure: when the last test did not pass, the next backup is tested too, whatever the policy says, until one passes. A test that ran out of time is not a failure: the next test follows the policy.
  • By hand: backups taken with Back up now are tested unless the policy says never, and Test now tests any stored backup. A test waits for a backup or another test of the same database to finish, so they never run at the same time.
  • Time limit: 10 minutes, plus 5 more for every 100 MB of the database's data on disk, or of the backup when that is larger. If an attempt times out, Orbit starts a fresh isolated container and rereads the same backup once. If both attempts time out, the backup stays restorable as Not tested in time. The backup operation budgets time for both attempts in addition to its own 30 minutes. The backup details retain the diagnostic and timestamp for failed attempts. The throwaway PostgreSQL uses the database's memory for the restore and runs it with up to four jobs.
  • Where the time goes: while a test runs, the operation card shows the latest line of the step in progress and how long that step has taken: starting the isolated database, copying the backup into it, the restore itself and the row count.
  • Data at risk counts from the newest backup you can restore, tested or not. Time to restore says when the restore test it comes from ran.

Restoring ​

Choose a backup on the database's page and type the database's name. A verified backup can be restored, and so can one that was not tested yet, since its SHA-256 matched; one whose restore test did not pass cannot.

  1. By default Orbit first backs up the current data, so there is always a way back.
  2. A PostgreSQL restore runs in one transaction, so it either completes or leaves the data untouched.
  3. The applications that use the database are restarted, and Orbit compares the restored tables and rows (or keys) with what the backup's test found, when it was tested.

Importing data ​

Import data brings data from elsewhere as a backup marked Imported. It goes through the same checksum and isolated test, and nothing changes until you restore it.

  • From another database: paste its connection URL with the password (postgresql://, mysql://, mongodb://, mongodb+srv:// or redis://). A MongoDB URL names the database to bring, as in mongodb+srv://user:password@cluster0.example.net/shop. The dump runs on your server, so the source must accept connections from the server's IP. The URL is sealed while the import runs, erased when it ends and never written to the logs.
  • From a file: a custom-format pg_dump -Fc file, a mysqldump .sql file, a mongodump --archive --gzip file of one database, a dump.rdb or, for a Space, a tar of the files made inside their folder, up to 64 GiB.
  • PostgreSQL's pg_dump refuses a server newer than itself, so import from the same major version or an older one.

Point-in-time recovery ​

A PostgreSQL database on CloudNativePG whose policy sends backups to external storage also archives its WAL there, continuously.

  • Turning it on: saving such a policy restarts the database once and starts a first base backup. Every later backup also takes a base backup.
  • The archive: in the same bucket, under <prefix>/orbit/pitr/<database id>, with a time window derived from the policy. Days mode uses the chosen days. Count mode multiplies the number of copies by the longest interval between the next 40 scheduled runs, rounded up to whole days with a minimum of one. Seven daily copies therefore keep a seven-day archive; seven hourly copies keep at least one day. A policy without a usable schedule uses one day per copy. A WAL file that is not full is archived after a minute at most. After a major upgrade it starts over from a new base backup.
  • The window: the database's page shows it, from the oldest base backup kept to now. When WAL files wait to be archived, or archiving fails, it ends at the last file archived. A failing archive, or WAL waiting for more than 10 minutes, marks the database as degraded.

Restore to a point in time takes any second in the window and the database's name:

  1. Orbit keeps a copy of the current data, like any restore.
  2. It recovers the archive into a temporary cluster at that moment and copies its data into the database in one transaction.
  3. It restarts the applications that use the database and checks the tables and rows.

On a test cluster, restoring to the second before a destructive change took about a minute.

Rebuilding from the archive ​

When no instance of the database answers (every server or volume holding it is gone), the page says so and offers Rebuild from the archive, with the database's name to confirm.

  1. Orbit removes what is left of the instances and their volumes.
  2. It recovers the last base backup and every archived WAL file into new instances on the same servers. They archive under a new name in the same folder, so the WAL they came from stays untouched.
  3. It restarts the applications that use the database, checks the credentials and takes a first base backup, which opens the window again.

Writes that had not reached the archive are lost: up to about a minute of them. The activity says up to which commit the data came back. Orbit refuses the rebuild while the database still has a primary that answers.

Backing up Orbit itself ​

Database backups do not include Orbit's own data. See Running Orbit for orbit backup and orbit restore.

Remove a destination ​

Open Backups → Destinations → Review removal. Orbit first lists the configuration, bucket and credentials it will remove, revoke or preserve. Confirm the destination's name only after reviewing that list.

Disconnect is the default. It keeps bucket contents and removes the Orbit configuration. For an R2 destination, Orbit also revokes its verified dedicated key; other provider credentials are preserved and may need separate revocation in the provider dashboard.

Remove resources created by Orbit can delete an R2 bucket only when its recorded creation identity still matches and the entire bucket is empty, including unfinished multipart uploads. It never bulk-deletes backup data. Existing buckets, changed resources and destinations from versions without ownership evidence are preserved. A matching name alone does not establish ownership.

A destination cannot be removed while any backup policy references it, even a disabled policy, or while retained backup metadata references it. Change those policies and review retained backups first. A setup operation in progress also blocks removal.

Removal runs as an operation. If a provider refuses a step, use Retry in the operation tracker after correcting access. Orbit retains its progress and necessary credentials until cleanup finishes. It rechecks ownership before retrying a destructive step and accepts a resource already removed by a previous attempt. A removal already started cannot be cancelled or changed to another mode.

Orbit by Cortex Labs