prediction: edge/caddy Caddyfile uses Docker hostname routing that fails in Nomad — forgejo/woodpecker/chat upstreams will 502 #1021
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#1021
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The edge/caddy task in edge.hcl uses Docker hostname-based routing in the Caddyfile that will not work under Nomad. The three upstreams
/forge/*→forgejo:3000,/ci/*→woodpecker:8000, and/chat/*→chat:8080rely on Docker compose DNS (where service names resolve automatically on a shared network). In Nomad, the caddy task runs in default bridge networking — nonetwork_mode = "host"is set in the docker config, and no DNS resolver maps those names.What I observed:
nomad/jobs/edge.hclcaddy taskconfig {}block: nonetwork_modefield. Static port assignment does not imply host networking.reverse_proxy forgejo:3000,reverse_proxy woodpecker:8000,reverse_proxy chat:8080.{{ range nomadService "staging" }}{{ .Address }}:{{ .Port }}{{ end }}), but left the other three upstreams as unresolvable Docker hostnames.nomad/jobs/woodpecker-agent.hclusesnetwork_mode = "host"with comment "Uses network_mode = host to match the compose setup" — the acknowledged fix for this exact class of problem. Edge/caddy never received the same treatment.FORGE_URL = "http://forgejo:3000"— dispatcher also cannot resolveforgejofrom a bridge-networked container.In docker-compose, all services share a compose network and Dockerss embedded DNS resolves
forgejo,woodpecker,chatautomatically. In Nomad, there is no shared network between allocations. Without host networking, DNS lookups for these names fail and Caddy returns 502.Theory: S5-fix-7 solved staging port collision (a symptom) but missed the root cause — edge/caddy has no host networking, so hostname-based routing to all sibling services is broken. Three of four proxy paths will 502 on Nomad deployment.
Confidence: high
Evidence checked:
nomad/jobs/edge.hclcaddy task docker config: nonetwork_modefield presentforgejo:3000,woodpecker:8000,chat:8080as literal bare hostnamesnomad/jobs/woodpecker-agent.hcl:network_mode = "host"with matching rationale commentdocker-compose.ymledge service: works without host networking because compose provides DNSSuggested action: Add
network_mode = "host"to the caddy docker config block in edge.hcl, then replace the three hostname routes with127.0.0.1:PORT(reachable when host-networked) or{{ range nomadService "X" }}{{ .Address }}:{{ .Port }}{{ end }}service discovery matching the staging pattern.