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.
Before you begin
Section titled “Before you begin”- 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.
Back up
Section titled “Back up”barry db backupBarry 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:
barry db backup ~/Backups/barryThe 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.
Restore a backup
Section titled “Restore a backup”barry db restore ~/Backups/barryBarry 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:
bonanza vault restore ~/Backups/barry/vault.db.ageRoll back one generation
Section titled “Roll back one generation”To make the store generation that was active before this one active again:
barry db rollbackBarry 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.
Finish an interrupted switch
Section titled “Finish an interrupted switch”When a restore, rollback, or upgrade stops partway through a generation switch, finish it:
barry db recoverIt finishes the switch, or undoes it when it cannot finish, and tells you
which. Start any services it leaves stopped with barry up.
Free space
Section titled “Free space”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:
barry db pruneIt lists what it keeps and what it removes, with sizes, before you confirm.
Verify
Section titled “Verify”barry store listbarry store verify --deepstore 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.
If it fails
Section titled “If it fails”- The restore says the backup has no stores folder. The backup predates
store generations. Follow the
RESTORE.mdinside it instead. - The backup is from a different installation. Restore into a fresh
BARRY_HOME, or add--replace-installationto make this home the backup’s installation. - The home keeps its stores on the legacy layout. Restore into a fresh
BARRY_HOMEinstead. - 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.