Cloudverg Console
PricingDocsSign in
Docs menu

VergKeep

How VergKeep backs up your data

VergKeep backs up PostgreSQL databases and folders of files from one of your machines to two or more other machines of yours. The machine that holds the data, the source, encrypts every backup before it leaves, with a key only it holds. The machines that keep the copies, the stores, receive ciphertext over the private network of VergMesh and never see your data or your key. The console holds names, schedules and what each machine reports, and never a key.

It runs on Linux nodes. A Mac, a phone or a node set up by hand cannot be a source or a store in this version, and the console says so when you try.

Set one up

  1. Join the machines to a VergMesh network.
  2. Under VergKeep, make an item: pick the machine, what to back up (the PostgreSQL databases of a server on the machine or in a Docker container, or one folder), how often, and the stores in order. Two stores is the point.
  3. Each machine picks it up at its next report, within a minute. It installs the backup tools, makes its key, and the first backup runs.
  4. On the source, run sudo verg-agent keep key and keep what it prints. See the next section.

The recovery key

Everything is encrypted with a key that is made on the source machine, stored there with access for root only, and never sent anywhere. We cannot read your backups and we cannot recover a key. If the source is lost and the key was never saved, the backups cannot be read by anyone.

So the item page shows a red card until you have saved it. Run this on the source:

sudo verg-agent keep key

It prints the key and how to restore with it, and asks you to type saved. From then on the machine reports the key as saved and the card turns green. Keep the key in a password manager or a safe place that is not on the same machine. The console only ever learns a short id of the key, so you can tell keys apart.

What a source does

  • PostgreSQL. Each database is dumped by the database's own user, never by root, with pg_dump in custom format, and streamed into the encrypted repository, so unchanged data is stored once from day to day. The roles come with it as globals.sql unless you turn that off. A server in a Docker container is reached with docker exec as its postgres user.
  • Folders. The folder is read and stored, staying on one filesystem, with symbolic links kept as links. Nothing in it is ever run. Patterns you list are left out.
  • Copies. The first store that answers gets the backup. Every other store gets the same snapshots copied from it. A store that was down catches up on the next run.
  • Keeping. By default the latest 3, 7 daily, 4 weekly and 6 monthly backups. The machine never keeps fewer than 3 latest and 7 daily whatever it is told, and an item that disappears from the console deletes nothing.
  • Weekly. Unused data is removed once a week and a sample of each repository is read back and verified.
  • Load. One backup job runs on a machine at a time, at the lowest priority for the processor and the disk.

The firewall

For each store the console adds one rule to the firewall of VergShield: the machines whose items it keeps may connect to the store's port (9520 to 9619, one for each store of a network). Where VergShield enforces a policy on the store, every other machine is turned away at the firewall. Without a policy the firewall does not filter, and the store still listens only on its private address, so every connection needs the login of a source. A machine that is neither a source nor a store gets nothing new. If the store has another firewall of its own, such as ufw, let the private network through it (ufw allow in on verg0).

The deletion hold

A source must be able to delete old backups, so a source that someone took over could delete its own. Each store therefore keeps, once a day, a hard-linked copy of every repository in /srv/verg-keep/hold/<date>/<source node id>, readable by root only and outside what the storage service serves, for 7 days. It costs almost no space until old data is removed. To restore from a hold copy, point plain restic at that folder.

Restore tests

A backup is only a backup once it has been restored. A restore test asks the source to bring one store's copy back into a throwaway place, never your live data: for PostgreSQL a temporary server with its own folder that listens on a socket only (or a Docker container with no network, from the same image), for a folder a fresh folder that only root can read. It counts tables and rows, or files and bytes, compares them with what was backed up, and removes everything. It refuses when there is not twice the free space it needs and stops after 60 minutes.

It runs by itself every week by default, one store after another so every copy is tested over time, and you can press Test restore on the item. Each result is listed with its date. A failed test is an incident.

Getting your data back

Real restores are commands you run yourself, on purpose: the console never writes over live data, and the agent never restores over an existing database or into a folder that already has files.

sudo verg-agent keep restore <item id> [--db NAME | --path SUBDIR] [--snapshot ID] --to <new database or empty folder>

If the source is gone, run this on any store. It asks for the saved key and reads the repository on that disk, with no console and no network:

sudo verg-agent keep restore --store <source node id> <item id> [--db NAME | --path SUBDIR] [--snapshot ID] --to <new database or empty folder>

Without Cloudverg

A repository is a standard restic repository, so your backups can be read with plain restic even if Cloudverg is gone. On a store, with the saved key in a file (the repository is named after the source node):

restic -r /srv/verg-keep/repos/<source node id> -p /path/to/key snapshots
restic -r /srv/verg-keep/repos/<source node id> -p /path/to/key restore latest --tag item:<item id> --target /srv/restored
restic -r /srv/verg-keep/repos/<source node id> -p /path/to/key dump latest /postgres/<database>.dump --tag item:<item id>,db:<database> | pg_restore --no-owner -d <new database>
restic -r /srv/verg-keep/repos/<source node id> -p /path/to/key dump latest /postgres/globals.sql --tag item:<item id> | psql

A hold copy is the same, one folder deeper: -r /srv/verg-keep/hold/<date>/<source node id>. Restore into a new database or an empty folder, look at it, and only then move it into place.

Alerts

Problems are VergMind incidents, one for each item and check, and they close by themselves when the problem is gone. The alert kind is A backup of a database or folder is late, failed or did not restore. An all-monitors maintenance window holds them.

CheckOpens whenLevel
No new backupNo store has a new backup after the schedule and half of it again, and at least an hour moreWarning, a problem after three times that
The last backup failedThe machine reports an error for its last runWarning
Fewer than two fresh copiesAn item with two or more stores has a fresh backup on fewer than two of them (fresh is within two schedules and an hour)Warning
Restore testThe last restore test failed, or none passed in the test interval and two more daysWarning
A storeA store has not answered for 30 minutes, or is nearly out of spaceWarning

VergProof

The control Databases and folders are backed up to two or more places, encrypted, and restore tested is met when every item has fresh copies on two stores, its recovery key saved, and a restore test that passed in the last 30 days. It is partly met when everything but the restore test is in place, and not met when an item is in one place only or its key was never saved. With no item it does not apply. It gives evidence for SOC 2 A1.2 and A1.3, ISO/IEC 27001:2022 A.8.13, HIPAA 164.308(a)(7)(ii)(A) and (D), CIS Controls 11.2, 11.3 and 11.5, and NIST CSF 2.0 PR.DS-11.

What it does not cover

  • Whole machine images. Rebuild a node and restore your databases and folders onto it.
  • Git repositories. VergVault keeps those.
  • Other databases than PostgreSQL, and point-in-time restore of PostgreSQL, in this version. Each backup is a dump taken at one moment.
  • Secrets, except as files inside a folder you choose. They are encrypted like everything else.

Plans

Free: 1 backup item. Starter: 5 backup items. Team: 25 backup items. Business: 200 backup items. A plan that ends never stops backing up what exists: it only refuses a new item over the limit. Stores and the copies on them are not counted.

API

All calls need a workspace key. Reads need a read key; changes need a read and write key and accept an Idempotency-Key header, so a retry never makes a second item. An item is addressed by its id or its name.

curl -s -X POST https://api.cloudverg.com/v1/keep/items \
  -H "Authorization: Bearer $VERG_API_KEY" -H "Idempotency-Key: $(uuidgen)" -H "Content-Type: application/json" \
  -d '{"name":"Orders database","node":"db-1","kind":"postgres","databases":["orders"],"stores":["backup-1","backup-2"]}'
curl -s -X POST https://api.cloudverg.com/v1/keep/items/orders-database/drill \
  -H "Authorization: Bearer $VERG_API_KEY" -H "Content-Type: application/json" -d '{"store":"backup-2"}'
GET    /v1/keep/items                         list
POST   /v1/keep/items                         make one
GET    /v1/keep/items/{item}                  copies on each store, restore tests, restore commands
PATCH  /v1/keep/items/{item}                  name, enabled, what to back up, schedule, retention, stores
DELETE /v1/keep/items/{item}                  remove it from the console; the copies stay on the stores
POST   /v1/keep/items/{item}/run              back up now
POST   /v1/keep/items/{item}/drill            {store?} test a restore
GET    /v1/keep/items/{item}/runs             restore tests
GET    /v1/keep/stores                        stores with their space
POST   /v1/keep/stores                        {node, port?, path?} make a node a store
PATCH  /v1/keep/stores/{node}                 {port?, path?}
DELETE /v1/keep/stores/{node}                 stop using it as a store; its backups stay
GET    /v1/keep/health

The tools

The agent installs two open source tools, restic (0.20.0) for the encrypted repository and rest-server (0.15.0) on the stores, as static binaries of fixed versions. The console serves them from https://api.cloudverg.com/dl/keep/, so your machines need no access to GitHub, and each is checked against a SHA-256 written into the agent itself, so a console that was taken over cannot swap one.