Disaster recovery

Keep the secret, database backup, and recovery keys needed to restore Deplo.

Keep these three things

In order of how badly you want them.

1. DEPLO_SECRET

It lives in /opt/deplo/.env on the machine Deplo runs on.

Every secret this instance holds derives from it

Encryption keys, session signatures and the server agents' certificate authority all derive from DEPLO_SECRET. Lose it and every stored secret is unreadable: variables, database passwords, S3 keys, registry and git credentials. Deplo still starts, and opens nothing.

Copy the whole .env into a password manager today. It cannot be rotated: treat it as permanent.

2. The Postgres database

Every app, team, domain, role, token, deployment record and encrypted secret is a row in it.

docker compose -f /opt/deplo/docker-compose.yml --env-file /opt/deplo/.env \
  exec -T postgres pg_dump -U deplo deplo | gzip > deplo-$(date +%F).sql.gz

Keep the dumps off that machine. Each update also leaves one in /opt/deplo/backups, on the same disk.

3. Backup recovery keys

Each backup destination has one, and it decrypts that destination's artifacts. Deplo's own copy is encrypted with DEPLO_SECRET, so it is no help once both are gone.

Take each one with Download recovery key in the destination's menu, and keep it with the secret. With it, any artifact reads anywhere:

age -d -i recovery-key.txt backup.sql.gz.age > backup.sql.gz

Your apps' data

That's what backups are for. Two rules:

  • A backup on the same server survives everything except losing that server, which is the failure people actually have. Send one copy to a bucket or a backups-only server.
  • An app's schedule does not include its databases. Schedule both.

If the control-plane machine is lost

Is the old machine still running?

Then use Move Deplo instead: no shell, no copying DEPLO_SECRET, and the old Deplo keeps running until you switch. This section is for when it is gone.

Your apps keep serving: Traefik and your containers live on the servers and don't need the panel. You lose deploying, logs, metrics and the dashboard until you come back:

Install Deplo on a new machine

curl -fsSL https://deplo.build/install.sh | bash

Stop it, and restore the secret

Put the old DEPLO_SECRET into /opt/deplo/.env.

Restore the database, then start it

Restore the dump into the new instance's Postgres. Migrations apply at boot.

Point the panel's domain at the new machine

Your servers connect to the panel's address, so change its DNS record to the new IP, then check Settings -> Deplo -> General -> Panel address. They trust the restored panel, because their certificate authority derives from the same secret. A panel with no domain of its own has a new generated address: re-enroll each server from its Advanced tab, Install command.

Re-enroll this machine's own server

Its agent enrolled under the fresh install's secret, so it does not trust the restored one. It shows under Settings -> Servers as Provisioning: open it, Advanced -> Show install command, and run that command on this machine.

Re-point webhooks

Any git webhook that names the old address.

Order matters

Secret first, then the database. A restore under the wrong secret gives a working panel full of unreadable secrets.

If an app server is lost

  1. Add a replacement server.
  2. Recreate or move the apps onto it.
  3. Restore each app and database from its backups.
  4. Remove the dead server. It does not need the machine to answer.

Deplo pushes no images to a registry, so an app built on the lost server is rebuilt from source. Keep the source somewhere else.

A database that refuses to start with a data-copy error after a move is protecting you: an engine started on an emptied volume initializes a brand-new empty database over your data.

Test recovery before you need it

  1. Restore one backup into a scratch app or database, and check the data.
  2. Decrypt one artifact by hand with its recovery key.
  3. Open /opt/deplo/.env from wherever you filed it.

Deleting an app or database deletes its backups too. Keep a copy elsewhere for anything you could delete by mistake. See backups.

Troubleshooting

A restore fails, a backup won't decrypt, or a database won't start after a move: see Databases and backups troubleshooting.

Next steps

Did this page help you?

On this page