litellmGUI / docker-compose.yml
github-actions[bot]
deploy: b1de43e β€” ζ›΄ζ–° README.md
e1d8498
version: "3.9"
services:
# ─── LiteLLM Proxy Gateway ───────────────────────────────────────────────
litellm:
# BUG FIX #12: Was "main-latest" which points to the HEAD of the main branch
# and pulls in breaking changes on every `docker compose pull`. LiteLLM ships
# multiple commits per day; /model/delete field names, config.yaml keys, and
# routing behaviour have all changed between minor versions without notice.
#
# "main-stable" is the LiteLLM-maintained tag that always points to the
# latest release that has passed their 12-hour load-test suite. It is still
# a moving target, so for production deployments pin to a specific version:
# ghcr.io/berriai/litellm:main-v1.81.14-stable
#
# To upgrade: review the release notes at https://docs.litellm.ai/release_notes
# then bump the version below and redeploy.
image: ghcr.io/berriai/litellm:main-v1.81.14-stable
container_name: ai_gateway_litellm
restart: unless-stopped
volumes:
- ./litellm/config.yaml:/app/config.yaml:ro
- litellm_data:/app/data
environment:
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY:-sk-gateway-master-key}
# NOTE: STORE_MODEL_IN_DB requires PostgreSQL (not SQLite) in LiteLLM >= 1.x.
# We omit it here β€” our backend manages model persistence via SQLite and
# re-registers models with LiteLLM on startup via the /model/new API.
- PORT=4000
# NOTE: --detailed_debug flag is intentionally omitted.
# It dumps every internal processing step (including per-token details) to
# stdout, causing massive log volume and container slowdown in production.
# Use --debug only during active troubleshooting; omit it normally.
command: >
--config /app/config.yaml
--port 4000
--num_workers 4
healthcheck:
# LiteLLM image has no curl (GitHub issue #9295). Use wget + /health/liveliness.
test: ["CMD-SHELL", "wget --quiet --tries=1 -O /dev/null http://localhost:4000/health/liveliness || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
networks:
- gateway_net
# ─── Backend API ─────────────────────────────────────────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: ai_gateway_backend
restart: unless-stopped
environment:
- NODE_ENV=production
- PORT=3001
- LITELLM_BASE_URL=http://litellm:4000
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY:-sk-gateway-master-key}
- DB_PATH=/app/data/gateway.db
- JWT_SECRET=${JWT_SECRET:-super-secret-jwt-key-change-in-production}
- GATEWAY_PUBLIC_URL=${GATEWAY_PUBLIC_URL:-http://localhost}
volumes:
- backend_data:/app/data
depends_on:
litellm:
condition: service_healthy
networks:
- gateway_net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
interval: 20s
timeout: 5s
retries: 3
# ─── Frontend ─────────────────────────────────────────────────────────────
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- VITE_API_BASE=/api
- VITE_APP_NAME=AI Gateway Hub
container_name: ai_gateway_frontend
restart: unless-stopped
networks:
- gateway_net
depends_on:
- backend
# ─── Nginx Reverse Proxy ──────────────────────────────────────────────────
nginx:
image: nginx:1.25-alpine
container_name: ai_gateway_nginx
restart: unless-stopped
ports:
- "${HTTP_PORT:-80}:80"
# To enable HTTPS: add certs to nginx/ssl/ and uncomment below + add SSL server block to nginx.conf
# - "${HTTPS_PORT:-443}:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- nginx_logs:/var/log/nginx
depends_on:
- frontend
- backend
- litellm
networks:
- gateway_net
volumes:
litellm_data:
backend_data:
nginx_logs:
networks:
gateway_net:
driver: bridge