[repo] NixOS and docs: ianitor-caddy-guard with caddy-fallback, caddy-revert after every control stop, admin socket only for control, Caddy trial deadline in the engine-switch VM test, trusted proxies stay off beside Caddy

This commit is contained in:
2026-11-08 12:04:14 +01:00
parent 23a283ece9
commit 457aea86ca
6 changed files with 80 additions and 13 deletions
+21
View File
@@ -157,6 +157,27 @@ in
assert wait_apply(server, t, r["apply"]["id"])["state"] == "kept"
server.succeed("curl -s -o /dev/null -w '%{http_code}' --cacert ${testRoot}/domi-root.crt --resolve two.test:443:127.0.0.1 https://two.test/ | grep -q 200")
# The trial's deadline under Caddy does not depend on control (fix round 2, B2): the guard
# runs with Caddy, only control may use Caddy's admin socket, and a control killed during
# the watch leaves Caddy on the last good config (ExecStopPost=caddy-revert).
server.succeed("systemctl is-active ianitor-caddy-guard.service")
server.fail("runuser -u ianitor-edge -- test -w /run/caddy-fallback/admin.sock")
server.succeed("runuser -u ianitor-control -- test -w /run/caddy-fallback/admin.sock")
r = api(server, t, "POST", "/hosts", {"host": {
"hostname": "three.test", "upstreams": ["http://127.0.0.1:8000"], "tls": "domi", "auth": "none"}})
three = r["apply"]["id"]
for _ in range(60):
if api(server, t, "GET", f"/applies/{three}").get("state") == "watching":
break
time.sleep(0.5)
assert visit(server, "three.test") == "200", "the trial serves"
server.succeed("systemctl kill --signal=KILL ianitor-control.service")
server.wait_until_fails("curl -s -o /dev/null -w '%{http_code}' --cacert ${testRoot}/domi-root.crt --resolve three.test:443:127.0.0.1 https://three.test/ | grep -q 200", timeout=10)
server.wait_for_unit("ianitor-control.service")
server.wait_until_succeeds(f"curl -sf -H 'Authorization: Bearer {t}' http://127.0.0.1:7878/api/v1/overview")
assert wait_apply(server, t, three)["state"] == "reverted"
assert visit(server, "two.test") == "200"
api(server, t, "POST", "/engine", {"target": "pingora"})
server.wait_until_succeeds(
f"curl -s -H 'Authorization: Bearer {t}' http://127.0.0.1:7878/api/v1/engine | jq -e '.running == \"pingora\" and .state == \"running\"'"