Repository navigation
chore(compose): make the stack's network, image and ports overridable - #295
Merged
Merged
Conversation
Every checkout brought up the same stack: the Compose network pinned to app_default, the image tagged `web`, and Traefik, Temporal and the OTLP collector publishing fixed host ports. A second checkout — a worktree under review — could not run beside the first. It either failed to bind a port or, worse, resolved db/redis/web to the first stack's containers and quietly tested a branch against the wrong database. Removing the network pin was the obvious move and the wrong one: agent containers are created outside Compose and join the network by name (Settings.docker.network), .devcontainer attaches to it, and Traefik resolves container addresses on it — a Compose-generated, directory-derived name is known to none of them. And the network is only a tenth of the problem while the host ports stay fixed. So every global is now a variable with its current value as the default: DOCKER_NETWORK (which web/worker also pass to Rails, so agent containers land on their own stack's network), WEB_IMAGE, and one *_HOST_PORT per published port. The Traefik router for /api is keyed on the network instead of being called `web`, so two stacks watching the same Docker socket don't both register the same router name. `docker compose config` renders byte-identical defaults; isolation is opt-in through a .env in the worktree. Documented for agents in docs/project/worktree-stack.md, which also covers what isolation does not fix (Google's :4000-only redirect URI) and what it does (a worktree suite gets its own Postgres, so it no longer has to wait on the main checkout's — the make flock is repo-relative and never serialized across checkouts anyway). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
The previous commit explained each variable twice: once in docs/project/worktree-stack.md and again beside the line it changed. The comments restated the variable names and duplicated a document that will be maintained, so they were the copy guaranteed to go stale. Removed from docker-compose.yml, .env.example and .devcontainer/devcontainer.json; one two-line note stays on the network pin, which is the thing a reader is most likely to delete without knowing agent containers join it by name. CLAUDE.md gains the rule this applies: default to no comment, and write one only when a competent reader would get the code wrong without it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 26, 2026
Signed-off-by: Alex <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 27, 2026
…294 inside, #290 gates, suspended backfill Signed-off-by: Alex <[email protected]>
NOX73
added a commit
that referenced
this pull request
Nov 27, 2026
…295) (#904) * docs(integrations): tech design for integrations chosen per session (#295) Signed-off-by: Alex <[email protected]> * docs(integrations): update tech design for #295 after review round 1 Signed-off-by: Alex <[email protected]> * Design: address review findings on session integrations (restore, Coder identity, tenant checks, backfill) Signed-off-by: Alex <[email protected]> * docs(integrations): design round 4 for #295: no Coder identity rules, #294 inside, #290 gates, suspended backfill Signed-off-by: Alex <[email protected]> * docs(integrations): fix models test line in session integrations design Signed-off-by: Alex <[email protected]> --------- Signed-off-by: Alex <[email protected]> Co-authored-by: Alex <[email protected]>
This was referenced Nov 27, 2026
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.
Why
Every checkout brings up the same stack: the Compose network is pinned to
app_default, the image is taggedweb, and Traefik, Temporal and the OTLP collector publish fixed host ports. Two checkouts started that way don't run side by side — they fight. The second one either fails to bind a port or, worse, silently resolvesdb,redisandwebto the first stack's containers, so a branch appears to pass against the wrong database.The obvious fix — drop the
networks.default.namepin and let Compose name the network after the directory — is the wrong one:ContainerStrategies::BaseStrategy→Settings.docker.network, defaultapp_default); a directory-derived name is unknown to them, anddocker createfails with network not found.devcontainer/devcontainer.jsonattaches to it by name--providers.docker.network)80/443/8090,7233,8080and4318stay fixed, so the second stack still dies on a port bindWhat changed
Every global is now a variable with its current value as the default, so nothing changes unless you opt in:
DOCKER_NETWORKapp_defaultdb/redis/webresolve to the other stack; also passed to web+worker so agent containers join their own stack's networkWEB_IMAGEwebTEMPORAL_HOST_PORT,TEMPORAL_UI_HOST_PORT7233,8080temporal:7233, hence the distinct name)OTLP_HOST_PORT4318HTTP_HOST_PORT,HTTPS_HOST_PORT,TRAEFIK_DASHBOARD_HOST_PORT80,443,8090PORT/VITE_RUBY_PORT/MCP_PORTwere already overridable and are unchanged.The Traefik router for
/apiis keyed on the network (<network>-api) instead of being calledweb, so two stacks watching the same Docker socket don't both register a router namedweb. Agent routers are already unique (terminal-<route_token>).Docs
docs/project/worktree-stack.md(new, indexed) — the procedure, the variable table, and the traps: Google sign-in is registered for:4000only; both Traefiks watch the same socket and log about each other's containers; the worker doesn't autoreload; don't kill containers byancestor=web.CLAUDE.md— a short "Working in a git worktree" section pointing at it, since an agent starting Compose from a worktree is the case that silently corrupts the main checkout's database today..env.example— the block ready to uncomment, with a note that Compose reads.envonly, never.env.development.One payoff worth calling out: CLAUDE.md bans two concurrent backend test runs that share a Postgres. An isolated stack has its own
dbcontainer and its ownaixle_test-Ndatabases, so a worktree suite no longer has to wait — and it never was serialized anyway, because themakeflock attmp/.rails-test.lockis repo-relative.Verification
docker compose configrenders byte-identical defaults todevelop; with the worktree block set, every name and port moves as expected:No Ruby or JS changed. CI is unaffected:
code-check.ymlsetsCOMPOSE_FILE: docker-compose.ci.ymland never reads this file.🤖 Generated with Claude Code