Self-hosting · Backups and restores

Self-hosting · Keeping it running

Backups and restores

What a backup holds, where to keep it, and how to get your data back, on this server or a rebuilt one.

Taking a backup

You run the backups. We have no access to your server or its data.

sudo subd backup          # every database, dumped and checked
sudo subd backup --list   # the backups this machine holds

A backup stops Subduction for the minute or so it takes, then starts it again. Backups are written under /var/lib/subd/state/backups/.

Copy your backups somewhere off the machine. A backup on the same disk does not survive losing the disk.

An update takes a backup of its own before it changes anything; see Updating.

Restoring

sudo subd restore <backup>

returns the data to one of your backups, as long as it was taken under the version running now. After an update, sudo subd rollback is the way back to the backup the update took.

Each backup also records the keys and the sign-in it was taken under. If this machine's secrets file or Clerk application is not the one a backup needs, restore changes nothing and says what to do.

The secrets file

Back up /var/lib/subd/secrets.env too, separately, and keep it as secret as the data. It holds the keys that encrypt the connection credentials and model keys stored in Subduction.

If the machine is rebuilt without it, every stored credential and model key is lost, even with the data restored: Subduction will then not come up, and sudo subd doctor says how many stored credentials cannot be read.

With the copy, put its keys back in place of the new machine's, then start again:

sudo sed -n "s/^RIDGE_SECRETS_KEYS='\(.*\)'\$/\1/p" /path/to/the/copy/secrets.env \
  | sudo subd secret set RIDGE_SECRETS_KEYS
sudo subd up

subd takes the old keys only while the new machine's own key opens none of the stored credentials, which holds once the old data is back or before anything has been entered; otherwise it refuses and says why. It stops Subduction while it changes the keys, and sudo subd up starts it again.

If no copy of the file exists, sudo subd forget-unreadable removes those credentials so Subduction can start. It says how many it would remove and asks you to run it again with that number; then run sudo subd up. Model keys are then entered again under Admin › AI Management, and integrations reconnected.

Forgetting cannot be undone. Look for the copy first.

A rebuilt server at a new address

Move the DNS record to it too. sudo subd doctor checks that the name resolves and shows the address, but cannot tell whether that address is this server.