Self-hosting
Troubleshooting
How to see what’s wrong, and the usual problems: certificates, a service that won’t start, files or voice that don’t load, email that doesn’t arrive.
Reading the logs
Everything starts from selfhost/:
docker compose ps # every service, its state and its healthcheck
docker compose logs -f api # one service's log, live (Ctrl+C to stop)
docker compose logs --since 10m # all of them, the last ten minutesThe services are caddy, web, admin, api, gateway, bot-gateway, postgres, valkey,
s3, livekit, and the two that run once at each start, migrate and s3-init (Exited (0) is
right for those two). A service marked unhealthy or restarting over and over says why in its
log. For more detail, LOG_LEVEL=debug in .env and docker compose up -d.
Pulling the images fails
deniedorunauthorizedfor aklang-…image: the registry refused you. Either the images aren’t public yet (just after a release is tagged), orKLANG_IMAGESpoints at a private mirror you haven’t signed in to (docker login). Wait for the release’s images, or build them yourself withdocker compose build.manifest unknownornot foundfor aklang-…image: the version doesn’t name a release. LeaveKLANG_VERSIONcommented in.env, so the tag you checked out names its own images. If you set it, it’s the version without thev(0.0.31, notv0.0.31).no matching manifest for linux/arm/v7(or another platform): the machine isn’t 64-bit. The images are onlylinux/amd64andlinux/arm64(Requirements).
A service won’t start
Invalid environment configuration. The process cannot start.inapi,gatewayorbot-gateway, followed by the variables at fault:still change-me from .env.example: runsh init-env.sh, or set that secret by hand.KLANG_EDITION: it’s missing. The kit’s compose file sets it toself; you only see this if you run the images some other way. SetKLANG_EDITION=selfin their environment.- Any other: the message says what the value must look like.
s3-init: an S3 key is still change-me: the same, for the store’s keys.valkey: VALKEY_PASSWORD must be set: the same, for Valkey’s password. Set by hand, it can only have letters, digits,.,_,~and-.required variable VALKEY_PASSWORD is missing a valuefrom anydocker composecommand: your.envlacks the line. Copy it from.env.exampleand runsh init-env.sh.port is already allocatedoraddress already in usefor3478/udp: something else on the machine uses the TURN port. UniFi’s Network application does (its STUN server). Move Klang’s withLIVEKIT_TURN_PORT=3479in.env, open that port instead, and rundocker compose up -d. The same goes for7881and7882(LIVEKIT_TCP_PORT,LIVEKIT_UDP_PORT).ARM64-COW-BUGinvalkey, which then won’t start: Valkey checks the kernel for an old ARM64 memory bug when it starts. Under emulation (anarm64image on an x86 machine, with QEMU) that check fails even though nothing is wrong. On a real ARM machine with an up-to-date kernel you won’t see it. Only for an emulated or test setup, copy thecommandof thevalkeyservice intocompose.override.ymland add--ignore-warnings ARM64-COW-BUGafter--appendonly yes. Never on a real server: there the warning means the kernel needs updating.Permission deniedincaddy,postgres,valkeyors3: no service runs as root, so each volume has to belong to its service’s user. The kit’s own volumes do; one made some other way may not. Restore files as Backups says: its commands keep each file’s owner.migrateexited with an error:docker compose logs migrate. After an update, restore the backup you made before (Updating).- Everything waits: the API and the gateways wait for
migrateands3-init, and Caddy waits for the rest to be healthy. Look for the first one that isn’t.
The site doesn’t open, or the browser warns about the certificate
Caddy gets the certificates from Let’s Encrypt the first time each name is visited.
- The four hostnames must point at this server (
dig +short chat.example.org). - Ports 80 and 443 must reach the server from the internet: Let’s Encrypt checks through port 80.
docker compose logs caddysays what Let’s Encrypt answered. After several failures it makes you wait (its rate limits): fix the cause, then wait.- Trying it on your computer with
compose.local.yml, the browser warns once for each of the four hostnames: open the files and voice addresses once and accept them too, or files and calls won’t load.
Files or avatars don’t load
- Open a file’s address directly: if the certificate or the hostname fails, see above
(
KLANG_FILES_DOMAIN). docker compose logs s3-initmust end withS3 store ready.- Uploads fail at once: check
LIMIT_UPLOAD_MBand that the disk isn’t full (df -h).
Voice doesn’t connect
People join the channel but hear nothing, or the call keeps reconnecting:
- Ports: 7881/TCP, 7882/UDP and 3478/UDP open in the firewall, and forwarded in the router if the server is at home (Requirements).
- The address LiveKit announces must be the public one (Voice and TURN).
- Only from some places (an office, a school, a hotel): their network probably only lets HTTPS out, and the kit has no TURN over TLS yet (the limitation).
- Only from inside your own network: your router needs NAT loopback (NAT).
Email doesn’t arrive
docker compose logs api | grep -i email:
email not sent: neither RESEND_API_KEY nor SMTP_URL: there’s no provider in.env.- An SMTP error (login refused, timeout, TLS): check the URL, its port (
smtp://for 587,smtps://for 465) and percent-encoded characters in the password. - No error but nothing in the inbox: look in spam, and check that the domain of
EMAIL_FROMallows your SMTP server to send for it (SPF, DKIM).
See Email.
Bots can’t connect
BOTS_ENABLEDmust betrue: bots are off by default.- The bot’s library must use your hostnames:
https://<KLANG_DOMAIN>/apifor the API andhttps://<KLANG_DOMAIN>/api/mediafor images (Bots).
The app stays on “Offline, reconnecting”
Each IP can open GATEWAY_CONNECTIONS_PER_5_MIN real-time connections every 5 minutes (60 by
default). Many tabs or people behind one IP (testing on one computer, an office, a school) can use
them up, and the app waits until the 5 minutes pass. Raise the value in .env and run
docker compose up -d (Configuration).
If it happens to everyone at once, Klang may be seeing one address for all of them: behind your
own reverse proxy without TRUST_PROXY_HOPS=2
(Behind your own reverse proxy), or with AAAA records while
Docker’s network has no IPv6 (IPv6).
Two installs on one machine
The kit’s project is called klang-server, and its volumes start with that name. A second
install on the same machine needs its own folder and its own project name, in every command:
docker compose -p klang-other …. Otherwise both would share the same volumes.
Still stuck
Search the repository’s issues, and open one with the bug template if it’s a bug: what you did,
what happened, and the relevant lines of the logs. Remove every secret first: no .env, no
tokens, no passwords.