Skip to content

fix: give the MCP service its own railway.json (it was building the backend Dockerfile)#320

Merged
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/mcp-service-railway-config
Jun 12, 2026
Merged

fix: give the MCP service its own railway.json (it was building the backend Dockerfile)#320
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/mcp-service-railway-config

Conversation

@DevanshuNEU

@DevanshuNEU DevanshuNEU commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

The MCP service (mcp.opencodeintel.com) has been failing every deploy since #296 (~2 months) and is frozen on that stale image. Deploy logs show:

Error loading ASGI app. Could not import module "main".

repeated until all 11 healthcheck attempts fail with "service unavailable".

Root cause

There is a single repo-root railway.json that is backend-specific:

"build": { "dockerfilePath": "backend/Dockerfile", "buildContext": "backend" },
"deploy": { "healthcheckPath": "/health", ... }

Railway feeds this config to both services by default. The backend service reads it correctly. The MCP service inherits it and builds backend/Dockerfile, whose CMD is uvicorn main:app -- but mcp-server/ has no main.py, only server.py. So uvicorn crashes at boot on every MCP deploy.

The MCP code itself is fine: mcp-server/server.py reads $PORT via config.py and serves a public /health route. The only problem is which Dockerfile Railway builds for that service.

Fix

Stop the two services from sharing one backend-shaped config. Add a dedicated mcp-server/railway.json that builds mcp-server/Dockerfile with its own /health healthcheck. The backend service keeps reading the repo-root railway.json unchanged (it was just restored in #319; not touching it).

Deliberately not doing what Railway's auto-diagnosis suggested (stripping dockerfilePath from the root railway.json) -- that would remove the backend's build + healthcheck config and risk re-breaking the service #319 just fixed.

Activation (required, manual)

This file is inert until the MCP service is pointed at it. In the Railway dashboard:
MCP service (marvelous-endurance) -> Settings -> Config-as-code file path -> mcp-server/railway.json, then redeploy. The backend service is left on the repo-root railway.json.

Testing

  • Confirmed mcp-server/Dockerfile runs python server.py (not uvicorn main:app) and its healthcheck already uses ${PORT:-8080}.
  • Confirmed server.py binds $PORT and registers a public /health route.
  • Real validation: the next MCP deploy after the config-path change should pass healthcheck on $PORT.

Summary by CodeRabbit

  • Chores
    • Configured MCP server deployment infrastructure with automated health monitoring and failure recovery mechanisms.

…r/Dockerfile

The repo-root railway.json is backend-specific (dockerfilePath: backend/Dockerfile).
Railway feeds it to both services by default, so the MCP service was building the
backend image and running `uvicorn main:app` -- but mcp-server/ has no main.py, only
server.py. Every MCP deploy since OpenCodeIntel#296 crashed at boot ("Could not import module main")
and failed healthcheck, leaving the service frozen on a 2-month-old image. This adds a
dedicated mcp-server/railway.json (build mcp-server/Dockerfile, healthcheck /health) so
the two services stop sharing one backend-shaped config.

Activation: set the MCP service's config-as-code path to mcp-server/railway.json in the
Railway dashboard; the backend service keeps reading the repo-root railway.json.
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@DevanshuNEU, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 44 minutes and 34 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2650628f-bb15-4365-bc80-be2e5298aa95

📥 Commits

Reviewing files that changed from the base of the PR and between 435c4e3 and 61e4ad3.

📒 Files selected for processing (1)
  • mcp-server/railway.json
📝 Walkthrough

Walkthrough

This PR introduces a Railway deployment configuration file for the MCP server, specifying Docker build context, healthcheck endpoint targeting /health with a 300-second timeout, and deployment restart policies with a maximum of 10 retries on failure.

Changes

Railway MCP Server Deployment

Layer / File(s) Summary
Railway deployment configuration
mcp-server/railway.json
Railway configuration JSON specifies Docker-based build context (mcp-server), healthcheck endpoint (/health, 300s timeout), and restart policy (ON_FAILURE, max 10 retries).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • OpenCodeIntel/opencodeintel#310: Modifies mcp-server/railway.json's deploy settings by removing startCommand to fix healthcheck/start behavior.
  • OpenCodeIntel/opencodeintel#284: Adds Dockerfile and health endpoint changes for the MCP server that work alongside this Railway configuration's healthcheck targeting /health.

Poem

🐰 A config so small, yet mighty and true,
Railway awaits what the MCP will do,
Health checks and restarts in JSON so neat,
One file, complete, makes deployment sweet! 🚂✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: providing a dedicated railway.json configuration file for the MCP service instead of it incorrectly using the backend Dockerfile.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mcp-server/railway.json`:
- Around line 4-6: The railway.json currently uses an unsupported "buildContext"
key; remove that key and rely on supported fields ("builder" and
"dockerfilePath") instead, then ensure the Docker build uses the correct source
by either moving the Dockerfile/Docker build context so dockerfilePath points at
the desired root (e.g., place Dockerfile at repository root or adjust
dockerfilePath to the correct location) and/or update mcp-server/Dockerfile
COPY/ADD paths to be source-root-agnostic; check and update "builder" and
"dockerfilePath" in railway.json and the mcp-server/Dockerfile COPY/ADD lines to
guarantee the intended files are available during build.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 40d4e015-aed5-4402-9791-4839befaa7b1

📥 Commits

Reviewing files that changed from the base of the PR and between 8afb4e5 and 435c4e3.

📒 Files selected for processing (1)
  • mcp-server/railway.json

Comment thread mcp-server/railway.json Outdated
CodeRabbit flagged buildContext as unsupported. Confirmed against Railway's
config schema: supported build keys are builder, watchPatterns, buildCommand,
dockerfilePath, railpackVersion. buildContext was silently ignored. Railway sets
the Docker build context via the service Root Directory, not a config key, so the
MCP service must set Root Directory=mcp-server in the dashboard; with that, the
context is mcp-server/ and the Dockerfile is auto-detected, so dockerfilePath is
dropped too (a repo-root-relative path is wrong inside the restricted context).
Keeps only supported keys + the deploy healthcheck block.
@DevanshuNEU

Copy link
Copy Markdown
Collaborator Author

Addressed the buildContext review finding. Verified against Railway's config schema: supported build keys are builder, watchPatterns, buildCommand, dockerfilePath, railpackVersion -- buildContext is not one and was silently ignored. Removed it.

Railway sets the Docker build context via the Root Directory service setting ("only pulls down files from that directory"), not a config key. So the build context comes from setting Root Directory = mcp-server; with that, the context is already mcp-server/, the Dockerfile is auto-detected at the context root, and the Dockerfile's COPY . . / COPY requirements.txt . resolve correctly with no edits. A repo-root-relative dockerfilePath: mcp-server/Dockerfile would be wrong inside that restricted context, so it's dropped too. Config now keeps only supported keys + the deploy healthcheck block.

Corrected activation (dashboard, after merge), both required:

  1. MCP service -> Settings -> Root Directory = mcp-server (sets build context; this is what stops it building backend/Dockerfile).
  2. MCP service -> Settings -> Railway Config File = mcp-server/railway.json (repo-root-absolute path; it does not follow Root Directory).
    Then redeploy. The backend service is untouched (still on the repo-root railway.json).

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
opencodeintel Ignored Ignored Preview Jun 12, 2026 12:36am

@DevanshuNEU DevanshuNEU merged commit 1c5a935 into OpenCodeIntel:main Jun 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant