Files
composes/litellm/compose.yml
T
tiennm99 3ea1b39e44 refactor: name supporting services and volumes by role
Rename database services to db and cache services to cache, with their
volumes as db-data and cache-data, in litellm, owncloud and goclaw. Rename
the couchbase and open-webui volumes to <service>-data. Data on miti-sg was
copied into the new volumes beforehand; the old volumes are kept.
2026-10-07 19:26:27 +07:00

85 lines
2.5 KiB
YAML

services:
litellm:
build: .
restart: unless-stopped
environment:
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY:?required}
- UI_USERNAME=${UI_USERNAME:-admin}
- UI_PASSWORD=${UI_PASSWORD:?required}
- DATABASE_URL=postgresql://${POSTGRES_USER:-litellm}:${POSTGRES_PASSWORD:?required}@db:5432/${POSTGRES_DB:-litellm}
- REDIS_HOST=cache
- REDIS_PORT=6379
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
- GEMINI_API_KEY=${GEMINI_API_KEY:-}
- STORE_MODEL_IN_DB=${STORE_MODEL_IN_DB:-True}
- LITELLM_MODE=${LITELLM_MODE:-PRODUCTION}
- LITELLM_LOG=${LITELLM_LOG:-ERROR}
# - TOKENROUTER_API_KEY=${TOKENROUTER_API_KEY:-}
# - ORCAROUTER_API_KEY=${ORCAROUTER_API_KEY:-}
# - KIMI_API_KEY=${KIMI_API_KEY:-}
# - MINIMAX_API_KEY=${MINIMAX_API_KEY:-}
# - KILO_API_KEY=${KILO_API_KEY:-}
# - OPENCODE_API_KEY=${OPENCODE_API_KEY:-}
# - NVIDIA_NIM_API_KEY=${NVIDIA_NIM_API_KEY:-}
# - OLLAMA_API_KEY=${OLLAMA_API_KEY:-}
# - CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY:-}
# - CLOUDFLARE_ACCOUNT_ID=${CLOUDFLARE_ACCOUNT_ID:-}
command:
- --config
- /app/config.yaml
- --port
- "4000"
- --run_gunicorn
- --num_workers
- "2"
- --max_requests_before_restart
- "1000"
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request;urllib.request.urlopen('http://127.0.0.1:4000/health/liveliness',timeout=5)"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 4G
# PostgreSQL for keys, teams, budgets and spend logs.
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=${POSTGRES_USER:-litellm}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?required}
- POSTGRES_DB=${POSTGRES_DB:-litellm}
volumes:
- db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -h localhost -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 3
# Redis for the response cache and router state.
cache:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- cache-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 3
volumes:
db-data:
cache-data: