berth

Backups and restore

How backups work in Berth

Places say where backups go, schedules say what, when and how long; safety rules stop you from pruning or switching off your last good copies.

Updated 9 min readbackup · backups · retention · schedule · restic · encryptionView as Markdown

On this page
  1. Places and schedules
  2. Kinds of places
  3. What is in a backup
  4. When schedules run
  5. Presets
  6. Safety rules
  7. Does all customer data actually leave the server?
  8. Alerts
  9. Deleted subscriptions
  10. What customers see
  11. Where to go next

Berth backs up every subscription (websites, mail, databases and container volumes) and the server's own settings, keeps an hourly deduplicated history on the server, and copies everything off the server in encrypted form. This article explains the model behind it: places and schedules, what goes into a backup, the presets, and the safety rules that keep you from losing your last good copy by accident.

Places and schedules

Two ideas cover everything:

  • A place is where backups are stored and how Berth reaches them. A place holds no retention policy of its own.
  • A schedule is what is backed up, when, to which single place, how long it is kept and how often a restore test runs.

You manage them under Backups → Places and Backups → Schedules, or with berth backup location and berth backup schedule.

A schedule always writes to exactly one place. Sending the same data to two places means two schedules. That costs no double work: schedules that are due in the same round share it. A schedule for loose S3 archives, for example, uploads the archive that a local schedule has just made for the same subscription instead of building its own.

Every archive and snapshot carries the mark of the schedule that made it, and a schedule only ever prunes its own data. An hourly database schedule therefore never pushes your nightly full archives out.

Kinds of places

PlaceLabel in the panelFormRetention counted in
This server, archivesArchives on this serverone .tar.gz per subscriptionnumber of archives
This server, historyHistory on this servera restic repository per subscriptionhourly / daily / weekly / monthly
External, deduplicatedExternal: snapshots, encrypted and deduplicatedrestic on S3, Backblaze B2, SFTP, a REST server, your NAS, Azure Blob Storage, Google Cloud Storage or a mounted pathhourly / daily / weekly / monthly
External, loose archivesExternal: loose archives (S3)each archive as an object in a bucketnumber of archives

The two places on this server always exist and cannot be removed (you can switch them off). External places you add yourself:

Each place carries a jurisdiction: EU or outside the EU. For known providers Berth derives it from the address and region. The label shows up in the panel, in reports and for customers, which helps with GDPR and BIO questions (see GDPR).

Deduplicated external places are the recommended route. They copy straight from the sources (webspace, Maildirs, database dumps) to the repository, one snapshot per subscription. Only what changed travels over the line, so off-site copies every hour or even every 15 minutes are realistic. Loose S3 archives have their own strengths: anyone with the bucket and archive key can read them without Berth, and any Berth server can fetch them.

What is in a backup

Per subscription:

  • the webspaces under /var/www/vhosts/<domain>;
  • the Maildirs, with their UIDs, so mail clients do not download everything again after a restore;
  • dumps of every MariaDB and PostgreSQL database;
  • container volumes (in archives);
  • an account manifest: domains, settings, password hashes, DKIM keys, FTP accounts, cron jobs.

A schedule can narrow this to files, databases or mail. Such partial archives restore content, but not a whole account.

Server settings, when a schedule includes them (also the server settings): the panel database with all users and PostgreSQL roles, the panel configuration and certificates, the key that unlocks sealed secrets, and the DNSSEC and TSIG keys. Server settings only go to deduplicated places, never as loose objects in a bucket, because the panel database holds password hashes. They are what makes a full disaster recovery possible.

Managed services that Berth installs for you have their own backups under System → Service backups.

When schedules run

A schedule can run every 15, 20 or 30 minutes (deduplicated places only), every 1–24 hours at a fixed minute, daily, weekly or monthly. A timer checks every few minutes which schedules are due. In one round the local history runs first (an hourly moment should not wait for a long archive), then local archives, then loose S3 archives, then external deduplicated places.

A running schedule shows in the task bar at the top of the page with its progress. Stop finishes the subscription it is working on and then stops; the rest follows at the next run. berth backup schedule run <id> runs one now; berth backup run --schedules runs every enabled schedule.

All heavy backup work runs at the lowest CPU and IO priority, so sites stay responsive.

Presets

If you do not want to design schedules yourself, apply a preset under Backups → Schedules → Presets. Each one shows an estimate of the disk space it needs on this server before you apply it.

PresetArchives on this server (nightly)History on this server (hourly)External (nightly)
Mostly external1 night48 hours7 days, 4 weeks, 6 months
Balanced3 nights48 hours, 7 days, 4 weeks7 days, 4 weeks, 6 months
Mostly local7 nights48 hours, 14 days, 8 weeks, 6 months7 days, 4 weeks, 6 months
berth backup preset list
berth backup preset apply evenwichtig --dry-run   # calculate only
berth backup preset apply evenwichtig

Mostly external needs a working external place first (see the safety rules below).

Safety rules

Berth refuses or questions changes that would leave you without a usable copy:

  1. Short local retention only with a working external copy. A local archive schedule that keeps fewer than three archives is refused unless an enabled external place had a recent successful run.
  2. Never prune what is not off the server yet. While an external place exists, the newest three local archives of a subscription stay until a newer external backup of that subscription has succeeded.
  3. A schedule that keeps nothing is refused.
  4. Pruning waits for restores and checks. While a restore test, a check or a restore uses a place, a run only marks old snapshots and postpones the actual cleanup to the next run.
  5. A place in use cannot be removed, a schedule cannot switch to another place, and the two places on this server cannot be removed.
  6. Switching off is allowed, with a warning when no backup would be made anywhere afterwards.

Removing a schedule leaves its backups where they are. Removing a place only removes Berth's access; the data at the provider stays.

Does all customer data actually leave the server?

An external copy that reports "succeeded" every night does not prove that websites, mail and databases are in it. Berth therefore checks per subscription whether customer data goes to a place off the server, through any of these routes:

  • a schedule straight to an external place (or loose archives to S3) that includes the subscription;
  • a copy of the local archives to an external place, plus a schedule that makes those archives;
  • a copy of the local history, plus the history schedule for that subscription.

If an external run contained no customer data, it is marked without customer data instead of succeeded, with the number of subscriptions it did contain. A banner on Places and Schedules explains why and offers a button to create a direct schedule, and berth doctor reports it as backup-external.

When you remove or switch off a schedule, a place or the history copy, and that would leave subscriptions without an off-site copy, Berth first names those subscriptions and asks for confirmation (--confirm on the CLI, confirm: true in the API). The confirmation is recorded in the audit trail.

Alerts

Backups report through the normal notification channels:

  • No recent backup when backups stop happening;
  • External copy without (all) customer data, critical when the missing data is not in the local history either;
  • Restore test failed, see Restore tests;
  • failed or partial runs, NAS cleanup that stopped working, and S3 buckets whose lifecycle rule is missing or too short.

A disk guard refuses a new archive when free space would drop too low and skips a history round with a notice, so backups never fill the disk and stop MariaDB or mail. For a server that cannot report anything because it is down, set up a heartbeat to an external monitor (see Notifications and alerts).

Deleted subscriptions

When a subscription is deleted, its archives and history are kept apart under Backups as Archives and history of deleted subscriptions, by default for 30 days. Administrators get a notice a week and a day before they are wiped. Pin keeps them indefinitely, for a dispute or a customer who comes back. A new subscription with the same system user always starts empty and never sees the old data.

What customers see

Customers, resellers and restricted logins with the backup right see only their own subscriptions, and for each place only the name the administrator gave it, whether it is in the EU and when the last copy arrived. No paths, buckets, providers or snapshot IDs. They can browse, download and restore their own data.

Customer-owned storage

You can allow customers to send backups of their subscription to their own S3 storage, with their own schedule, alongside yours. It is off by default; switch it on per package or per subscription under Backups → Customers' own storage, or with berth backup own allow on --plan <package>.

The customer then sets it up on the domain's Backups page under Own storage: provider and region (the same EU list as the wizard, or their own address), bucket, schedule (daily, weekly or every 6, 8 or 12 hours), what to include, how long to keep and an optional upload limit. Berth creates an encrypted restic repository and shows its password once. The traffic counts toward the package's monthly traffic, the work runs at the lowest priority and backs off when the server is busy, and the network is fenced so the job can only reach that one storage address.

The customer's own OpenPGP key

A customer who requires that only they can read their backups sets a public OpenPGP key on the domain's Backups page (Own key), or you do it with berth backup key --sysuser acme --set public-key.asc. Every new archive is then encrypted to that key, including the copies off the server. Nobody else, including you, can open or restore those archives. To restore, the customer downloads the archive, decrypts it with gpg --decrypt and uploads it again.

The hourly history is encrypted with a server key, so it is off by default for such subscriptions and can be switched on deliberately.

Where to go next