From e6dcad143db2c4b9266d3f4a7ffefa969be08a01 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Apr 2026 13:39:30 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20[nomad-step-5]=20S5-fix-7=20=E2=80=94=20?= =?UTF-8?q?staging=20port=2080=20collides=20with=20edge;=20staging=20shoul?= =?UTF-8?q?d=20use=20dynamic=20port=20(#1018)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- docker/edge/entrypoint-edge.sh | 7 +++++ nomad/jobs/edge.hcl | 52 ++++++++++++++++++++++++++++++++++ nomad/jobs/staging.hcl | 9 +++--- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/docker/edge/entrypoint-edge.sh b/docker/edge/entrypoint-edge.sh index 1b5f94f..6db96b7 100755 --- a/docker/edge/entrypoint-edge.sh +++ b/docker/edge/entrypoint-edge.sh @@ -234,6 +234,13 @@ fi rm -f "$_fetch_log" done) & +# Nomad template renders Caddyfile to /local/Caddyfile via service discovery; +# copy it into the expected location if present (compose uses the mounted path). +if [ -f /local/Caddyfile ]; then + cp /local/Caddyfile /etc/caddy/Caddyfile + echo "edge: using Nomad-rendered Caddyfile from /local/Caddyfile" >&2 +fi + # Caddy as main process — run in foreground via wait so background jobs survive # (exec replaces the shell, which can orphan backgrounded subshells) caddy run --config /etc/caddy/Caddyfile --adapter caddyfile & diff --git a/nomad/jobs/edge.hcl b/nomad/jobs/edge.hcl index 1f3e855..779b53b 100644 --- a/nomad/jobs/edge.hcl +++ b/nomad/jobs/edge.hcl @@ -114,6 +114,58 @@ job "edge" { read_only = false } + # ── Caddyfile via Nomad service discovery (S5-fix-7, issue #1018) ──── + # Renders staging upstream from Nomad service registration instead of + # hardcoded staging:80. Caddy picks up /local/Caddyfile via entrypoint. + template { + destination = "local/Caddyfile" + change_mode = "restart" + data = <