Deploy Claviger with a template
Pick one of the four deploy templates, set the secrets, run one instance, and reach it over HTTPS on a stable host name.
Developers and self-hosters who put Claviger on a server, a Fly machine, a Kubernetes cluster or Azure Container Apps.
Every template runs one instance, because SQLite allows one writer. Passkeys need HTTPS and a host name that never changes. Both mistakes are costly to fix after people enrol.
What you will do, in one sentence
Copy the template for your platform, set PB_ENCRYPTION_KEY and the admin account, keep the count at one, and enrol people only on the final host name.
Screens are captured from a seeded test system. Every name, address and number on the screens is invented. Prepared 15 November 2026.
1. Choose a template
The templates live in the deploy/ folder of the Claviger repository. Each folder has its own README.
| Platform | Folder | How HTTPS works |
|---|---|---|
| Docker Compose | deploy/docker-compose | Optional Caddy profile with automatic HTTPS. |
| Fly.io | deploy/fly | Fly gives https://<app>.fly.dev. Add your own domain with fly certs add. |
| Kubernetes | deploy/kubernetes | An optional Ingress, with cert-manager or your own TLS secret. |
| Azure Container Apps | deploy/azure-container-apps | Add a custom domain. Container Apps manages the certificate. |
The templates pin an image tag, ghcr.io/doodlemania2/claviger:<version>. Check the releases page for a tag before you deploy.
Claviger stores data in SQLite. Two writers on one data directory corrupt the database. Never scale a template above one: not docker compose up --scale, not fly scale count 2, not a second Kubernetes pod.
2. Settings every template shares
| Setting | Notes |
|---|---|
PB_ENCRYPTION_KEY | Exactly 32 characters. Create it with openssl rand -hex 16. Set it before the first start. Keep a copy. Without it, encrypted settings cannot be read. |
PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD | Create the first superuser on the first start. Remove the password after that. |
CLAVIGER_METRICS_TOKEN | Optional. Turns on the Prometheus route. |
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS | Optional. Turn on OTLP export. |
LITESTREAM_* | Optional. Continuous replication of the database. |
After you deploy, check GET /api/health. Then open /_/ and sign in.
Behind a proxy, Claviger sees the proxy's address unless you tell it which header to trust. In the admin screen, open Settings, Application, User IP proxy headers and add the header:
| Platform | Header |
|---|---|
| Compose with the bundled Caddyfile | X-Forwarded-For |
| Fly | Fly-Client-IP |
| Kubernetes | X-Forwarded-For. Tick Use leftmost IP if a cloud load balancer sits in front of the Ingress. |
| Azure Container Apps | X-Forwarded-For |
Otherwise rate limits count every user as one address. Add the header only when every request really passes through your proxy.
3. Docker Compose and Fly
Docker Compose. Copy .env.example to .env, and set CLAVIGER_VERSION, CLAVIGER_DOMAIN and the admin account. Then start with HTTPS:
docker compose --profile caddy up -d
curl -fsS https://auth.example.org/api/health
For a test on http://127.0.0.1:8090, uncomment ports in compose.yaml and run docker compose up -d. The container has a read-only root file system. It writes only to /pb_data and a /tmp tmpfs.
Back up with a short stop and a tarball of the volume, or enable Litestream. Litestream does not store PB_ENCRYPTION_KEY, so back that up apart.
Fly. Edit fly.toml first. Then create the app and a volume, stage the secrets, and deploy one machine.
fly apps create your-claviger-app
fly volumes create claviger_data --size 1 --region iad --count 1
fly deploy --ha=false
An upgrade replaces the machine without a second one beside it, so there is a short outage. Take a volume snapshot first. The Fly README says fly config validate has not been run on the template, so run it yourself.
4. Kubernetes and Azure Container Apps
Kubernetes. The manifests are a StatefulSet with one pod, a volume, a Service and an optional Ingress.
kubectl apply -f claviger.yaml
kubectl -n claviger rollout status statefulset/claviger
kubectl apply -f ingress.yaml
- Do not add an HPA. A
ReadWriteOncevolume limits the volume to one node, and two pods on that node can both mount it. - Every update or node drain means a short outage. That is the safe behavior for one SQLite writer.
- Use block storage. Do not put
/pb_dataon NFS unless it supports POSIX byte-range locks, and never on SMB. - The image runs as root. The manifest drops all capabilities and uses a read-only root file system, but it does not set
runAsNonRoot. - The README says
kubectlcould not schema-check the manifests. Runkubectl apply --dry-run=serveragainst your cluster first.
Azure Container Apps. The Bicep template builds a Container App, an Azure Files NFS share, a VNet and logs.
az deployment group create -g claviger-rg \
--template-file main.bicep \
--parameters name=claviger clavigerVersion=0.1.0 \
encryptionKey="$(openssl rand -hex 16)" \
[email protected] adminPassword='a-long-random-password'
minReplicasandmaxReplicasare both 1. Do not change them.- During an update two containers have the share mounted for about 40 seconds. The image's
entrypoint.shhandles it. The new replica asks the old one to close both databases, and then opens them.PB_HANDOVER_TIMEOUT(default 60 seconds) bounds the wait. - Use NFS, not SMB. SQLite in WAL mode needs byte-range locks, and SMB shares lack them.
- Upgrade with the same
encryptionKey. A different value makes the stored settings unreadable. - The README says the template compiled with Bicep but was not deployed. Report problems as issues.
PB_HANDOVER_TIMEOUT=0 turns the handover off. That is unsafe on a platform that overlaps replicas.
5. Passkeys: HTTPS and a stable host name
A passkey is bound to the host name where it was made, the RP ID. If you change the domain, existing passkeys stop working.
- Choose your final domain before you enrol anyone.
- Add it to the platform first:
fly certs add auth.example.org, a Caddy domain, an Ingress host, oraz containerapp hostname add. - Set the Application URL to that
httpsaddress. - Enrol people on that name, never on a temporary one such as
fly.dev.
6. Quick reference card
Every platform
- One instance. Never scale up.
PB_ENCRYPTION_KEY, 32 characters, copy stored.- First superuser from
PB_ADMIN_EMAILandPB_ADMIN_PASSWORD, then remove the password. GET /api/healthreturns 200.
Before you enrol people
- HTTPS works on the final host name.
- User IP proxy headers is set.
- A backup exists.
Back up before every upgrade. A migration may not be reversible.