Skip to content

Docker Compose

Use this when Docker runs directly on the server. On Dokploy or Coolify, follow their pages instead: those platforms route through their own proxy and must not publish a host port.

  • Docker Engine with the Compose plugin (docker compose).
  • For HTTPS: a domain whose DNS points at the server, and ports 80 and 443 open.

Create docker-compose.yml:

docker-compose.yml
services:
kinglet:
image: ghcr.io/rushlightlab/kinglet:0.5.0
restart: unless-stopped
ports:
- "127.0.0.1:8080:3000"
env_file: .env
volumes:
- kinglet-data:/data
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
volumes:
kinglet-data:

Create .env next to it (mode 600, out of Git):

.env
KINGLET_BASE_URL=http://localhost:8080
KINGLET_ADMIN_EMAIL=you@example.com
KINGLET_ADMIN_PASSWORD=<strong-password>
# Encrypts notification channel secrets: openssl rand -base64 32
KINGLET_SECRET_KEY=<generated key>

Start it:

Terminal window
docker compose up -d

If you left the admin password unset, read the generated one with docker compose exec kinglet cat /data/admin-password.txt.

The port is bound to loopback. To serve the public, put a TLS proxy in front, or use the Caddy sample below. The container runs as UID 1000 (node), so if you replace the named volume with a host bind mount, make sure that directory is writable by UID 1000.

The repository’s deploy/ folder has a ready-made stack: docker-compose.tls.yml runs Kinglet and Caddy, and Caddyfile configures Caddy. Caddy obtains and renews certificates, sets HSTS, and is the only container that publishes ports (80 and 443). Kinglet is reachable only over the Compose network.

  1. Copy deploy/docker-compose.tls.yml and deploy/Caddyfile into one directory on the server.

  2. Point your domain’s DNS at the server.

  3. Create .env in that directory:

    .env
    KINGLET_DOMAIN=logs.example.com
    KINGLET_BASE_URL=https://logs.example.com
    KINGLET_ADMIN_EMAIL=you@example.com
    KINGLET_ADMIN_PASSWORD=<strong-password>
  4. Start the stack:

    Terminal window
    docker compose -f docker-compose.tls.yml up -d
  5. Open https://logs.example.com.

The sample gives Caddy the fixed address 172.30.0.10 on a dedicated 172.30.0.0/24 network and sets KINGLET_TRUSTED_PROXIES=172.30.0.10/32, so proxy trust is already narrow. If you change the subnet, change the Caddy address and KINGLET_TRUSTED_PROXIES with it.

Variable Notes
KINGLET_BASE_URL Exact public origin. The TLS sample refuses to start without it.
KINGLET_DOMAIN TLS sample only: the hostname Caddy serves and requests a certificate for.
KINGLET_ADMIN_EMAIL / KINGLET_ADMIN_PASSWORD Used only while no administrator exists.
BETTER_AUTH_SECRET Optional on one instance; generated in /data otherwise.
KINGLET_SECRET_KEY Encrypts channel secrets; needed to add notification channels.
KINGLET_TRUSTED_PROXIES Empty without a proxy; the proxy’s /32 with one. Set already in the TLS sample.

See the configuration reference for retention, caps, search, and S3 backups.

Back up /data, change the image tag in the compose file, then:

Terminal window
docker compose pull && docker compose up -d
# TLS stack:
docker compose -f docker-compose.tls.yml pull && docker compose -f docker-compose.tls.yml up -d

Migrations run on boot; read the upgrade notes first.

  • Sign-in returns 403 INVALID_ORIGIN. KINGLET_BASE_URL does not match the browser origin. Fix .env and run docker compose up -d again.
  • Caddy has no certificate. DNS does not point at the server yet, or ports 80/443 are blocked. Check docker compose -f docker-compose.tls.yml logs caddy.
  • Pool overlaps with other one on this address space. Another Docker network already uses 172.30.0.0/24. Pick a free subnet and update the Caddy address and KINGLET_TRUSTED_PROXIES to match.
  • address already in use. Another service holds the host port (8080, or 80/443 for Caddy). Free it or map a different host port.