Skip to content

Commit 19d91fb

Browse files
committed
fix: configure PORT for Railway deployment health checks
1 parent 56f37c0 commit 19d91fb

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Dockerfile.production

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ RUN mkdir -p /app/tmp/pids /app/tmp/cache /app/tmp/sockets /app/log && \
7676
# Switch to non-root user
7777
USER rails:rails
7878

79-
# Expose port
79+
# Expose port (Railway sets PORT=8080 by default)
8080
EXPOSE 3000
8181

82-
# Health check
82+
# Health check (uses PORT env variable to match runtime configuration)
8383
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
84-
CMD curl -f http://localhost:3000/up || exit 1
84+
CMD curl -f http://localhost:${PORT:-3000}/up || exit 1
8585

8686
# Entry point for database migration
8787
COPY --chown=rails:rails deploy/scripts/docker-entrypoint.sh /usr/local/bin/

railway.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"env": {
1515
"RAILS_ENV": "production",
1616
"RAILS_LOG_TO_STDOUT": "true",
17-
"RAILS_SERVE_STATIC_FILES": "true"
17+
"RAILS_SERVE_STATIC_FILES": "true",
18+
"PORT": "8080"
1819
}
1920
}

0 commit comments

Comments
 (0)