fix: correct shard manager address format for RunnerAddress - #2
Open
railway-app[bot] wants to merge 11 commits into
Open
fix: correct shard manager address format for RunnerAddress#2railway-app[bot] wants to merge 11 commits into
railway-app[bot] wants to merge 11 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.
Effect Cluster's NodeClusterShardManagerSocket layerSocketServer binds to config.shardManagerAddress (default localhost:8080). With Cap upstream's SST infra they set SHARD_MANAGER_HOST=0.0.0.0 env var to override, but that mapping isn't reliably resolving on Railway. Hardcoding the bind address in shardingConfig works regardless of env-var conventions.
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 shard manager was crashing with a ParseError because
RunnerAddress.make()was called with an object{host: "0.0.0.0", port: 8080}, but the schema expects aNonEmptyStringin the format"host:port".Solution
Replaced the object argument with a properly formatted string
"0.0.0.0:8080", constructed from aSHARD_MANAGER_HOSTenv var (defaulting to"0.0.0.0") and the hardcoded port 8080. This ensures the shard manager binds to all interfaces and is reachable from other containers viacap-shard-manager.railway.internal:8080.Changes
apps/web-cluster/src/shard-manager.tsGenerated by Railway