Backups and restore
Secretbase backs up every app by itself, every night. Add a second place for the copies, keep the recovery key, and you can put an app back, here or on a new computer.
Quick start
secretbase open) and go to Settings, Backups.What is in a backup, and when
Each backup holds one app: its /data folder, its Postgres and Redis while they are on, a Backend app's stored files, its keys, its settings and its live release. It is encrypted on this computer before it is written anywhere.
Backups run every night at 3 AM (or soon after the computer starts, if it was off), before a publish replaces a running app, and before every restore. secretbase backup my-app, or Back up now on the app's Backups tab, makes one at once.
This computer keeps the last 3 backups of each app. Your other places keep a week of daily copies and a month of weekly ones.
Places
Each app's Backups tab, and secretbase backups my-app, show what it is protected against and the next step that fixes the first gap:
$ secretbase backups my-app Protected against: deleted by mistake ✓ · disk dies ✗ · machine dies ✗ · house fire or theft ✗ … Next step: Add a USB drive or another disk (`secretbase places add <folder>` or `secretbase places add-bucket`). …
- Deleted by mistake: a copy on this computer is enough.
- Disk dies: a copy on a USB drive or another disk.
- Machine dies: a copy in a storage bucket you own, or on another machine you paired.
- House fire or theft: a copy in a storage bucket, or on a paired machine in another building.
In Settings, Backups, click Add a place, or use the commands secretbase places shows. A bucket is any S3-compatible storage; places add-bucket asks for its secret, which never goes on the command line. Several machines shows how to pair a machine.
$ secretbase places computer This computer <folder> <n> GB free Add a USB drive or another disk with: secretbase places add <folder> Add a storage bucket you own with: secretbase places add-bucket Keep copies on a machine you paired with: secretbase places add-machine <name>
secretbase places remove <id> stops using one. A drive is added on the computer itself; a bucket or a paired machine can also be added from a laptop (--to home).
The recovery key
secretbase recovery-key shows the key that opens your backups, on the computer itself only. Without it nobody, not even you, can open them. Keep it in a password manager or on paper.
Restore an app
On the app's Backups tab, click Restore next to a backup. In a terminal:
$ secretbase backup my-app Backing up my-app… Backed up my-app. `secretbase backups my-app` lists its backups. $ secretbase backups my-app … Backups of my-app: <time> backed up now This computer <size> <backup id> $ secretbase restore my-app --yes Restoring my-app (its current data is backed up first)… Restored my-app from <time>. Live at <address> (the same address).
restore puts back the newest backup; --backup <id> picks another from the list. The app's data, database, keys and release come back, and its address stays the same. Its current data is backed up first, so you can undo a restore by restoring that one. From a laptop, add --to home.
The nightly check
Every night, and when you click Check now, Secretbase opens the newest backup of each app, checks every file, loads its database and starts the app from it, out of sight. The Backups tab then says "Your backup works", or what went wrong. In a terminal:
$ secretbase backups check my-app Checking my-app's newest backups… Your backup works (checked <time>; copy from <time> at This computer).
Bring apps back onto a new computer
secretbase recovery-key enter, or Settings, Backups, Bring back an app from another computer, Use this key.secretbase restore --list, then the secretbase restore --from <backup id> line it shows. Or click Bring back next to the app.The app comes back with its data, database, keys, release and settings, at the new computer's address. To change it later, publish its folder again with secretbase publish <folder> --name <name>, as the user who installed Secretbase there: until then the app is theirs.
When you delete an app
Its backups stay, so you can still bring it back. To remove them too: secretbase backups remove <app>.
If something goes wrong
- "That folder is on the same disk as your apps": pick a USB drive or another disk.
- "The storage bucket refused the sign-in": check the access key and secret.
- A place can't be reached (a drive unplugged): backups still go to your other places.
- "didn't start from its backup" (HB-BACKUP-004): the checked copy starts with no internet access, so an app that needs an outside service to start fails the check even when its files are fine.
- "Enter the recovery key of the computer that made it": run
secretbase recovery-key enterwith that computer's key. - Undo doesn't put a database back: restore the app's "Before an update" backup.