Docker and Coolify
Varlatch ships as a single distroless container image
(ghcr.io/varlatch/varlatchd) with its embedded SQLite database and built-in
Tailscale support: no PostgreSQL, Convex, nginx, or sidecar containers.
Prefer a plain Linux server? Install Varlatch sets up
varlatchddirectly via systemd in three commands with a guided wizard. The container image does not have guided setup yet, so you create the key files and config once by hand below.
1. Prepare directories, keys, and config
Section titled “1. Prepare directories, keys, and config”Run these commands as root on the Docker / Coolify host. The container runs as
uid 65532 (nonroot) with a read-only root filesystem and refuses to start if
any key is placed in an environment variable.
install -d -m 700 -o 65532 -g 65532 /srv/varlatch/data /srv/varlatch/keys
for key in root-kek backup-key; do openssl rand -hex 32 | install -m 400 -o 65532 -g 65532 /dev/stdin /srv/varlatch/keys/$keydone
tee /srv/varlatch/varlatchd.conf >/dev/null <<'EOF'listen = 0.0.0.0:8686public_url = https://vault.example.comtrusted_proxies = coolify-proxydata_dir = /var/lib/varlatchroot_kek_file = /keys/root-kekbackup_key_file = /keys/backup-keyEOF
chown root:65532 /srv/varlatch/varlatchd.confchmod 640 /srv/varlatch/varlatchd.confReplace https://vault.example.com with your real HTTPS URL. Outside Coolify,
replace coolify-proxy with your reverse proxy container’s name or IP.
Important:
- Back up both keys off this host now, apart from each other. Without
root-kek, every stored secret is unrecoverable; withoutbackup-key, no backup can be restored. - Create
/srv/varlatch/varlatchd.confbefore starting the container, or Docker will create an empty directory at that path andvarlatchdwill fail withEISDIR. - Leave
listen_httpsunset when your proxy terminates TLS. Settinglisten_httpstogether withlisten = 0.0.0.0:8686exits with status78.
2. Start the container
Section titled “2. Start the container”Option A: Coolify
Section titled “Option A: Coolify”- In Coolify, create a Docker Compose resource pointing at the Varlatch
repository:
- Base Directory:
/ - Docker Compose Location:
/infra/coolify/varlatchd.compose.yml - Disable automatic deployments (stateful installation).
- Base Directory:
- Add the environment variable pinning the verified release digest (from the
release’s
varlatchd-image.txt, see Verifying a release):Terminal window VARLATCH_VARLATCHD_DIGEST=sha256:<64-lowercase-hex-digest> - Assign your public domain (matching
public_url) to thevarlatchdservice on port8686, then click Deploy.
Coolify always mounts the default host paths (
/srv/varlatch/data,/srv/varlatch/keys,/srv/varlatch/varlatchd.conf); custom path env vars in the compose file only work with plain Docker Compose.
Option B: Plain Docker
Section titled “Option B: Plain Docker”Start varlatchd on your reverse proxy’s Docker network and forward your HTTPS
domain to varlatchd:8686:
docker run -d --name varlatchd --network <proxy-network> \ --restart unless-stopped --read-only --cap-drop ALL \ --security-opt no-new-privileges --stop-timeout 30 \ -v /srv/varlatch/data:/var/lib/varlatch \ -v /srv/varlatch/keys:/keys:ro \ -v /srv/varlatch/varlatchd.conf:/etc/varlatch/varlatchd.conf:ro \ ghcr.io/varlatch/varlatchd@sha256:<verified-release-digest>3. Bootstrap the first administrator
Section titled “3. Bootstrap the first administrator”Verify /readyz answers 200, then generate your one-time enrollment link:
curl -fsS https://vault.example.com/readyzdocker exec <container> varlatchd admin bootstrapOpen the printed link within 15 minutes to register your passkey. (If it
expires, run varlatchd admin bootstrap --revoke-unused for a new one; if
enrollment was interrupted, check admin bootstrap-status and run
admin recover --identity <id>.)
4. Verify keys and run your first backup
Section titled “4. Verify keys and run your first backup”docker exec <container> varlatchd admin kek verifydocker exec <container> varlatchd admin custody attest --key root-kek --method copydocker exec <container> varlatchd admin custody attest --key backup-key --method copydocker exec <container> varlatchd admin backup rundocker exec <container> varlatchd admin doctorNext, configure off-host backups (S3-compatible destinations)
by mounting your destinations and key files readable by uid 65532.
Upgrading by digest
Section titled “Upgrading by digest”In a container deployment, the pinned image digest is the version (varlatch upgrade
is for systemd hosts only):
- Look up and verify the new release’s digest (Verifying a release).
- Take a fresh backup (
docker exec <container> varlatchd admin backup run) and keep a copy off the host. - Update
VARLATCH_VARLATCHD_DIGESTin Coolify (or yourdocker rundigest) and redeploy. - Confirm
GET https://vault.example.com/readyzreturns200.
The database schema. When the new release has a newer database schema,
varlatchd upgrades it when the container starts, before it serves, and logs
upgraded the database's schema with the old and new versions. It does this
only when the upgrade is rollback-safe: the release you came from can still
open the upgraded database. Every release so far is. Check before you deploy
by running the new image once, with the running container left as it is:
docker run --rm --read-only -v /srv/varlatch/data:/var/lib/varlatch \ -v /srv/varlatch/keys:/keys:ro \ -v /srv/varlatch/varlatchd.conf:/etc/varlatch/varlatchd.conf:ro \ ghcr.io/varlatch/varlatchd@sha256:<new-digest> admin schema statusImages up to 0.50.2 do not upgrade the schema when they start: on an older
database they stop with run varlatch upgrade. For one of them (for example
0.50.0 to 0.50.2), use the by-hand procedure below, or upgrade straight to a
later release.
Going back. After a rollback-safe upgrade, set the previous digest again and redeploy: the previous release opens the upgraded database, and nothing needs restoring.
A release that is not rollback-safe. Its release notes say so, and the new container does not start: it stops with a message that its schema upgrade is not rollback-safe and changes nothing. Upgrade it by hand (the same steps work for any schema upgrade):
-
Redeploy the previous digest if you already deployed the new one, and take a backup with it (
docker exec <container> varlatchd admin backup run). Keep a copy off the host: after an upgrade that is not rollback-safe, it is the only way back. -
Stop the container (in Coolify, stop the resource).
-
Run the new image once on the same volume, keys and configuration:
Terminal window docker run --rm --read-only -v /srv/varlatch/data:/var/lib/varlatch \-v /srv/varlatch/keys:/keys:ro \-v /srv/varlatch/varlatchd.conf:/etc/varlatch/varlatchd.conf:ro \ghcr.io/varlatch/varlatchd@sha256:<new-digest> admin schema upgrade -
Set the new digest and deploy, then confirm
/readyzreturns200.
To go back after such an upgrade, restore the backup from step 1 with the previous image (Restoring a backup in a container).
Restoring a backup in a container
Section titled “Restoring a backup in a container”Read Backup and recovery first: a restored installation revives credentials revoked since the backup and starts held until you resume it. Keep clients away until you finish cleanup.
Step-by-step container restore procedure
In Coolify, stop the resource and do not deploy it until step 4.
-
Place the
.vltbakarchive in/srv/varlatch/data/backups/, comment out anytailnetlines in/srv/varlatch/varlatchd.conf, and restore:Terminal window docker run --rm --read-only --cap-drop ALL --security-opt no-new-privileges \-v /srv/varlatch/data:/var/lib/varlatch -v /srv/varlatch/keys:/keys:ro \-v /srv/varlatch/varlatchd.conf:/etc/varlatch/varlatchd.conf:ro <image> \admin backup restore --in /var/lib/varlatch/backups/ARCHIVE-ID.vltbak -
Run the restored server on an isolated Docker network bound to loopback only:
Terminal window docker network create varlatch-restoredocker run -d --name varlatch-restore --network varlatch-restore -p 127.0.0.1:8686:8686 \--read-only --cap-drop ALL --security-opt no-new-privileges --stop-timeout 30 \-v /srv/varlatch/data:/var/lib/varlatch -v /srv/varlatch/keys:/keys:ro \-v /srv/varlatch/varlatchd.conf:/etc/varlatch/varlatchd.conf:ro <image> -
Reach it locally to revoke compromised credentials, cancel unwanted deletions, and rotate secrets. For browser/passkey access (which requires your real hostname over HTTPS), front it temporarily with Caddy on the same isolated network and tunnel via SSH:
Terminal window docker run -d --name varlatch-restore-tls --network varlatch-restore -p 127.0.0.1:8443:443 \caddy:2 caddy reverse-proxy --from vault.example.com --to varlatch-restore:8686 --internal-certsdocker cp varlatch-restore-tls:/data/caddy/pki/authorities/local/root.crt ./restore-ca.crtOn your workstation, temporarily trust
restore-ca.crt, map127.0.0.1 vault.example.comin/etc/hosts, forwardsudo ssh -L 443:127.0.0.1:8443 you@the-host, and openhttps://vault.example.com.For CLI access without a proxy:
Terminal window docker exec varlatch-restore varlatchd admin recover --identity <id> --cli-credential |grep -o 'vlt_[A-Za-z0-9_-]*' |varlatch login --server http://127.0.0.1:8686 --token-stdinRevoke that temporary CLI credential in the dashboard when finished.
-
Resume background jobs, tear down the temporary containers, uncomment any
tailnetlines, remove the temporary CA/hosts entry on your workstation, and deploy normally:Terminal window docker exec varlatch-restore varlatchd admin restore resumedocker rm -f varlatch-restore-tls varlatch-restoredocker network rm varlatch-restore
Sharing a small host with Coolify
Section titled “Sharing a small host with Coolify”Coolify’s scheduler runs periodic work at the start of every minute, which can
compete for CPU on a 2-core host. See
Sharing the host with other workloads
for cpu_shares tuning (4096).
Upgrading from a 0.23.x Coolify stack? Follow Migrating from 0.23.x to 0.50.

