Skip to content
Deployments from GitHub fail "during network process" – healthcheck never reaches app, but
railway up
deploy works
sonalingowda
OP

a month ago

Service: alphalens (FastAPI/uvicorn, Dockerfile builder), project gallant-creation, production, region US West.

PROBLEM

Deployments triggered from GitHub always fail at the healthcheck stage ("Deployment failed during network process"). Initialization and Build both pass. Healthcheck path is /health/readiness, 11/11 attempts report "service unavailable".

WHAT I VERIFIED

  • The app starts correctly: uvicorn logs "Running on http://0.0.0.0:8000" and "Application startup complete" BEFORE the first probe.
  • The app never receives a healthcheck request. It logs every /health/readiness call, and the failing deployments have zero such log lines, zero HTTP logs and zero network-flow logs during the healthcheck window.
  • An older deployment created with railway up (CLI) on the same service passes the same healthcheck (HTTP 200 from Python-urllib/3.11) and is still serving.
  • Locally (Docker), /health/readiness returns 200, including with "Host: healthcheck.railway.app" and a non-loopback client address.
  • App binds 0.0.0.0:8000 (ALPHALENS_API_PORT=8000; no PORT variable set). Public domain targets port 8000.

FAILED DEPLOYMENT IDs

7b93d086-f6fd-4d53-a354-5a66c5fed6ac

615c084d-0c49-49ab-8f3d-a4599b77f9e9

81899e0b-860b-4677-9aab-6a6af27c9ac8

WORKING DEPLOYMENT (CLI): 93986d96-7d12-4972-a2cc-abb66c65f97a

ODDITY

The deployment metadata for the failed ones shows builder RAILPACK, while the service config says DOCKERFILE (backend/Dockerfile).

QUESTIONS

  1. Why would the healthcheck probe not reach a container that is listening on 0.0.0.0:8000?
  2. Does the healthcheck probe a different port when PORT is not set, and should I set PORT=8000?
  3. Can the RAILPACK vs DOCKERFILE mismatch change how the container is started or networked?
  4. Is there any difference in networking between GitHub-triggered and CLI-triggered deployments?

Repo: https://github.com/Sonalingowda/alphalens (branch release/railway-0f7f460)

$10 Bounty

1 Reply

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • about 1 month ago


yuri-barreira-dev

a month ago

That zero-log detail gives it away. Your /health/readiness handler logs on every call (readiness_duration in backend/app/infrastructure/observability.py). Uvicorn is up on 0.0.0.0:8000 but you see zero probe lines, so the probe hit a closed port. The app never saw it.

Railway probes PORT. From the healthcheck docs: the PORT value "is also used when performing health checks" and skipping it when you use target ports "can result in your health check returning a service unavailable error." You run fixed 8000 via ALPHALENS_API_PORT in backend/scripts/start-production.sh, with no PORT set. That script ignores PORT entirely, while settings.py:_environment_port() and your Dockerfile HEALTHCHECK both fall back to PORT. So 8000 vs injected PORT is the mismatch.

Do this:

  1. Set PORT=8000 on that service and environment. Keep ALPHALENS_API_PORT=8000 and /health/readiness. Redeploy from GitHub. You should now see readiness_duration lines and Python-urllib hits like the CLI deploy.

  2. Set Dockerfile path to backend/Dockerfile, root /, builder DOCKERFILE. Your repo has no root Dockerfile and no RAILWAY_DOCKERFILE_PATH, so GitHub builds fall back to RAILPACK. Your Dockerfile needs repo-root context (COPY backend/...). Check the build log for Using detected Dockerfile!.

  3. Stop the repeat with three lines at the top of start-production.sh:

    
    : "${ALPHALENS_API_HOST:=0.0.0.0}"
    
    : "${ALPHALENS_API_PORT:=${PORT:-8000}}"
    
    : "${ALPHALENS_API_WORKERS:=1}"
    

Then use those vars in the uvicorn line. EXPOSE 8000 and the public target port do not steer the probe, only PORT does.

Why did railway up work? Likely different effective PORT or it went live before the healthcheck gate was added, then kept serving 200s. There is no separate GitHub vs CLI network. The difference is source root plus effective builder, Dockerfile path, start command, and injected PORT. Compare those fields on deployment 93986d96 vs one failed ID.

If it still fails after 1 and 2, paste the build log header, the deployment details for builder, Dockerfile path, root, start command, and whether readiness_duration appears.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...