Skip to content
Select language:English

Backups

Every night Kept takes one restic snapshot: encrypted with a password you choose, deduplicated (a night with nothing new adds almost nothing), and sent to a place that isn’t the server’s own disk.

  • The database, dumped from one consistent moment, with a manifest of every table’s row count and a digest of its data, so a restore can prove it brought back exactly what was there.
  • The files (photos, receipts, documents), when they are stored on the server’s disk. With S3 file storage they aren’t: see below.
  • A readable copy of every location: web pages, spreadsheets, thumbnails and receipts that open in a browser with nothing but restic. See read your inventory with restic alone.

The keys are not in the backup. Keep the recovery kit somewhere else.

Target What you give The restic repository
A directory: another disk, or a NAS share mounted on the server its path, outside KEPT_DATA_DIR <directory>/restic
An S3-compatible bucket: AWS, or another provider’s S3 endpoint the endpoint, region, bucket, prefix and keys restic/ under the prefix
An SFTP server host, port, user, path, its host key, and a private key the path you give

Set one target. Prefer another machine or another site: a directory on the same disk as Kept’s data is refused, and the status page warns when the target shares a disk with it. Cloudflare R2’s S3 endpoint has been used with Kept; Backblaze B2’s is expected to work but hasn’t been tested. SFTP pins the server’s host key and connects only if it matches.

Everything is set in Admin → Backups, by an instance admin, over HTTPS, after acknowledging the recovery kit:

  1. Choose where backups go and fill in its fields.
  2. Set the password, at least 12 characters. No password, no backup: Kept never writes an unencrypted backup. Lose the password and the backup is unreadable, which is why it is in the recovery kit.
  3. Save. The backup runs every night at the time shown (UTC).
  4. Test: Kept opens the repository with the saved password, or offers to create it. A target that doesn’t answer in 45 seconds is reported, with the reason (“Couldn’t reach it”, “Wrong password”). Run now runs a backup at once.

A bucket or SFTP needs nothing else once Docker Compose runs 1.14.9’s compose.yaml; Helm needs nothing. A directory needs that disk mounted on the container first (below), since Kept can only write where the container can see.

  • The settings are stored in Kept’s database. The password, the bucket’s secret key and the SFTP private key are encrypted with Kept’s secret key before they are stored, and are never sent back to the browser: the page shows “Saved, never shown again” and a Replace button.
  • They are never written to a log, and the audit log records that a secret changed, never its value. Like every secret in Kept, the database backup holds them still encrypted.
  • Only instance admins can open the page or change anything on it. Test is limited to 10 tries in 10 minutes per admin.
  • A change makes a downloaded recovery kit stale: download it again.

An environment variable beats the page and shows there as “Set by the server’s environment”, read-only, so an operator can fix a field in the deployment: KEPT_BACKUP_DIR, KEPT_BACKUP_S3_* or KEPT_BACKUP_SFTP* fix the target, KEPT_BACKUP_PASSWORD the password, KEPT_BACKUP_TIME and KEPT_BACKUP_KEEP_* their own fields. An install that sets them keeps working as before. See the configuration reference.

A backup dumps every table, so it runs as the database owner: the process that runs Kept’s background jobs needs KEPT_OWNER_DATABASE_URL.

  • Docker Compose: compose.yaml gives the kept service the owner login from 1.14.9, its password read-only from the kept-owner volume. With an older compose.yaml, download this version’s (upgrades); a compose.override.yaml that added the login still works and can go. An install from before 1.13.0 that keeps KEPT_DB_OWNER_PASSWORD in .env has that password in the URL instead, so it is in the kept container’s environment (docker inspect shows it).
  • Helm: backup.enabled (on by default) gives it to the pod that runs the jobs.
  • Without it, Admin → Backups says “Backups can’t run yet” and Run now waits; a backup set up anyway is an admin alert each night, not a silent gap.

Mount the disk on both kept and migrate (which takes the snapshot before an upgrade), with a compose.override.yaml next to compose.yaml:

services:
kept:
volumes:
- /mnt/backup/kept:/backups
migrate:
volumes:
- /mnt/backup/kept:/backups

Then choose Directory with the path /backups. The directory must belong to Kept’s user:

Terminal window
sudo mkdir -p /mnt/backup/kept
sudo chown 10001:10001 /mnt/backup/kept
sudo chmod 700 /mnt/backup/kept

With Helm, backup.persistence gives it a volume at /backups.

The Home Assistant app doesn’t run Kept’s own backups: Home Assistant’s backups hold Kept’s database, files and keys. Admin → Backups says so there, and offers no settings.

  • When: every night at the time set in Admin → Backups, HH:MM in UTC (default 02:30). A new time applies from the next night, with no restart; KEPT_BACKUP_TIME fixes it instead.
  • Run now runs one at once; pressing it again while that one waits or runs is refused (“A backup is already running”) rather than queued twice. A backup cut off by a restart or by running out of memory doesn’t block it; the next run marks that one interrupted.
  • On a small machine (under 4 GB, or a container limit under 4 GB) restic runs on at most two cores with a soft memory limit; GOMAXPROCS and GOMEMLIMIT in Kept’s environment (with Compose, a compose.override.yaml) override both.
  • How long they’re kept: the newest snapshot of each of the last 7 days, 4 weeks and 6 months (KEPT_BACKUP_KEEP_DAILY, _WEEKLY, _MONTHLY). The alpha’s KEPT_BACKUP_KEEP is read as the daily count for one release. Snapshots taken before an upgrade keep their last 3.
  • A suspiciously small backup (a dump under half the last good one’s size, or far fewer things, places or files) is still taken, but nothing old is removed that night and admins are alerted, so a bad night can never push the good snapshots out.

Admin → Status shows the last backup and its age, the number of snapshots, the repository’s size, the last restore drill, and the disks. Admins are alerted by mail and push when:

Alert When
Backup failed a run fails
Backup stale no good backup for 36 hours with a target set
Suspicious size a run was much smaller than the last good one
Disk space low the data disk or a directory target is 85 % full
Bucket versioning off files are in S3 and the bucket keeps no old versions
Restore drill due no restore drill for 30 days

/metrics (with KEPT_METRICS_TOKEN) adds the last good backup’s time and the disks’ use. See monitoring.

restic backs up files on disk, not objects in a bucket. With KEPT_STORAGE=s3, the snapshot holds the database, the manifest and the readable copy, and the bucket keeps the files safe itself: turn on bucket versioning (and, if your provider has it, replication to another region). Kept checks versioning on every run and alerts while it is off. The weekly check and the restore drill compare every file’s hash in the manifest with the bucket.

Backups made before restic, by the alpha (runs/ and blobs/ beside the new restic/ directory), are never written again, and stay restorable with kept admin restore --legacy <id> for one release. Delete them once a restic snapshot has passed a restore drill.