fix: bind shard manager to 0.0.0.0 for inter-container connectivity - #1
Open
railway-app[bot] wants to merge 10 commits into
Open
fix: bind shard manager to 0.0.0.0 for inter-container connectivity#1railway-app[bot] wants to merge 10 commits into
railway-app[bot] wants to merge 10 commits into
Conversation
Railway's Buildkit rejects `# syntax=docker.io/docker/dockerfile:1`. Default frontend works fine for this multi-stage build.
Railway sub-directory deploys (rootDirectory=apps/media-server) need the standalone Dockerfile whose COPY paths are relative to apps/media-server, not the root Dockerfile that expects repo-root paths.
Railway's Railpack builder rejects `--mount=type=cache,id=pnpm,...` without a cacheKey prefix on the id. Dropping the cache mount; build is slower but correct.
Same Railway Railpack constraint as apps/web/Dockerfile — id=pnpm without cacheKey prefix is rejected.
…full command Railway's startCommand exec's the literal string and does NOT append to a Docker ENTRYPOINT. With `ENTRYPOINT ["deno", "run", "--allow-all"]` Railway tries to run the startCommand as a file path, getting "permission denied". Removing ENTRYPOINT means startCommand becomes the CMD via shell, so `deno run --allow-all src/runner/index.ts` works as expected.
Railway's startCommand fights with multi-word commands (treats whole string
as executable path). Switching strategy: hardcode CMD in Dockerfile to invoke
deno + ${CLUSTER_ENTRY}. Each service sets CLUSTER_ENTRY env var (default =
runner) so no startCommand override needed.
…er Dockerfile Railway's startCommand override mechanism keeps fighting multi-word commands on this Deno-based image. Hardcoding the CMD per Dockerfile sidesteps the fight entirely. This Dockerfile is now Runner-only; ShardManager gets its own Dockerfile.shard-manager.
Variant of apps/web-cluster/Dockerfile whose only difference is the final CMD points at src/shard-manager.ts instead of src/runner/index.ts.
post-deploy.ts merges publishConfig into the deployed package.json. Without publishConfig.exports, the deployed package keeps `exports: "./src/index.ts"` and Deno tries to load TS source from node_modules, hitting ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING and crashing the runner. Mirroring the pattern @cap/database uses.
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.
Problem
The Cap Shard Manager was binding exclusively to 127.0.0.1:8080 (loopback) because
NodeClusterShardManagerSocket.layer()inapps/web-cluster/src/shard-manager.tshad nohostconfigured, causing it to default to localhost. This made the shard manager unreachable from the Cap Workflow Runner container viacap-shard-manager.railway.internal:8080.Solution
Added a
hostfield to theNodeClusterShardManagerSocket.layer()options, read from theSHARD_MANAGER_HOSTenvironment variable with a default of"0.0.0.0". This causes the shard manager to bind to all interfaces by default, making it reachable from other containers over the internal Railway network. The bind address can still be overridden to127.0.0.1via the env var if loopback-only is ever needed.Changes
apps/web-cluster/src/shard-manager.tsGenerated by Railway