Skip to Content

Backups

Nightly encrypted snapshots of the agent's data with restic, through the Backup plugin.

The Backup plugin, which comes with Rookery, takes a restic snapshot of the agent's data every night and stores it anywhere rclone reaches: S3, Backblaze B2, SFTP and the rest. Without it, restic is installed but no destination, credentials or schedule is set up.

Set it up

Switch it on

On the host's Features tab, switch on Backups under System.

Set the repository

Set rookery_backup_repository in the profile's ansible_vars, in restic's rclone form. Edit the profile with rookery host export studio > studio.json, then rookery host import studio studio.json:

In studio's profile
{ "ansible_vars": { "rookery_backup_repository": "rclone:b2:my-bucket/studio" } }

Send the two secrets

The repository password and the rclone configuration go to the host as files:

rookery secret set backup-password
rookery secret set rclone-conf < ~/.config/rclone/rclone.conf
rookery host set studio secret.backup-password=~/.config/rookery-backup/password:0600
rookery host set studio secret.rclone-conf=~/.config/rclone/rclone.conf:0600
rookery run studio secrets

Apply

Run Apply this configuration. The schedule is switched on only when a repository is set.

Keep a copy of the repository password somewhere else. Without it the snapshots cannot be read.

Actions

ActionDoes
Back up now (backup:snapshot)Takes a snapshot and applies the retention policy; the first run creates the repository
List snapshots (backup:list)The snapshots in the repository, of this host and of others that share it
Restore a snapshot (backup:restore)Puts a snapshot's files back where they were taken from, after confirmation
Last snapshotPart of Status. When the last snapshot was taken and when the next is due
rookery run studio backup:snapshot
rookery run studio backup:restore snapshot=latest

A restore writes over files in place. Files that are not in the snapshot stay as they are. It also works on a freshly set-up host that was given the same repository and secrets.

What is in a snapshot

  • The agent's home and everything under /srv/agent
  • The host's own description: /etc/rookery and /var/lib/rookery

Left out, because they can be made again:

  • caches, such as .cache and the package caches of build tools
  • downloaded dependencies and build output: node_modules, target/debug and target/release
  • installed runtimes

The full list is /etc/rookery-backup.exclude on the host. A plugin can leave out more of its own by installing a file of patterns in /etc/rookery-backup.exclude.d.

Settings

SettingDefault
rookery_backup_repositorynone; no schedule without it
rookery_backup_schedule*-*-* 03:30:00, a systemd calendar time, with up to 30 minutes of random delay
rookery_backup_keep_daily7
rookery_backup_keep_weekly4
rookery_backup_keep_monthly6
rookery_backup_system_paths/etc/rookery and /var/lib/rookery
rookery_backup_excludethe list above

The T3 Code database needs an application-consistent copy. Stop the service or snapshot while it is idle before relying on a restore of it.

Back up Rookery itself

This page is about the agent's data on a host. On the machine that runs Rookery, back up these:

WhatWhere
The store. It has the hosts with their passwords and machines, the registries, secrets and most settings. It also has Rookery's own SSH key, the server's token and your own plugins~/.local/share/rookery/rookery.db, or the PostgreSQL database the store setting names
The key file, when the store is encrypted~/.config/rookery/store.key. Keep it apart from the database
The settings of this machine~/.config/rookery/config.json

With these, an installation can be restored on another machine. rookery host export HOST prints one host's profile, for a copy of that alone.

Copy a SQLite store with sqlite3 rookery.db ".backup copy.db", which takes a consistent copy while Rookery is running.

Edit on GitHub

Last updated on

On this page