fix(docker): point mcp-server at the neo4j service, widen the healthcheck start period - #61
Merged
Merged
Conversation
… unhealthy Two of the three points in #54. mcp-server only read NEO4J_URI from .env, and .env.example ships bolt://localhost:7687, which is correct on the host but means the container itself once it is on mcp_network. Confirmed from inside the container: neo4j:7687 connects, localhost:7687 is refused. The compose file now overrides it the same way topwr-api overrides MCP_HOST, so the value no longer depends on what an operator happened to put in .env. Checked that the environment block beats env_file when both set the key. .env.example keeps bolt://localhost:7687 on purpose, since `just mcp-server` runs on the host where that is the right address. start_period on the mcp-server healthcheck goes from 15s to 180s. Measured a genuinely cold stack after this fix and the port was open in 6 seconds, so the old value was not obviously wrong here, but a first start on freshly built layers has been reported taking minutes. A successful check ends the start period immediately, so the headroom only ever delays reporting a container that never comes up. Also corrects two stale claims in CLAUDE.md that came up while checking the third point: Dockerfile.prefect no longer pins prefect 2.x (it installs 3.6.11 from uv.lock), and docker/prefect-entrypoint.sh does not exist. Gotcha 9 now describes the real gap instead, which is that nothing in the container runs the scheduled deployment at all.
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.
Points 1 and 3 of #54. Point 3 came out differently than the issue describes, and point 2 turned
out to be partly stale plus a bigger gap underneath, so I left it out and put the question at the
bottom.
1. NEO4J_URI
Confirmed. Checked from inside the running container:
mcp-serveronly read the value from.env, and.env.exampleshipsbolt://localhost:7687. Added anenvironment:override for the service name, same astopwr-apidoes forMCP_HOST, so it doesn't depend on what's in someone's.env. Verified theenvironmentblock beatsenv_filewhen both set the key.Left
.env.examplealone on purpose,bolt://localhost:7687is the right address forjust mcp-serveron the host.3. Healthcheck start_period
Raised 15s to 180s as asked, but the ~4 minutes didn't reproduce here. I took the whole stack
down and brought it back up cold with the URI fix in place:
So on this machine the old 15s was already enough. My guess is the 4 minutes you saw was the
first point: with
localhostthe Neo4j driver retries before giving up, and the server can'tbind until
initialize_rag()returns. Worth re-checking on your side after this lands.I still went with 180s because the cost is one-sided. A successful check ends the start period
immediately, so headroom never slows a healthy container down, it only delays reporting one that
never comes up. If we'd rather detect a dead mcp-server sooner we can bring it down, the
measurement is in the compose comment.
2. Prefect, and a question
I didn't touch this one. Two things I found while checking it:
The version half is already done.
Dockerfile.prefectdoesn't pinprefect==2.*any more, itruns
uv sync --lockedoffpyproject.toml+uv.lock, which resolves to prefect 3.6.11.The part that isn't done is bigger than the issue says. The container never runs the scheduled
deployment at all:
CMDis onlyprefect server startcompose.prefect.ymldoesn't override itserve_refresh/uv run prefect-refreshSo the cron from #51 only exists when someone runs
just refresh-serveon their own machine.CLAUDE.md also points at
docker/prefect-entrypoint.sh("starts Prefect server then runspipeline") and that file isn't in the repo.
And even if we wire the deployment in,
compose.prefect.ymlis a separate stack with noneo4jservice and no link to
mcp_network, so the pipeline has no route to the graph.That last bit is a deployment decision rather than a fix, so: how do you want the two stacks to
relate? Options I can see are a shared external network, folding prefect into
compose.stack.yml,or keeping them separate and giving the pipeline its own Neo4j address. Happy to do whichever,
just don't want to pick for you.
I did correct the two stale CLAUDE.md claims here since I'd verified them, gotcha 9 now describes
the real gap. Shout if you'd rather that moved to the follow-up PR.