Self-hosting
Docker
The fastest way to a working setup is the install wizard: pick where Clavis runs and how it does HTTPS, and copy the compose file.
Plain HTTP (localhost or behind a proxy)
docker run -d --name clavis --restart unless-stopped \
-p 80:8080 \
-v clavis-data:/data \
dumhouse/clavis:latestHTTPS built in
docker run -d --name clavis --restart unless-stopped \
-p 80:8080 -p 443:8443 \
-v clavis-data:/data \
-e CLAVIS_TLS=self-signed \
-e CLAVIS_SERVER_BASE_URL=https://192.168.1.20 \
dumhouse/clavis:latestCLAVIS_TLS is off (default), self-signed, file (your certificate) or acme (Let's Encrypt, also for a LAN-only server through the DNS challenge with CLAVIS_ACME_DNS). Port 80 then only redirects to HTTPS. With self-signed, the CLI shows the certificate fingerprint and asks each person once (docker exec clavis clavis admin tls-info prints it for you to share). Every mode, trusting a self-signed certificate, and reverse-proxy examples are in HTTPS and certificates.
Ports
Inside the container Clavis listens on 8080 (HTTP) and 8443 (HTTPS), because it runs as a non-root user. Publish them on the standard host ports with -p 80:8080 -p 443:8443, or on any other ports you like.
Docker Compose
services:
clavis:
image: dumhouse/clavis:latest
container_name: clavis
restart: unless-stopped
ports:
- "80:8080"
- "443:8443"
environment:
CLAVIS_TLS: "self-signed"
CLAVIS_SERVER_BASE_URL: "https://192.168.1.20"
# Optional: claim the server with your own token and email.
# CLAVIS_SETUP_TOKEN: "<at least 24 random characters>"
# CLAVIS_SETUP_OWNER_EMAIL: "you@example.com"
volumes:
- clavis-data:/data
volumes:
clavis-data:docker compose up -d
docker compose logs clavis | grep setup_url # the setup link with the tokenrestart: unless-stopped restarts Clavis after a crash, a Docker restart or a reboot. A deliberate docker compose stop is respected.
The production compose file
The repository ships a ready-made setup in deploy/: a compose.yaml, a .env.example and update.sh. Compared with the short file above it:
- pins the release with
CLAVIS_VERSIONin.env, so an update is something you do on purpose; - keeps secrets such as the setup token in
.env, not in the compose file; - turns on daily encrypted backups to a separate volume (
clavis-backups); - runs with a read-only filesystem, no extra privileges and no capabilities.
cd deploy
cp .env.example .env && chmod 600 .env # edit the address and version
docker compose up -d --waitHealth check
The image checks itself every 30 seconds with clavis healthcheck, which asks the server's /readyz (database and root key) on the plain HTTP port, which answers it even when TLS is on. The image has no shell or curl, so the binary does the request. docker ps shows healthy or unhealthy, docker compose up --wait waits for it, and you can run it yourself:
docker exec clavis clavis healthcheckThe health check only applies to a container that runs the server. Kubernetes ignores it; the Helm chart has its own probes.
Updating a Docker install
With the deploy/ files, one command does it all:
cd deploy
./update.sh 0.3.5It stops Clavis, copies the data volume to deploy/backups/, sets CLAVIS_VERSION, pulls the image and starts it. If the new version does not become healthy, it puts the old version and the data from before the update back, and tells you. The copy leaves out the root key, which stays in the volume: back that up separately (see below). Clavis is down for the few seconds the copy and the start take. Read the changelog first.
Without the script, the same steps by hand:
docker compose stop
# --volumes-from finds this project's data volume, whatever the project is called.
docker run --rm --volumes-from "$(docker compose ps -aq clavis)" -v "$PWD/backups":/out alpine:3 \
tar czf /out/clavis-data-before-update.tgz --exclude './root.key*' -C /data .
# set CLAVIS_VERSION in .env, then:
docker compose pull && docker compose up -d --waitTo go back, restore the old CLAVIS_VERSION and run docker compose up -d --wait again. A migration that has already run is not undone by an older version, so restore the volume copy if the old version will not start on the new data.
First-run setup
On first start the log prints a setup_url with the one-time token built in. Open it to create the owner account. You can also print the token while setup is open:
docker exec clavis clavis setup-token| Variable | Meaning |
|---|---|
CLAVIS_SETUP_TOKEN | Use this token instead of a random one (at least 24 characters). Handy for compose files and automation: you know the token before the server starts, so the link is https://<host>/setup#token=<token>. |
CLAVIS_SETUP_OWNER_EMAIL | Only this email can create the owner account; the setup page fills it in. |
Back up the root key file (/data/root.key by default) separately from database backups.
To keep the key out of the data volume altogether, set it in .env:
# New install
echo "CLAVIS_KEY_PROVIDER=env" >> .env
echo "CLAVIS_ROOT_KEY=$(openssl rand -base64 32)" >> .env
# Existing install: move the current key, then remove the file once Clavis
# has started with it
echo "CLAVIS_KEY_PROVIDER=env" >> .env
echo "CLAVIS_ROOT_KEY=$(docker run --rm --volumes-from "$(docker compose ps -q clavis)" alpine:3 cat /data/root.key)" >> .env
docker compose up -d --waitClavis checks the key against the existing data when it starts. It refuses to start with a key that does not match, and it will not create a new root.key for a database that already has data, since a new key cannot decrypt anything stored under the old one.
Plain HTTP on a network address
Browsers only keep Clavis's secure session cookie over HTTPS or on localhost. If you still open Clavis at http://<ip>, it falls back to non-Secure cookies so sign-in works, and logs a warning. Your password and secrets then cross the network unencrypted and passkeys are unavailable: use it for a short trial only.
Locked out, and no email configured
Password resets are normally sent by email. Without SMTP, an admin on the server prints a one-time reset link instead; it works for the only owner too:
docker exec clavis clavis admin reset-password you@example.comThe link is valid for 24 hours (--valid-for 1h to shorten it) and the reset is recorded in the audit log. See clavis admin reset-password and the other admin commands.
Kubernetes
See Install with Helm for OCI install and upgrade commands, chart values, database configuration, persistence, ingress, and root key backup. The chart defaults to one SQLite-backed replica; use PostgreSQL for multiple replicas.
Postgres
Use a managed Postgres with TLS, automated backups, and PITR. Clavis uses LISTEN/NOTIFY for multi-replica events and SKIP LOCKED for jobs.
Root key
Choose one:
file: mounted secret volume, 0600; back it up separately.env: injected by the platform secret manager.aws-kms/gcp-kms/azure-kv: no root key at rest in the app.- Shamir sealing:
clavis admin shamir split --seal; unseal before start.
Azure Key Vault
Use a Key Vault key (RSA, 2048-bit or larger) to wrap the root key. Clavis generates a data key locally, wraps it with Key Vault, and stores only the wrapped bytes in keys.root_key_file:
CLAVIS_KEY_PROVIDER=azure-kv
CLAVIS_AZURE_KEY_VAULT_URL=https://my-vault.vault.azure.net
CLAVIS_AZURE_KEY_VAULT_KEY=clavis-root
# Options: the empty version uses the latest Key Vault key version.
CLAVIS_AZURE_KEY_VAULT_KEY_VERSION=Give the workload the built-in Key Vault Crypto Service Encryption User role on the vault. It grants keys/wrapKey and keys/unwrapKey and nothing else.
Credentials come from the Azure identity chain, with no static secrets in the configuration:
- Workload identity (AKS, GitHub Actions): set
CLAVIS_AZURE_FEDERATED_TOKEN_FILE, or let it default toAZURE_FEDERATED_TOKEN_FILE.AZURE_TENANT_IDandAZURE_CLIENT_IDare picked up too, so pod identity alone is often enough. - App Service, Container Apps, Functions: Clavis uses
IDENTITY_ENDPOINTandIDENTITY_HEADERwhen both are set. - Managed identity everywhere else: the instance metadata service.
CLAVIS_AZURE_CLIENT_IDselects a user-assigned identity.
For sovereign clouds set CLAVIS_AZURE_LOGIN_ENDPOINT, for example https://login.microsoftonline.us. The wrapped key file still lives on the data volume: keep it, since a new key cannot decrypt the existing database. Rotating the Key Vault key is safe: the wrapped file records the key id it was wrapped with, so older key versions keep working.
Backups
Manual backup and restore:
clavis admin backup --out clavis-backup.enc
clavis admin restore clavis-backup.enc --yesScheduled backups run inside the server when enabled:
backup:
enabled: true
dir: "/var/lib/clavis/backups"
interval: 24h
keep: 7Each run writes an encrypted clavis-<timestamp>.clvbk file (0600) and prunes all but the newest keep files. The same superuser is required to restore, so keep the root key and the backups in separate trust domains. Test a restore quarterly.
Upgrades
For a single Docker container or Compose file, see Updating a Docker install. For Kubernetes and multi-replica setups:
- Snapshot the database.
- Read the release notes and verify signatures.
- Run migrations by starting the new binary once.
- Roll API replicas, then workers.
- Run
clavis healthandclavis admin audit verify.
Reverse proxy
Terminate TLS at the proxy, forward X-Forwarded-For, and keep request body limits aligned with server.max_body_bytes. Do not strip the Authorization header or cookies.