authoravatarclover caruso<git@paperclover.net>2026-10-16 23:38:17-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-21 02:52:29-07:00
log9e6a14a98ddc7c01cb7ff7713552587970f90edc
treeb51c1f6c36172c621e1207bf2641bd01f987ef64
parent177bee2d01caa9e04999d5633b55103cbceccc49
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Check isolated dashboard listener without exposing its proxy proof

Keep the preview health check independent of proxy authentication so Nomad can register the route. Verify the real sign-in path through Caddy after registration. Assisted-by: gpt-6.1-sol

2 files changed, 7 insertions(+), 2 deletions(-)

tools/dashboard-stage-test.py+6-1
......@@ -113,9 +113,14 @@ class PreviewProof(unittest.TestCase):
113113 def exists(path):
114114 return str(path).startswith("/run/snowglobe-preview/") and path.name == "host.sock" or original_exists(path)
115115
116 with patch.object(stage.snowglobe, "STATE", state), patch.object(stage.snowglobe, "REPO", root / "releases/1234567890abcdef"), patch.object(stage.snowglobe, "token"), patch.object(stage.snowglobe, "identity", return_value=os.getuid()), patch.object(stage.snowglobe, "check_staging_pool"), patch.object(stage.snowglobe, "check_http"), patch.object(stage.snowglobe, "command", side_effect=command), patch.object(stage.subprocess, "run", side_effect=run), patch.object(stage.os, "chown") as chown, patch.object(stage.snowglobe.transition, "host_environment", return_value="PATH=/bin"), patch.object(stage.snowglobe.transition, "stop_preview"), patch.object(Path, "exists", exists), redirect_stdout(io.StringIO()):
116 with patch.object(stage.snowglobe, "STATE", state), patch.object(stage.snowglobe, "REPO", root / "releases/1234567890abcdef"), patch.object(stage.snowglobe, "token"), patch.object(stage.snowglobe, "identity", return_value=os.getuid()), patch.object(stage.snowglobe, "check_staging_pool"), patch.object(stage.snowglobe, "check_http") as check_http, patch.object(stage.snowglobe, "command", side_effect=command), patch.object(stage.subprocess, "run", side_effect=run), patch.object(stage.os, "chown") as chown, patch.object(stage.snowglobe.transition, "host_environment", return_value="PATH=/bin"), patch.object(stage.snowglobe.transition, "stop_preview"), patch.object(Path, "exists", exists), redirect_stdout(io.StringIO()):
117117 stage.stage()
118 check_http.assert_called_once_with(jobs[-1]["ID"] + ".fixture.test", "/sign-in", True)
118119 task = jobs[-1]["TaskGroups"][0]["Tasks"][0]
120 check = jobs[-1]["TaskGroups"][0]["Services"][0]["Checks"][0]
121 self.assertEqual(check["Type"], "tcp")
122 self.assertNotIn("Path", check)
123 self.assertNotIn("Header", check)
119124 directory = root / "srv/staging" / jobs[-1]["ID"]
120125 proof = directory / "proxy.token"
121126 value = proof.read_text()
tools/dashboard-stage.py+1-1
......@@ -174,7 +174,7 @@ def stage():
174174 "Meta": {"snowglobe_service": "dashboard", "snowglobe_name": "Snow Globe preview", "snowglobe_hostname": hostname},
175175 "TaskGroups": [{"Name": "app", "Count": 1, "Networks": [{"Mode": "host", "DynamicPorts": [{"Label": "http", "HostNetwork": "loopback"}]}],
176176 "Services": [{"Name": identity, "Provider": "nomad", "PortLabel": "http", "TaskName": "app", "Tags": ["caddy-host=" + hostname],
177 "Checks": [{"Name": "Dashboard sign-in", "Type": "http", "Path": "/sign-in", "Interval": 10000000000, "Timeout": 5000000000}]}],
177 "Checks": [{"Name": "Dashboard listener", "Type": "tcp", "Interval": 10000000000, "Timeout": 5000000000}]}],
178178 "Tasks": [{"Name": "app", "Driver": "podman", "User": str(saved["uid"]) + ":" + str(saved["uid"]), "Env": env,
179179 "Config": {"image": image, "network_mode": "host", "cap_drop": ["ALL"], "security_opt": ["no-new-privileges"],
180180 "volumes": [str(root / "data") + ":/data:rw", str(root / "files") + ":/srv:rw,rslave", runtime + ":/run/snowglobe-host:ro",