Skip to content

fix: honour PORT env var for Railway healthcheck compatibility#27

Open
aspiers wants to merge 1 commit intomainfrom
fix/railway-port-healthcheck
Open

fix: honour PORT env var for Railway healthcheck compatibility#27
aspiers wants to merge 1 commit intomainfrom
fix/railway-port-healthcheck

Conversation

@aspiers
Copy link
Contributor

@aspiers aspiers commented Mar 14, 2026

Summary

Railway injects a PORT environment variable and uses it to probe healthchecks. Both pds-core and auth-service were ignoring PORT in favour of their own service-specific variables (PDS_PORT, AUTH_PORT), causing healthchecks to fail with "service unavailable" on new Railway environments (the app listens on one port, Railway probes a different one).

Changes

  • pds-core: copies PORT into PDS_PORT before readEnv() when PDS_PORT is not explicitly set, so @atproto/pds picks up the Railway-injected port
  • auth-service: port resolution now reads AUTH_PORT || PORT || '3001' (was AUTH_PORT || '3001')
  • .env.example files: add PORT alongside the service-specific variable with comments explaining the relationship — both are set so the files work for Docker (needs PDS_PORT/AUTH_PORT) and Railway paste-in (needs PORT)
  • setup.sh: inject_derived_vars() now writes PORT into each per-package .env, derived from PDS_PORT (for pds-core) or AUTH_PORT (for auth-service) in the top-level .env

Context

The dev environment on Railway was forked from staging. Both pds-core and auth-service failed healthchecks because Railway probes the port specified by $PORT, but the services listen on PDS_PORT=3000 / AUTH_PORT=3001. The staging environment happened to work because PORT was manually set there. This fix makes the services honour PORT as a fallback so new environments work out of the box.

Railway injects PORT and uses it to probe healthchecks. Both pds-core
and auth-service were ignoring PORT in favour of their own service-
specific variables (PDS_PORT, AUTH_PORT), causing healthchecks to fail
on new Railway environments.

- pds-core: copy PORT into PDS_PORT before readEnv() when PDS_PORT is
  not explicitly set
- auth-service: fall back to PORT when AUTH_PORT is unset
- .env.example: add PORT alongside the service-specific variable so
  the files work for both Docker and Railway paste-in
- setup.sh: derive PORT in per-package .env from the top-level
  PDS_PORT / AUTH_PORT
@vercel
Copy link

vercel bot commented Mar 14, 2026

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

Project Deployment Actions Updated (UTC)
epds-demo Ready Ready Preview, Comment Mar 14, 2026 8:15pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

Warning

Rate limit exceeded

@aspiers has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 8 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fac0b630-511d-4789-a008-b7fd91be5cc9

📥 Commits

Reviewing files that changed from the base of the PR and between ad7fd26 and 4d8928f.

📒 Files selected for processing (5)
  • packages/auth-service/.env.example
  • packages/auth-service/src/index.ts
  • packages/pds-core/.env.example
  • packages/pds-core/src/index.ts
  • scripts/setup.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/railway-port-healthcheck
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@coveralls-official
Copy link

Pull Request Test Coverage Report for Build 23095534958

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 26.973%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/pds-core/src/index.ts 0 2 0.0%
Totals Coverage Status
Change from base Build 23095148093: -0.08%
Covered Lines: 464
Relevant Lines: 1573

💛 - Coveralls

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