feat(proxy): N1 — Caddy route table + labels (spec 05) - #15
Merged
Conversation
internal/proxy is the single source of truth for routing: BuildRoutes derives a
deterministic []Route{project,service,host,port,tls} from every port-exposing
project service when the workspace declares a Caddy proxy (network.proxy.engine:
caddy). CaddyLabels renders the caddy-docker-proxy labels (caddy=<host>,
caddy.reverse_proxy={{upstreams <port>}}, caddy.tls=internal when httpsLocal) to
merge onto each service so adding/removing a project reloads Caddy with no
central-config edit. Host is <service>.<project>.localhost; the primary port is
the "http" port if named else the lowest.
Routing is opt-in (no engine → no routes → `up` unaffected). The same []Route
will render the cloudflared ingress in internal/tunnel (N4) so local and public
routing can't drift; generate wiring (emit the labels) is N5/generate.
Unit-tested: enabled detection (caddy only), disabled→no routes, primary-port +
httpsLocal selection, deterministic ordering, label rendering (with/without TLS),
URL scheme.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chunk N1 (M5) — proxy route table
internal/proxyis the single source of truth for routing (spec 05).BuildRoutesderives a deterministic[]Route{project,service,host,port,tls}from every port-exposing project service when the workspace declares a Caddy proxy (network.proxy.engine: caddy). Host =<service>.<project>.localhost; primary port = thehttpport if named, else the lowest.CaddyLabelsrenders thecaddy-docker-proxylabels (caddy=<host>,caddy.reverse_proxy={{upstreams <port>}},caddy.tls=internalwhenhttpsLocal) to merge onto each service → adding/removing a project reloads Caddy with no central-config edit.upunaffected).The same
[]Routewill render the cloudflared ingress ininternal/tunnel(N4) so local + public routing can't drift; the generate wiring (emit the labels) is N5/generate.Tests
Enabled detection (caddy only), disabled→no routes, primary-port + httpsLocal selection, deterministic ordering, label rendering (±TLS), URL scheme.
Gate
make cigreen (race).🤖 Generated with Claude Code