fix: honour PORT env var for Railway healthcheck compatibility#27
fix: honour PORT env var for Railway healthcheck compatibility#27
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
Pull Request Test Coverage Report for Build 23095534958Details
💛 - Coveralls |
Summary
Railway injects a
PORTenvironment variable and uses it to probe healthchecks. Both pds-core and auth-service were ignoringPORTin 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
PORTintoPDS_PORTbeforereadEnv()whenPDS_PORTis not explicitly set, so@atproto/pdspicks up the Railway-injected portAUTH_PORT || PORT || '3001'(wasAUTH_PORT || '3001').env.examplefiles: addPORTalongside the service-specific variable with comments explaining the relationship — both are set so the files work for Docker (needsPDS_PORT/AUTH_PORT) and Railway paste-in (needsPORT)setup.sh:inject_derived_vars()now writesPORTinto each per-package.env, derived fromPDS_PORT(for pds-core) orAUTH_PORT(for auth-service) in the top-level.envContext
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 onPDS_PORT=3000/AUTH_PORT=3001. The staging environment happened to work becausePORTwas manually set there. This fix makes the services honourPORTas a fallback so new environments work out of the box.