| author | |
| committer | |
| log | 9e6a14a98ddc7c01cb7ff7713552587970f90edc |
| tree | b51c1f6c36172c621e1207bf2641bd01f987ef64 |
| parent | 177bee2d01caa9e04999d5633b55103cbceccc49 |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU |
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-sol2 files changed, 7 insertions(+), 2 deletions(-)
tools/dashboard-stage-test.py+6-1| ... | @@ -113,9 +113,14 @@ class PreviewProof(unittest.TestCase): | ... | @@ -113,9 +113,14 @@ class PreviewProof(unittest.TestCase): |
| 113 | def exists(path): | 113 | def exists(path): |
| 114 | return str(path).startswith("/run/snowglobe-preview/") and path.name == "host.sock" or original_exists(path) | 114 | return str(path).startswith("/run/snowglobe-preview/") and path.name == "host.sock" or original_exists(path) |
| 115 | 115 | ||
| 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()): |
| 117 | stage.stage() | 117 | stage.stage() |
| 118 | check_http.assert_called_once_with(jobs[-1]["ID"] + ".fixture.test", "/sign-in", True) | ||
| 118 | task = jobs[-1]["TaskGroups"][0]["Tasks"][0] | 119 | 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) | ||
| 119 | directory = root / "srv/staging" / jobs[-1]["ID"] | 124 | directory = root / "srv/staging" / jobs[-1]["ID"] |
| 120 | proof = directory / "proxy.token" | 125 | proof = directory / "proxy.token" |
| 121 | value = proof.read_text() | 126 | value = proof.read_text() |
tools/dashboard-stage.py+1-1| ... | @@ -174,7 +174,7 @@ def stage(): | ... | @@ -174,7 +174,7 @@ def stage(): |
| 174 | "Meta": {"snowglobe_service": "dashboard", "snowglobe_name": "Snow Globe preview", "snowglobe_hostname": hostname}, | 174 | "Meta": {"snowglobe_service": "dashboard", "snowglobe_name": "Snow Globe preview", "snowglobe_hostname": hostname}, |
| 175 | "TaskGroups": [{"Name": "app", "Count": 1, "Networks": [{"Mode": "host", "DynamicPorts": [{"Label": "http", "HostNetwork": "loopback"}]}], | 175 | "TaskGroups": [{"Name": "app", "Count": 1, "Networks": [{"Mode": "host", "DynamicPorts": [{"Label": "http", "HostNetwork": "loopback"}]}], |
| 176 | "Services": [{"Name": identity, "Provider": "nomad", "PortLabel": "http", "TaskName": "app", "Tags": ["caddy-host=" + hostname], | 176 | "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}]}], |
| 178 | "Tasks": [{"Name": "app", "Driver": "podman", "User": str(saved["uid"]) + ":" + str(saved["uid"]), "Env": env, | 178 | "Tasks": [{"Name": "app", "Driver": "podman", "User": str(saved["uid"]) + ":" + str(saved["uid"]), "Env": env, |
| 179 | "Config": {"image": image, "network_mode": "host", "cap_drop": ["ALL"], "security_opt": ["no-new-privileges"], | 179 | "Config": {"image": image, "network_mode": "host", "cap_drop": ["ALL"], "security_opt": ["no-new-privileges"], |
| 180 | "volumes": [str(root / "data") + ":/data:rw", str(root / "files") + ":/srv:rw,rslave", runtime + ":/run/snowglobe-host:ro", | 180 | "volumes": [str(root / "data") + ":/data:rw", str(root / "files") + ":/srv:rw,rslave", runtime + ":/run/snowglobe-host:ro", |