Skip to content

Storage and backups ​

What to back up ​

All state is in three places, and they belong together:

WhatWhere (default, all in the /data volume)
The database (plus its -wal and -shm)DATABASE_PATH
File contentsFILES_PATH (files/ beside the database), or the S3 bucket
Installed plugins and their databasesHC_PLUGINS_DIR (plugins/ beside the database)

Also keep CALDAV_SECRET and your compose file or .env with the backup. Without the same secret, linked CalDAV/CardDAV accounts have to be reconnected and two-factor users have to sign in with a recovery code.

File contents are written once and never changed, and unreferenced contents are kept for a day before deletion. So a database snapshot plus a copy of the files taken on the same day always match.

HyperCloud does not copy anything off the host. Getting backups somewhere else is up to you.

Backups ​

Automatic. Every day the server writes a full database snapshot to backups/_db/hyper-calendar-<timestamp>.sqlite (14 kept, DB_BACKUP_KEEP), with the plugins beside it. Each snapshot is integrity-checked when it is taken. Accounts with Files are backed up into their own Files (below). For accounts without Files the server writes a daily .hypercalendar snapshot instead (30 kept, BACKUP_KEEP_DAYS), listed under Settings → Data too.

Into each account's Files. Every app's data (except Files') goes as ordinary files into a new folder of the account's own Files: .ics, .csv and .vcf for other apps, a .json per app and the whole account's .hypercalendar for restoring, a README. People choose under Settings → Data how often (default weekly), how many to keep (default 4), which apps and which folder (default /Backups); see Backups and export. The hourly backup job runs those that are due. The first is spread over a day per account, so an upgrade does not back up everyone at once, and each account is told once that its backups are on.

  • A backup counts against the account's storage limit (Settings → Apps), checked before anything is written. A full account's backup fails and keeps the old ones.
  • A backup is written whole or not at all. Older automatic ones are deleted only after a new one succeeds; a backup folder someone renamed or moved is theirs and stays.
  • A folder others can see (shared, in a share, or under a public link) is refused, so a backup never reaches anyone else.
  • A failure notifies the account, grouped, and is tried again sooner, backing off. A backup cut off by a restart is marked failed at the next start.
  • They leave out attachments and other files, passwords, tokens and DAV credentials. Private calendars stay encrypted.
  • They live on the same host as the data. They protect against mistakes (deleted events, a bad import), not against losing the host: keep the snapshots below off the host too.

Turning backups off for an account also stops its daily disk copy. Backups written to disk before an account had Files stay listed and restorable until BACKUP_KEEP_DAYS ages them out.

On demand. Settings → Maintenance takes and downloads a snapshot. Or from the API, as an admin:

bash
curl -X POST https://your-host/api/admin/db-backups        # take one now
curl        https://your-host/api/admin/db-backups         # list
curl -OJ    https://your-host/api/admin/db-backups/<name>  # download

Into an admin's Files. An admin who has Files can turn on Settings → Maintenance → Copy snapshots to my Files. It is off by default and each admin decides for themselves. The scheduled snapshots, with the plugins' files, then also go into Backups/Instance in that admin's Files. The newest 2 are kept (a copy that was renamed, moved or added to stays), and they count against the admin's storage. A copy holds every account's data and password hashes: whoever can read those Files can read it, synced devices and apps included. Copies stop when the admin loses the role or is deactivated; those already made stay in their Files.

Taking a snapshot is safe while the server runs.

Continuous. For less than a day of loss, stream the database to S3 with Litestream and copy FILES_PATH with rclone sync or any incremental backup.

Instance settings. Settings → Instance → Export instance settings saves the admin switches as a file you can import on another instance.

Restore ​

Stop the container, remove the stale -wal and -shm files (SQLite would replay them over the snapshot), copy the snapshot in, and start again:

bash
docker compose stop hyper-calendar
docker compose run --rm --no-deps --entrypoint rm hyper-calendar \
  -f /data/hyper-calendar.db-wal /data/hyper-calendar.db-shm
docker compose cp ./backup.sqlite hyper-calendar:/data/hyper-calendar.db
docker compose start hyper-calendar

With plugins, also replace /data/plugins with the snapshot's <name>.plugins/ directory while the server is stopped.

Sync clients notice a restored server and merge instead of deleting, so a file the server lost is uploaded again from a device that still has it.

S3-compatible bucket ​

File contents can live in AWS S3, Garage, MinIO or any S3-compatible service instead of on disk. The database stays local.

VariableDefaultPurpose
FILES_S3_BUCKETunsetThe bucket. Setting it switches the store
FILES_S3_ENDPOINTAWSThe S3 API address, e.g. http://garage:3900
FILES_S3_REGIONus-east-1The region the endpoint expects (Garage: usually garage)
FILES_S3_ACCESS_KEY_IDunsetThe key; without it the usual AWS_* variables are used
FILES_S3_SECRET_ACCESS_KEYunsetIts secret
FILES_S3_PREFIXnoneKey prefix, for a shared bucket
FILES_S3_VIRTUAL_HOSTED01 for bucket.host/key addressing

The server checks the bucket at start and stops with the reason if it cannot use it. FILES_PATH is still used to stage uploads, so give it room for the largest uploads running at once. Back up the bucket with its versioning or replication, alongside the database snapshots.

To move existing files into a bucket, copy them while the server runs, then stop it, copy the rest and verify, and start it with the FILES_S3_* variables set:

bash
docker compose exec -e FILES_S3_BUCKET=... -e FILES_S3_ENDPOINT=... \
  hyper-calendar hc-server blobs migrate
docker compose stop hyper-calendar
docker compose run --rm hyper-calendar hc-server blobs migrate --verify
docker compose up -d hyper-calendar

Files app settings ​

Settings → Apps sets the storage limit per account (files, trash and versions count). Settings → Groups manages the groups people can share with.

Identical files are stored once. If text search missed files, for example after the storage was unreachable, read them again:

bash
docker compose exec hyper-calendar hc-server files reread --failed