Running apps
Backups
Back volumes, and the cluster itself, up to any S3-compatible bucket, encrypted, incremental and on a schedule, and get them back automatically when a server dies.
Volumes back up to any S3-compatible bucket: Tigris, AWS S3, Cloudflare R2, Backblaze B2 and the like. Add the bucket once, as a destination, then say which volumes go there. From then on they're backed up every 15 minutes, and if their server dies, they come back on another one by themselves.
1Add a destination#
The secret key is asked for, or read from stdin. Add --region if your provider needs one.
Your first destination also starts backing up the cluster itself every hour.
2Save the encryption key#
Backups are encrypted with a key Jokku makes the first time you add a destination. Jokku shows it once and asks you to confirm you saved it, by typing its last six characters.
To store a destination's backups unencrypted instead, pass --no-encrypt to backups:destination-add.
3Choose what to back up#
backups:set takes an optional path as a last argument, for a different place in the bucket. Or open jokku top, press 7, pick a volume and press space.
Schedules and retention#
Every volume is backed up every 15 minutes, keeping every backup from the last 24 hours and the last one of each day for 30 days. Change that with backups:set:
Running backups:set again without them keeps the schedule you have.
After each backup, the backups the schedule no longer keeps are deleted, and every few hours so are the blocks no remaining backup uses. A failed backup is tried again after five minutes. Scheduled backups don't fill jokku events: you'll see one when backups start failing, and another when they work again.
How backups work#
- Complete, but incremental. Each backup is complete on its own, but only uploads what changed since the previous one, so a backup every 15 minutes costs little. The disk is read in blocks, and a block already in the bucket is never uploaded again.
- The app keeps running. Its writes to the volume pause for a moment at the end, usually a few milliseconds, so the backup is the disk as it was at one instant, the way a power cut would leave it. Databases recover from that the same way they do after a crash.
- Straight from the disk. The server holding the volume uploads to the bucket itself, a couple of volumes at a time.
- Encrypted before it leaves. Blocks are compressed and encrypted on your server, and named so that their names give nothing away. A changed or damaged block is caught when it's restored.
When a server dies#
Once a server has been gone for five minutes, each backed-up volume on it is restored onto another server from its latest backup, and its app starts there. Anything written after that backup is lost, unless the server comes back.
If it does come back, it keeps its copy of the disk aside, never using it again, so you can still get at those last writes. storage:report shows where it is, and you delete it with:
A volume whose disk goes missing on a server that's up is restored in place, the same way.
To have a volume wait for its server instead, as it does without backups:
Restore#
The current data is backed up first, so a restore can be undone; --skip-backup skips that. The backup downloads while the app runs, then the app restarts with the restored disk.
The cluster itself#
Your first destination also backs up the control server every hour: its database (apps, config vars, domains, settings and the backup key), its identity, and the images of each app's three most recent releases.
To rebuild a lost control server, install Jokku on a new server with the same name and, so the other servers reconnect, the same address. Then:
It checks the backup is this server's, downloads the release images, puts the cluster's state in place (keeping the server's own aside) and restarts Jokku. Apps start again from their releases, without a new deploy, and volumes come back from their own backups. Remove servers that are gone for good with jokku nodes:remove <name> --force, so their volumes come back elsewhere.
See it all#
In jokku top, press 7 for a view of everything that is, and isn't, backed up: every volume and the cluster, when each was last backed up and is next, a chart of recent backups, and what they keep. From there, space turns a volume's backups on or off, b backs it up now, s changes how often and a turns automatic restore on or off.
On the command line:
Removing a destination, or unsetting a volume, leaves its backups in the bucket.