99 lines
2.6 KiB
YAML
99 lines
2.6 KiB
YAML
name: litellm-stack
|
|
|
|
services:
|
|
litellm:
|
|
image: ghcr.io/berriai/litellm:main-stable
|
|
container_name: litellm
|
|
restart: unless-stopped
|
|
|
|
# Caddy will reverse proxy to this container on caddy_caddy_net.
|
|
# For local debugging without Caddy, you can uncomment:
|
|
# ports:
|
|
# - "4000:4000"
|
|
|
|
command: ["--config", "/app/config.yaml", "--port", "4000", "--num_workers", "1"]
|
|
|
|
env_file:
|
|
- .env
|
|
|
|
environment:
|
|
# Logging
|
|
LITELLM_LOG: "${LITELLM_LOG:-INFO}"
|
|
|
|
# DB connection string used by LiteLLM for UI, users, virtual keys, spend, etc.
|
|
# LiteLLM reads this via general_settings.database_url: os.environ/DATABASE_URL
|
|
DATABASE_URL: "postgresql://${POSTGRES_USER:-llmproxy}:${POSTGRES_PASSWORD:-dbpassword9090}@litellm-db:5432/${POSTGRES_DB:-litellm}"
|
|
|
|
volumes:
|
|
- ./config/litellm_config.yaml:/app/config.yaml:ro
|
|
- litellm_logs:/app/logs
|
|
|
|
depends_on:
|
|
litellm-db:
|
|
condition: service_healthy
|
|
|
|
networks:
|
|
- caddy_caddy_net
|
|
|
|
healthcheck:
|
|
# LiteLLM image is minimal (no curl/wget) → use Python
|
|
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:4000/health/liveliness')\""]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 120s
|
|
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "20m"
|
|
max-file: "3"
|
|
|
|
litellm-db:
|
|
image: postgres:16-alpine
|
|
container_name: litellm-db
|
|
restart: unless-stopped
|
|
|
|
environment:
|
|
POSTGRES_DB: "${POSTGRES_DB:-litellm}"
|
|
POSTGRES_USER: "${POSTGRES_USER:-llmproxy}"
|
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-dbpassword9090}"
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
|
|
|
volumes:
|
|
- litellm_postgres_data:/var/lib/postgresql/data
|
|
|
|
# No host port mapped → only other containers on the network can reach it.
|
|
# For debugging from host, you can temporarily uncomment:
|
|
# ports:
|
|
# - "127.0.0.1:5432:5432"
|
|
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-litellm} -U ${POSTGRES_USER:-llmproxy}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 10s
|
|
|
|
networks:
|
|
- caddy_caddy_net
|
|
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
networks:
|
|
# External network created/owned by your Caddy stack
|
|
caddy_caddy_net:
|
|
external: true
|
|
|
|
volumes:
|
|
litellm_logs:
|
|
name: litellm_logs
|
|
driver: local
|
|
|
|
litellm_postgres_data:
|
|
name: litellm_postgres_data
|
|
driver: local |