Skip to content
WIP

This guide is a work in progress. Barry is also a work in progress.

Back up and restore Barry's stores

Use this when you want a copy of everything Barry stores, before an upgrade or a repair, or when you need to put a copy back. Barry keeps every store in SQLite, grouped into store generations. barry db backup copies the active generation and the vault. barry db restore turns a backup into a new generation, and barry db rollback returns to the one before.

  • You run the commands as the installation’s own user.
  • The disk has room for another copy of the stores. A backup, a restore, and a rollback each write one.
  • The vault is running, if you want it in the backup.
Terminal
barry db backup

Barry writes the backup to a new database-<time> folder under the backups folder in its data directory, and prints the path and every file it wrote. To choose the folder, pass it:

Terminal
barry db backup ~/Backups/barry

The backup holds every store in the active generation: peers.db, with the installation ID, the identity folders, and your workers and owners; every identity’s stores; and the workflows database. Each backup also carries a RESTORE.md that explains how to put it back, so the backup still makes sense on a machine without Barry’s source.

The vault goes in beside the stores. When Barry leaves it out, the output says SKIPPED with the reason. When BARRY_HOME names another instance, add --vault to include the machine’s vault anyway.

A backup holds data, not code. Workflow and job code comes from the installed bags, so restore onto an installation that has the same bags.

Terminal
barry db restore ~/Backups/barry

Barry snapshots the current stores and checks the backup before it stops the running user services. It then builds a new store generation from the backup, switches to it, keeps the previous generation, and restarts the same services. System services keep running throughout. The command prints the snapshot path, the new active generation, and the generation it kept.

A restore loses any work Barry accepted after you took the backup. Restored workflow runs come back blocked, so none of them repeats an effect before you check it; the workflow runbook covers resuming them. When you move Barry to a new machine, stop the old one first: restoring the stores does not stop the old machine from acting.

The vault restores on its own, from the vault.db or vault.db.age file in the backup. This stops the vault, installs the file, and starts the vault again:

Terminal
bonanza vault restore ~/Backups/barry/vault.db.age

To make the store generation that was active before this one active again:

Terminal
barry db rollback

Barry shows both generations and the writes the rollback sets aside, and asks you to confirm; --yes skips the question. It snapshots the current stores first and keeps the generation it leaves, so barry db rollback again, or a restore of that snapshot, undoes it. Services restart on the code installed now. After an upgrade migrated the stores, roll the code back first with Upgrade and roll back Barry, or the services migrate the copy forward again.

When a restore, rollback, or upgrade stops partway through a generation switch, finish it:

Terminal
barry db recover

It finishes the switch, or undoes it when it cannot finish, and tells you which. Start any services it leaves stopped with barry up.

Barry keeps the active generation and the one before it, for rollback. A successful restore, rollback, or recovery deletes older generations. To delete them on demand:

Terminal
barry db prune

It lists what it keeps and what it removes, with sizes, before you confirm.

Terminal
barry store list
barry store verify --deep

store list shows every active store with its size and migration version. store verify --deep runs the deeper SQLite integrity checks on each store and confirms its write-ahead log stays within healthy limits. Run barry doctor afterwards to check the services that came back.

  • The restore says the backup has no stores folder. The backup predates store generations. Follow the RESTORE.md inside it instead.
  • The backup is from a different installation. Restore into a fresh BARRY_HOME, or add --replace-installation to make this home the backup’s installation.
  • The home keeps its stores on the legacy layout. Restore into a fresh BARRY_HOME instead.
  • The command asks for --yes. A rollback or prune with no terminal attached needs it.
  • A store fails its integrity check. Keep the failing store and the backup path, then follow When none of that resolves it.