Skip to content

Upgrades, Backups & Recovery

This guide covers backups, disaster recovery, and safe upgrades for both FynnCloud AIO (automated) and Docker Compose / Kubernetes (manual).


FynnCloud AIO: Consistent Encrypted Backups

Section titled “FynnCloud AIO: Consistent Encrypted Backups”

AIO integrates restic directly into the supervisor so backups are encrypted client-side with AES-256, deduplicated, and crash-consistent across PostgreSQL and file blobs.

Configure backups in Administration → System → Backups (requires Step-Up verification for action backups:config):

  • local — Local path or mounted external/NFS drive inside the AIO host
  • s3 — Any S3-compatible bucket (AWS S3, Cloudflare R2, Backblaze B2, Hetzner Object Storage, MinIO, Wasabi)
  • sftp — Remote SFTP backup server (such as Hetzner Storage Box)

How Crash-Consistent Snapshots Work (backup.lock)

Section titled “How Crash-Consistent Snapshots Work (backup.lock)”
  1. Write-Freeze Window: Before taking a snapshot, AIO creates /run/fynncloud-aio/backup.lock. fynncloud-server’s BackupFreezeMiddleware detects this lock immediately and rejects mutating file/database requests with 503 Service Unavailable and Retry-After: 5, while read requests continue serving normally. The nightly TrashCleanupJob also skips execution if a backup is in progress.
  2. Consistent Export: AIO streams a consistent PostgreSQL dump + roles (pg_dump + pg_dumpall --roles-only) alongside the current /data/stack.yaml into staging, then takes a single atomic restic backup covering:
    • PostgreSQL database dump + roles
    • /data/stack.yaml desired state
    • Live fynncloud_server_storage user blobs & file versions
    • Installed app persistent data volumes (fynncloud_app_data_*)
  3. Lock Release & Retention Pruning: Once the snapshot finishes, backup.lock is removed immediately and restic forget --prune enforces your keep_daily (default 7), keep_weekly (default 4), and keep_monthly (default 6) policy.
  4. Automated Weekly 5% Restore Drill: AIO periodically runs restic check --read-data-subset=5% (also triggerable on demand via Verify Backup Drill / POST /api/admin/system/backups/verify) to detect silent bit-rot or corrupted remote chunks before you ever need a restore.

Every AIO instance has a 6-field Recovery Kit JSON containing the cryptographic keys required to decrypt backups and restore your instance onto a brand-new server if the original host is destroyed:

  • Export it from Administration → System → Export Recovery Kit (protected by Step-Up action recovery-kit), or
  • Print it from the host CLI (required if AIO_ALLOW_SOCKET_RECOVERY_KIT=false):
Terminal window
docker exec fynncloud-aio fynncloud-aio recovery-kit > fynncloud-recovery-kit.json
chmod 600 fynncloud-recovery-kit.json
  1. Install Docker on the new server and run fynncloud-aio setup --domain cloud.example.com as usual.
  2. Open the printed Setup URL (while 0 users exist in the fresh database).
  3. Instead of creating a new admin account, select Restore from Backup (POST /api/setup/restore), provide your backup repository credentials and Recovery Kit keys, choose the snapshot, and confirm.
  4. AIO restores PostgreSQL, user storage, app volumes, and stack.yaml, then reconciles and brings the full stack back online with every user, file, share link, 2FA secret, and installed app intact.

You can also restore an existing running instance to an earlier snapshot from Administration → System → Backups → Restore (protected by Step-Up action restore).


FynnCloud AIO: Signed Atomic Updates & Rollback

Section titled “FynnCloud AIO: Signed Atomic Updates & Rollback”

AIO polls AIO_RELEASE_FEED_URL (https://releases.fynncloud.ch/aio/v1, channel stable or beta) for JSON release envelopes signed with an ECDSA P-256 key pinned inside the supervisor binary. Every image reference in a release is pinned by immutable @sha256: digest (not mutable tags).

  • Air-gapped / private mirrors: Override AIO_RELEASE_FEED_URL, supply your own signing key via AIO_RELEASE_PUBLIC_KEY_PEM, and set AIO_ALLOW_CUSTOM_RELEASE_REPOS=true if serving from a private registry.
  • Downgrade protection: Applying an older version than currently installed is blocked unless AIO_ALLOW_DOWNGRADE=true.

When you trigger Apply Update in Administration → System (Step-Up action updates:apply):

  1. AIO verifies the ECDSA P-256 signature and pre-pulls every digest-pinned container image.
  2. AIO snapshots the pre-update stack.yaml and pinned digests, then recreates containers in dependency order and waits for healthchecks.
  3. If fynncloud-server, fynncloud-web, or fynncloud-proxy fails its healthcheck window, AIO automatically rolls back to the previous digest-pinned images and restores service.

Supervisor Self-Swap (fynncloud-aio-upgrader)

Section titled “Supervisor Self-Swap (fynncloud-aio-upgrader)”

When a newer version of fynncloud-aio itself is available (triggered via Update Supervisor with Step-Up action updates:apply, or CLI fynncloud-aio upgrade), the running supervisor spawns a short-lived helper container (fynncloud-aio-upgrader) that pulls the verified new AIO image, stops and replaces fynncloud-aio preserving all /data and socket mounts, verifies the new supervisor starts cleanly, and removes itself.


Manual Upgrades & Backups (Docker Compose)

Section titled “Manual Upgrades & Backups (Docker Compose)”
Terminal window
# 1. Dump PostgreSQL database
docker exec fynncloud-db pg_dump -U fynncloud -Fc fynncloud > fynncloud_$(date +%F).dump
# 2. Archive .env (contains SECURITY_ENCRYPTION_KEY & AUTH_JWT_SECRET!)
cp .env fynncloud_env_$(date +%F).bak
# 3. Back up server_storage volume (if using local storage instead of S3)
docker run --rm \
-v fynncloud_server_storage:/source:ro \
-v "$(pwd)":/backup \
alpine tar czf /backup/storage_$(date +%F).tar.gz -C /source .
  1. Take a fresh database backup first.
  2. Update SERVER_IMAGE and WEB_IMAGE tags in .env (or pull latest tags).
  3. Pull and recreate containers:
Terminal window
docker compose pull
docker compose up -d

Database migrations run automatically on startup when DATABASE_AUTO_MIGRATE=true (the Compose default). If DATABASE_AUTO_MIGRATE=false, run docker compose run --rm server ./FynnCloudServer migrate -y before starting the new server container.

Rotating SECURITY_ENCRYPTION_KEY Without Downtime

Section titled “Rotating SECURITY_ENCRYPTION_KEY Without Downtime”

To rotate SECURITY_ENCRYPTION_KEY without invalidating user 2FA TOTP secrets or encrypted .secret settings:

  1. Move your current SECURITY_ENCRYPTION_KEY value into ENCRYPTION_PREVIOUS_KEYS (comma-separated if rotating multiple generations).
  2. Generate a new 32+ byte key (openssl rand -base64 32) and set it as SECURITY_ENCRYPTION_KEY.
  3. Restart fynncloud-server. SecretBox decrypts existing records using ENCRYPTION_PREVIOUS_KEYS and encrypts all newly saved secrets with the new primary key.