From bf9b4cd3c46a825d5c7464074289834f858a0751 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Jan 2026 21:52:27 +0000 Subject: [PATCH] fix: Resolve port conflict causing Railway healthcheck failure Flask API was using PORT env variable which Railway also assigns to the frontend static server. Both services were competing for the same port, causing the container to fail health checks. Changed Flask to use FLASK_PORT (default 5000) so it runs independently from the Railway-assigned PORT used by the serve command. https://claude.ai/code/session_01YEMFAbGgf8K7as4Uqgjv3R --- Dockerfile | 3 +++ server.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f901e01..b4b3d4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,7 +59,10 @@ serve dist -l ${PORT:-3000}\n\ EXPOSE 3000 5000 # Environment variables +# PORT is used by serve for the frontend (Railway will set this) ENV PORT=3000 +# FLASK_PORT is used by the Python API server (separate from Railway's PORT) +ENV FLASK_PORT=5000 ENV FLASK_DEBUG=false ENV VITE_LATEX_API_URL=http://localhost:5000 diff --git a/server.py b/server.py index 576f850..51dfe25 100644 --- a/server.py +++ b/server.py @@ -332,6 +332,8 @@ def get_field_mapping(template_name): if __name__ == '__main__': - port = int(os.environ.get('PORT', 5000)) + # Use FLASK_PORT to avoid conflict with Railway's PORT variable + # which is used by the frontend static file server + port = int(os.environ.get('FLASK_PORT', 5000)) debug = os.environ.get('FLASK_DEBUG', 'false').lower() == 'true' app.run(host='0.0.0.0', port=port, debug=debug)