From c89626388f62730f4dea449df38a6f7f89c25402 Mon Sep 17 00:00:00 2001 From: Owen Qwen Date: Fri, 26 Jun 2026 14:45:28 -0500 Subject: [PATCH] Respect Railway runtime port --- README.md | 6 +++--- entrypoint.sh | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1021864..56ffbc5 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,9 @@ This template uses the `ghcr.io/berriai/litellm-database:latest` image so redepl | Variable | Description | Default | |----------|-------------|---------| -| `REDIS_HOST` | Redis hostname | Auto-configured | -| `REDIS_PORT` | Redis port | Auto-configured | -| `REDIS_PASSWORD` | Redis password | Auto-configured | +| `REDIS_HOST` / `REDISHOST` | Redis hostname | Auto-configured | +| `REDIS_PORT` / `REDISPORT` | Redis port | Auto-configured | +| `REDIS_PASSWORD` / `REDISPASSWORD` | Redis password | Auto-configured | | `NUM_WORKERS` | Number of proxy workers | `(auto)` | | `STORE_MODEL_IN_DB` | Store model config in database | `True` | diff --git a/entrypoint.sh b/entrypoint.sh index d56de09..1156ff5 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,8 +3,17 @@ set -e echo "Starting LiteLLM Proxy..." +# Railway injects PORT. Fall back to LiteLLM's default for local Docker runs. +APP_PORT="${PORT:-4000}" + +# Railway's Redis service exposes REDISHOST/REDISPORT/REDISPASSWORD. +# Keep supporting REDIS_HOST/REDIS_PORT/REDIS_PASSWORD for portability. +export REDIS_HOST="${REDIS_HOST:-${REDISHOST:-}}" +export REDIS_PORT="${REDIS_PORT:-${REDISPORT:-}}" +export REDIS_PASSWORD="${REDIS_PASSWORD:-${REDISPASSWORD:-}}" + # Build startup command -CMD_ARGS="--config /app/config.yaml --port 4000" +CMD_ARGS="--config /app/config.yaml --host 0.0.0.0 --port $APP_PORT" if [ -n "$NUM_WORKERS" ]; then CMD_ARGS="$CMD_ARGS --num_workers $NUM_WORKERS"