Per user direction, Caddy runs only on dankclaw. It fronts every service on both hosts: local services by container name, quadlet services by published LAN port, dankserver services by published LAN port (192.168.0.235:PORT). - dankclaw/Caddyfile: merged vhost list (was: two Caddyfiles, one per host). gitea's single vhost moves in from the retired gitea-caddy quadlet (option B). Upstreams fixed to live reality: gitea :3000, search :8081 (gluetun), chat :3005 (open-webui quadlet), media services via 192.168.0.235. Retired: llms (open-webui on dankserver is removed; chat is its successor), the dankserver homepage (302 to the shared one). - dankserver/Caddyfile, dankclaw/gitea/Caddyfile: deleted (git rm). - dnsmasq addn-hosts: every name -> 192.168.0.143 (the one Caddy host); no .235 records, no llms. - compose.yaml: removed the openwebui/postgres/gitea services (they are quadlets now); caddy service mounts the rendered Caddyfile from /home/dank/Containers/caddy, healthcheck probes the bare-IP catch-all (302). - deploy.sh: per-target logic (dankserver = pull-only, health via the shared Caddy at 192.168.0.143); renders CADDY_BASICAUTH_HASH from the host .env into the mounted Caddyfile. - .env.example: CADDY_BASICAUTH_HASH on dankclaw; Porkbun block dropped from dankserver (its Caddy is gone); SEARXNG_BASE_URL to the flat name; stale OPENAI_* block dropped (quadlet is self-contained). - tests: caddyfile.bats now asserts the single-Caddyfile invariant; dnsmasq.bats cross-checks vhosts -> .143 and the retired names.
61 lines
2.1 KiB
Bash
61 lines
2.1 KiB
Bash
#!/usr/bin/env bats
|
|
# Seam: Caddyfile validity.
|
|
#
|
|
# There is exactly one Caddy in the homelab: the container on dankclaw
|
|
# (dankclaw/compose.yaml, service 'caddy'). It fronts every service on both
|
|
# hosts — local services by container name, dankserver services by published
|
|
# LAN port. Site blocks use the flat franksdank.cloud / franksdank.casa
|
|
# convention. The basicauth hash is a placeholder in git; deploy.sh renders
|
|
# the real hash from the host .env (CADDY_BASICAUTH_HASH).
|
|
|
|
load helpers
|
|
|
|
CADDYFILE="$REPO_ROOT/dankclaw/Caddyfile"
|
|
|
|
@test "the Caddyfile lives on dankclaw only (Caddy is consolidated there)" {
|
|
[ -f "$CADDYFILE" ]
|
|
[ ! -f "$REPO_ROOT/dankserver/Caddyfile" ]
|
|
}
|
|
|
|
@test "the Caddyfile uses the flat franksdank.cloud hostname convention" {
|
|
grep -qE '\.franksdank\.cloud' "$CADDYFILE"
|
|
}
|
|
|
|
@test "no .local vhost names remain in the Caddyfile" {
|
|
! grep -qE '^([a-z0-9.-]+\.)?(dankserver|dankclaw)\.local[[:space:]]*\{' \
|
|
"$CADDYFILE"
|
|
}
|
|
|
|
@test "the Caddyfile has balanced braces" {
|
|
local open close
|
|
open=$(grep -o '{' "$CADDYFILE" | wc -l)
|
|
close=$(grep -o '}' "$CADDYFILE" | wc -l)
|
|
[ "$open" -eq "$close" ] || { echo "unbalanced braces ($open vs $close)"; return 1; }
|
|
}
|
|
|
|
@test "caddy validate passes when caddy is available" {
|
|
if command -v caddy >/dev/null 2>&1; then
|
|
caddy validate --config "$CADDYFILE" --adapter caddyfile
|
|
else
|
|
skip "caddy binary not installed locally"
|
|
fi
|
|
}
|
|
|
|
@test "homepage basic auth exists in the Caddyfile" {
|
|
grep -qiE 'basicauth|basic_auth' "$CADDYFILE"
|
|
}
|
|
|
|
@test "the Caddyfile carries the renderable basicauth placeholder" {
|
|
grep -q 'REPLACE_WITH_HASH' "$CADDYFILE"
|
|
}
|
|
|
|
@test "compose no longer defines the quadlet-replaced services" {
|
|
# gitea, its postgres, and open-webui run as boot-persistent quadlets on
|
|
# dankclaw (see dankclaw/gitea/quadlet, dankclaw/open-webui/quadlet).
|
|
! grep -qE '^\s+(gitea|postgres|openwebui):\s*$' "$REPO_ROOT/dankclaw/compose.yaml"
|
|
}
|
|
|
|
@test "the caddy service healthcheck probes the bare-IP catch-all" {
|
|
grep -q 'curl.*-sf.*http://localhost:80/' "$REPO_ROOT/dankclaw/compose.yaml"
|
|
}
|