# HTTPS for the first homelab app with Caddy and Uptime Kuma

A new Linux host can run a container in minutes and still be awkward to open from a laptop. The hostname may only work on the server, the app may be listening on every interface, and the browser will complain about TLS. This walk-through uses Caddy 2.11 as a reverse proxy and Uptime Kuma 2 as the first app. The files are in https://github.com/stackyardhq/stackyard-starter. I made them (Stackyard). The same account also sells a larger Compose pack and a printable guide; this article only uses the free repo.

## What you end up with

Caddy publishes ports 80, 443 and UDP 443 on the host. Uptime Kuma stays on the Compose network at port 3001. Caddy serves `https://kuma.<DOMAIN>` and, with the default `TLS_MODE=internal`, uses its local CA. You install that CA's public root on clients. Kuma's first-run page should then load without a certificate warning.

You need one Linux host, Docker Engine with the Compose plugin (`up --wait`), and free host ports 80 and 443. A way to resolve `kuma.<DOMAIN>` — a DNS record or a hosts-file line — is enough for a browser. `curl --resolve` is enough to test from the Docker host itself.

## Start the stack

From the `compose/` directory:

```bash
cp -i .env.example .env
# Set DOMAIN to the base name only, for example lab.home.arpa
# Leave TLS_MODE=internal
docker compose up -d --wait
docker compose ps
```

On a Debian test host with Docker 26.1 and Compose 5.8, first start took about a minute. Both services reported healthy. Uptime Kuma 2.5.12 then waited on its database setup page.

## Check HTTPS from the Docker host

```bash
host=kuma.lab.home.arpa   # kuma. plus your DOMAIN
docker compose cp caddy:/data/caddy/pki/authorities/local/root.crt ./stackyard-ca.crt

curl --noproxy '*' -sS --resolve "$host:80:127.0.0.1" \
  -o /dev/null -w '%{http_code} %{redirect_url}\n' "http://$host/"

curl --noproxy '*' -fsS --cacert ./stackyard-ca.crt \
  --resolve "$host:443:127.0.0.1" -w '\n' "https://$host/_caddy/health"

curl --noproxy '*' -fsSL --cacert ./stackyard-ca.crt \
  --resolve "$host:443:127.0.0.1" -o /dev/null \
  -w 'Kuma returned HTTP %{http_code} (%{content_type})\n' "https://$host/"
```

The results on the test host were a 308 redirect to `https://kuma.lab.home.arpa/`, the text `Caddy is up`, and HTTP 200 with `text/html` from Kuma.

If the CA file is missing or you get a 502, look at `docker compose logs --tail=50 caddy kuma`.

## Open it in a browser

Point `kuma.<DOMAIN>` at the host's LAN address. Copy `stackyard-ca.crt` to the client and import it as a trusted root in the trust store the browser uses. Share only this public certificate, not Caddy's data directory (that directory also holds the CA private key and is root-owned on a typical run).

Kuma should then show its first-run database chooser. SQLite is enough for a single host. Create the admin account before you consider opening the name on the public internet.

## Add a second name

Append a site block to `compose/caddy/Caddyfile`. This answers with a short string so you can test DNS and TLS before adding an app:

```caddyfile
notes.{$DOMAIN} {
	import tls-{$TLS_MODE:internal}
	respond "Notes route is ready"
}
```

Validate and reload:

```bash
docker compose exec -T caddy caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile &&
  docker compose exec -T caddy caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile
```

To proxy an app, add it to `compose.yaml` on the default network and replace the `respond` line with `reverse_proxy notes:8080` (use the container port).

## Public certificates

Create the Kuma admin on the LAN first. Set `DOMAIN` to a name you control, point public DNS for `kuma.<DOMAIN>` at the host, and forward TCP 80 and 443 if the host is behind a router. Keep port 80 open for HTTP-01 renewals. Set `TLS_MODE=public` and run `docker compose up -d --wait` so Caddy picks up the new environment. Live Let's Encrypt issuance was not tested.

## Backups

Compose bind-mounts `data/kuma/`, `data/caddy/` and `data/caddy-config/` under `compose/`. Stop the stack before you archive those directories so Kuma's database is idle. Use `sudo tar` — Caddy's files are typically root-owned. The archive contains the CA private key; keep it private. A restore is a stop, extract into a clean `compose/` directory, and `docker compose up -d --wait`. This backup is unencrypted and takes both services offline. I did not run a full restore drill on the test host.

## The repo, and what is not in it

The files, a one-page pdfLaTeX lab-report starter, and a first-run screenshot are in https://github.com/stackyardhq/stackyard-starter, MIT-licensed. A free three-page first-week checklist is at https://ohellebust.gumroad.com/l/dwggcc.

This stack does not include single sign-on or an automated backup tool. If you want Authelia in front of Caddy and a restic backup/restore path that was tested on a fresh unzip, that is the paid Homelab Core Stack: https://ohellebust.gumroad.com/l/ziqhmh. A 16-page printable troubleshooting guide is at https://ohellebust.gumroad.com/l/vckaxv. A fuller lab-report class, with English and Bokmål examples, is at https://ohellebust.gumroad.com/l/jahkd. The free repo is meant to be complete for the smaller job; those packs are optional.

This article was drafted with AI assistance and checked against the Docker run described above.

