Phase 1 of the local-DNS-name work. Users type a name, not a port. - dnsmasq quadlet on dankclaw (rootless, slirp4netns, port 53 published): serves the flat name scheme from addn-hosts, upstream 1.1.1.1/1.0.0.1. Image built from the in-repo Containerfile (localhost/dnsmasq:latest). - Caddyfiles (both hosts): all *.dankclaw.local / *.dankserver.local vhosts renamed to flat <service>.franksdank.cloud. Explicit http:// site addresses for now; TLS (wildcard LE via DNS-01/Porkbun) lands in phase 2. - Drift reconciliation (live /etc/caddy/Caddyfile on dankserver differs from the repo): added the live-only llms.franksdank.cloud vhost (OpenWebUI on :3000). Dropped the legacy search vhost from dankserver (the name belongs to dankclaw's gluetun-routed SearXNG; the legacy instance stays reachable at 192.168.0.235:8081). - Homepage service links updated to the new names. - New test seams (TDD): tests/dnsmasq.bats (quadlet boot-persistence, port 53, conf/record validity, Caddyfile<->addn-hosts cross-check on the right host IPs); caddyfile.bats naming-convention tests updated. LAN clients get this DNS from the SURFboard G36 (DNS Relay -> statically configured -> 192.168.0.143); the router change is a pending user step.
47 lines
1.7 KiB
Bash
47 lines
1.7 KiB
Bash
#!/usr/bin/env bats
|
|
# Seam: Caddyfile validity.
|
|
# Each host must have a Caddyfile. Site blocks must reference services by the
|
|
# hostname convention (*.dankserver.local / *.dankclaw.local) and must proxy to
|
|
# reachable upstreams. When caddy(1) exists locally we run `caddy validate`;
|
|
# otherwise we do structural checks.
|
|
|
|
load helpers
|
|
|
|
@test "a Caddyfile exists for dankserver and dankclaw" {
|
|
[ -f "$REPO_ROOT/dankserver/Caddyfile" ]
|
|
[ -f "$REPO_ROOT/dankclaw/Caddyfile" ]
|
|
}
|
|
|
|
@test "Caddyfiles use the flat franksdank.cloud hostname convention" {
|
|
grep -qE '\.franksdank\.cloud' "$REPO_ROOT/dankserver/Caddyfile"
|
|
grep -qE '\.franksdank\.cloud' "$REPO_ROOT/dankclaw/Caddyfile"
|
|
}
|
|
|
|
@test "no .local vhost names remain in either Caddyfile" {
|
|
! grep -qE '^([a-z0-9.-]+\.)?(dankserver|dankclaw)\.local[[:space:]]*\{' \
|
|
"$REPO_ROOT/dankserver/Caddyfile" "$REPO_ROOT/dankclaw/Caddyfile"
|
|
}
|
|
|
|
@test "Caddyfiles have balanced braces" {
|
|
for f in "$REPO_ROOT/dankserver/Caddyfile" "$REPO_ROOT/dankclaw/Caddyfile"; do
|
|
local open close
|
|
open=$(grep -o '{' "$f" | wc -l)
|
|
close=$(grep -o '}' "$f" | wc -l)
|
|
[ "$open" -eq "$close" ] || { echo "$f: unbalanced braces ($open vs $close)"; return 1; }
|
|
done
|
|
}
|
|
|
|
@test "caddy validate passes when caddy is available" {
|
|
if command -v caddy >/dev/null 2>&1; then
|
|
caddy validate --config "$REPO_ROOT/dankserver/Caddyfile" --adapter caddyfile
|
|
caddy validate --config "$REPO_ROOT/dankclaw/Caddyfile" --adapter caddyfile
|
|
else
|
|
skip "caddy binary not installed locally"
|
|
fi
|
|
}
|
|
|
|
@test "homepage basic auth exists in the Caddyfiles" {
|
|
grep -qiE 'basicauth|basic_auth' "$REPO_ROOT/dankserver/Caddyfile"
|
|
grep -qiE 'basicauth|basic_auth' "$REPO_ROOT/dankclaw/Caddyfile"
|
|
}
|