feat: production hardening with LiteLLM proxy integration and security updates
## Overview Major production readiness update integrating LiteLLM proxy for AI model management, security hardening, and infrastructure simplification. ## Changes ### 🔐 Security & Secrets Management - Auto-generate secrets via `openssl rand -hex` for: - `USER_AUTH_SECRET`, `ENCRYPTION_KEY_SECRET`, `METRICS_AUTH_TOKEN` - `POSTGRES_PASSWORD`, `LITELLM_*` credentials - Set `DISABLE_TELEMETRY=true` for data sovereignty compliance - Changed `POSTGRES_USER` from `postgres` → `onyx-admin` - Set `TRACK_EXTERNAL_IDP_EXPIRY=true` ### 🤖 LiteLLM Proxy Integration - **New service**: `litellm-proxy` with dedicated Postgres + Redis - **New config**: `litellm-config.yaml` with 3 Swiss-hosted models: - `LivQwen` (Qwen3.5-397B-A17B-FP8) - `LivKimi` (Kimi-K2.6) - `LivGemma` (NVIDIA Nemotron-3-Nano-30B-A3B-FP8) - Model fallback routing: LivQwen ↔ LivKimi ↔ LivGemma - Caching enabled via Redis with 3600s TTL - Custom error message mappings for user-friendly responses ### 🏗️ Infrastructure Updates - Switched from local builds → official Onyx Docker images - Removed `build.context` for api_server, background, inference/indexing servers - Increased NGINX timeouts: 300s → 600s (for complex AI queries) - Added PostgreSQL connection pooling & keepalive settings - S3 credentials now fully environment-driven (no hardcoded values) - Added `S3_REGION` variable - Removed certbot service (SSL handled externally) ### ⚙️ Configuration - `COMPOSE_PROFILES=s3-filestore` uncommented - `DISABLE_LITELLM_STREAMING=false` - `LLM_SOCKET_READ_TIMEOUT=600` - `GENERATIVE_MODEL_ACCESS_CHECK_FREQ=300` (5 minutes)
This commit is contained in:
parent
4216fd1c13
commit
7a618d4a74
3 changed files with 371 additions and 75 deletions
53
.env.example
53
.env.example
|
|
@ -53,14 +53,14 @@ AUTH_COOKIE_EXPIRE_TIME_SECONDS=604800 # 7 days
|
||||||
### Signs password reset, email verification, OAuth login state, and captcha cookies.
|
### Signs password reset, email verification, OAuth login state, and captcha cookies.
|
||||||
### REQUIRED: the API server refuses to start with an empty value (secure by default).
|
### REQUIRED: the API server refuses to start with an empty value (secure by default).
|
||||||
### If using install.sh this is auto-generated; if setting manually, run: openssl rand -hex 32
|
### If using install.sh this is auto-generated; if setting manually, run: openssl rand -hex 32
|
||||||
USER_AUTH_SECRET=
|
USER_AUTH_SECRET=$(openssl rand -hex 16)
|
||||||
### Recommend to set this for security
|
### Recommend to set this for security
|
||||||
# ENCRYPTION_KEY_SECRET=
|
ENCRYPTION_KEY_SECRET=$(openssl rand -hex 32)
|
||||||
### Bearer token for the API server's /metrics endpoint. Auth is REQUIRED by
|
### Bearer token for the API server's /metrics endpoint. Auth is REQUIRED by
|
||||||
### default: scrapers must send `Authorization: Bearer <token>` (Prometheus
|
### default: scrapers must send `Authorization: Bearer <token>` (Prometheus
|
||||||
### scrape config: `authorization`). If you set neither this token nor
|
### scrape config: `authorization`). If you set neither this token nor
|
||||||
### DISABLE_METRICS_AUTH, /metrics is locked (returns 401).
|
### DISABLE_METRICS_AUTH, /metrics is locked (returns 401).
|
||||||
# METRICS_AUTH_TOKEN=
|
METRICS_AUTH_TOKEN=$(openssl rand -hex 32)
|
||||||
### Set to "true" to expose /metrics with NO authentication (explicit opt-out).
|
### Set to "true" to expose /metrics with NO authentication (explicit opt-out).
|
||||||
# DISABLE_METRICS_AUTH=
|
# DISABLE_METRICS_AUTH=
|
||||||
### Set to "true" to expose the interactive API docs and schema (/openapi.json,
|
### Set to "true" to expose the interactive API docs and schema (/openapi.json,
|
||||||
|
|
@ -97,8 +97,14 @@ ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=false
|
||||||
## SERVICES CONFIGURATIONS
|
## SERVICES CONFIGURATIONS
|
||||||
################################################################################
|
################################################################################
|
||||||
## Database Configuration
|
## Database Configuration
|
||||||
POSTGRES_USER=postgres
|
POSTGRES_USER=onyx-admin
|
||||||
POSTGRES_PASSWORD=
|
POSTGRES_PASSWORD=$(openssl rand -hex 16)
|
||||||
|
POSTGRES_API_SERVER_POOL_SIZE=30 # Tune for your load
|
||||||
|
POSTGRES_API_SERVER_POOL_OVERFLOW=10
|
||||||
|
POSTGRES_TCP_KEEPALIVES=1 # Enable keepalives
|
||||||
|
POSTGRES_TCP_KEEPALIVES_IDLE=60 # 60 seconds idle
|
||||||
|
POSTGRES_TCP_KEEPALIVES_INTERVAL=10 # 10 seconds between probes
|
||||||
|
POSTGRES_TCP_KEEPALIVES_COUNT=5 # 5 probes before disconnect
|
||||||
# POSTGRES_DB=
|
# POSTGRES_DB=
|
||||||
# POSTGRES_DEFAULT_SCHEMA=
|
# POSTGRES_DEFAULT_SCHEMA=
|
||||||
# POSTGRES_USE_NULL_POOL=
|
# POSTGRES_USE_NULL_POOL=
|
||||||
|
|
@ -118,7 +124,7 @@ POSTGRES_PASSWORD=
|
||||||
## File Store Backend: "s3" (default, uses MinIO) or "postgres" (no extra services needed)
|
## File Store Backend: "s3" (default, uses MinIO) or "postgres" (no extra services needed)
|
||||||
## COMPOSE_PROFILES activates the MinIO service. To use PostgreSQL file storage instead,
|
## COMPOSE_PROFILES activates the MinIO service. To use PostgreSQL file storage instead,
|
||||||
## remove s3-filestore from COMPOSE_PROFILES and set FILE_STORE_BACKEND=postgres.
|
## remove s3-filestore from COMPOSE_PROFILES and set FILE_STORE_BACKEND=postgres.
|
||||||
COMPOSE_PROFILES=s3-filestore
|
#COMPOSE_PROFILES=s3-filestore
|
||||||
FILE_STORE_BACKEND=s3
|
FILE_STORE_BACKEND=s3
|
||||||
|
|
||||||
## MinIO/S3 Configuration (only needed when FILE_STORE_BACKEND=s3)
|
## MinIO/S3 Configuration (only needed when FILE_STORE_BACKEND=s3)
|
||||||
|
|
@ -126,6 +132,7 @@ FILE_STORE_BACKEND=s3
|
||||||
## edit .env by hand, change all four values before production. Keep the S3_AWS_*
|
## edit .env by hand, change all four values before production. Keep the S3_AWS_*
|
||||||
## pair identical to MINIO_ROOT_* (the app uses MinIO's root creds).
|
## pair identical to MINIO_ROOT_* (the app uses MinIO's root creds).
|
||||||
S3_ENDPOINT_URL=
|
S3_ENDPOINT_URL=
|
||||||
|
S3_REGION=
|
||||||
S3_AWS_ACCESS_KEY_ID=
|
S3_AWS_ACCESS_KEY_ID=
|
||||||
S3_AWS_SECRET_ACCESS_KEY=
|
S3_AWS_SECRET_ACCESS_KEY=
|
||||||
S3_FILE_STORE_BUCKET_NAME=
|
S3_FILE_STORE_BUCKET_NAME=
|
||||||
|
|
@ -147,9 +154,9 @@ S3_FILE_STORE_BUCKET_NAME=
|
||||||
## Nginx Proxy Timeout Configuration (in seconds)
|
## Nginx Proxy Timeout Configuration (in seconds)
|
||||||
## These settings control how long nginx waits for upstream servers (api_server/web_server)
|
## These settings control how long nginx waits for upstream servers (api_server/web_server)
|
||||||
## Increase these values if you experience timeout errors with long-running requests
|
## Increase these values if you experience timeout errors with long-running requests
|
||||||
# NGINX_PROXY_CONNECT_TIMEOUT=300
|
NGINX_PROXY_CONNECT_TIMEOUT=600 # 10 minutes (complex AI queries)
|
||||||
# NGINX_PROXY_SEND_TIMEOUT=300
|
NGINX_PROXY_SEND_TIMEOUT=600
|
||||||
# NGINX_PROXY_READ_TIMEOUT=300
|
NGINX_PROXY_READ_TIMEOUT=600
|
||||||
|
|
||||||
## MCP Server Configuration
|
## MCP Server Configuration
|
||||||
## The MCP (Model Context Protocol) server allows external MCP clients to interact with Onyx
|
## The MCP (Model Context Protocol) server allows external MCP clients to interact with Onyx
|
||||||
|
|
@ -199,7 +206,7 @@ LOG_ONYX_MODEL_INTERACTIONS=False
|
||||||
# LOG_ENDPOINT_LATENCY=
|
# LOG_ENDPOINT_LATENCY=
|
||||||
# LOG_POSTGRES_LATENCY=
|
# LOG_POSTGRES_LATENCY=
|
||||||
# LOG_POSTGRES_CONN_COUNTS=
|
# LOG_POSTGRES_CONN_COUNTS=
|
||||||
# DISABLE_TELEMETRY=
|
DISABLE_TELEMETRY=true
|
||||||
|
|
||||||
## Feature Flags
|
## Feature Flags
|
||||||
SHOW_EXTRA_CONNECTORS=true
|
SHOW_EXTRA_CONNECTORS=true
|
||||||
|
|
@ -239,7 +246,7 @@ OAUTH_CLIENT_ID=
|
||||||
OAUTH_CLIENT_SECRET=
|
OAUTH_CLIENT_SECRET=
|
||||||
OPENID_CONFIG_URL=
|
OPENID_CONFIG_URL=
|
||||||
OIDC_PKCE_ENABLED=true
|
OIDC_PKCE_ENABLED=true
|
||||||
TRACK_EXTERNAL_IDP_EXPIRY=false
|
TRACK_EXTERNAL_IDP_EXPIRY=true
|
||||||
OIDC_SCOPE_OVERRIDE=openid,email,profile,offline_access
|
OIDC_SCOPE_OVERRIDE=openid,email,profile,offline_access
|
||||||
# Comma-separated list of origins allowed to make cross-origin (CORS) requests,
|
# Comma-separated list of origins allowed to make cross-origin (CORS) requests,
|
||||||
# e.g. "https://onyx.example.com". When unset, all origins are allowed but
|
# e.g. "https://onyx.example.com". When unset, all origins are allowed but
|
||||||
|
|
@ -250,13 +257,21 @@ CORS_ALLOWED_ORIGIN=
|
||||||
|
|
||||||
## Gen AI Settings
|
## Gen AI Settings
|
||||||
GEN_AI_MAX_TOKENS=250000
|
GEN_AI_MAX_TOKENS=250000
|
||||||
# LLM_SOCKET_READ_TIMEOUT=
|
LLM_SOCKET_READ_TIMEOUT=600
|
||||||
# MAX_CHUNKS_FED_TO_CHAT=
|
# MAX_CHUNKS_FED_TO_CHAT=
|
||||||
# DISABLE_LITELLM_STREAMING=
|
DISABLE_LITELLM_STREAMING=false
|
||||||
# LITELLM_EXTRA_HEADERS=
|
# LITELLM_EXTRA_HEADERS=
|
||||||
# GEN_AI_API_KEY=
|
# GEN_AI_API_KEY=
|
||||||
# GENERATIVE_MODEL_ACCESS_CHECK_FREQ=
|
GENERATIVE_MODEL_ACCESS_CHECK_FREQ=300 # 5 minutes
|
||||||
# LITELLM_CUSTOM_ERROR_MESSAGE_MAPPINGS=
|
LITELLM_CUSTOM_ERROR_MESSAGE_MAPPINGS={
|
||||||
|
"RateLimitError": "Service is temporarily busy. Please try again in a moment.",
|
||||||
|
"Timeout": "Request took too long. Please try with a shorter query.",
|
||||||
|
"AuthenticationError": "AI service authentication failed. Contact your administrator.",
|
||||||
|
"BadRequestError": "Invalid request format. Please rephrase your query.",
|
||||||
|
"InternalServerError": "Temporary service issue. Please retry shortly."
|
||||||
|
}
|
||||||
|
LITELLM_PROXY_API_KEY=${LITELLM_MASTER_KEY}
|
||||||
|
LITELLM_PROXY_API_BASE=http://litellm-proxy:4000
|
||||||
|
|
||||||
## Query Options
|
## Query Options
|
||||||
# DOC_TIME_DECAY=
|
# DOC_TIME_DECAY=
|
||||||
|
|
@ -322,3 +337,11 @@ MODEL_SERVER_HOST=inference_model_server
|
||||||
INDEXING_MODEL_SERVER_HOST=indexing_model_server
|
INDEXING_MODEL_SERVER_HOST=indexing_model_server
|
||||||
INTERNAL_URL=http://api_server:8080
|
INTERNAL_URL=http://api_server:8080
|
||||||
ENABLE_CONTEXTUAL_RAG=true
|
ENABLE_CONTEXTUAL_RAG=true
|
||||||
|
|
||||||
|
# LiteLLM Proxy Settings
|
||||||
|
LITELLM_MASTER_KEY=sk-$(openssl rand -hex 32)
|
||||||
|
LITELLM_SALT_KEY=$(openssl rand -hex 32)
|
||||||
|
LITELLM_DATABASE_URL=postgresql://llmproxy:${LITELLM_POSTGRES_PASSWORD}@litellm-db:5432/litellm
|
||||||
|
LITELLM_POSTGRES_PASSWORD=$(openssl rand -hex 16)
|
||||||
|
LITELLM_INFOMANIAK_API_KEY=
|
||||||
|
LITELLM_REDIS_PASSWORD=$(openssl rand -hex 16)
|
||||||
|
|
@ -39,9 +39,6 @@ name: onyx
|
||||||
services:
|
services:
|
||||||
api_server:
|
api_server:
|
||||||
image: ${ONYX_BACKEND_IMAGE:-onyxdotapp/onyx-backend:${IMAGE_TAG:-latest}}
|
image: ${ONYX_BACKEND_IMAGE:-onyxdotapp/onyx-backend:${IMAGE_TAG:-latest}}
|
||||||
build:
|
|
||||||
context: ../../backend
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
command: >
|
command: >
|
||||||
/bin/sh -c "alembic upgrade head && echo \"Starting Onyx Api Server\" &&
|
/bin/sh -c "alembic upgrade head && echo \"Starting Onyx Api Server\" &&
|
||||||
uvicorn onyx.main:app --host 0.0.0.0 --port 8080"
|
uvicorn onyx.main:app --host 0.0.0.0 --port 8080"
|
||||||
|
|
@ -115,9 +112,6 @@ services:
|
||||||
- ./file-system:/app/file-system
|
- ./file-system:/app/file-system
|
||||||
background:
|
background:
|
||||||
image: ${ONYX_BACKEND_IMAGE:-onyxdotapp/onyx-backend:${IMAGE_TAG:-latest}}
|
image: ${ONYX_BACKEND_IMAGE:-onyxdotapp/onyx-backend:${IMAGE_TAG:-latest}}
|
||||||
build:
|
|
||||||
context: ../../backend
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
command: |
|
command: |
|
||||||
/bin/sh -c " if [ -f /etc/ssl/certs/custom-ca.crt ]; then
|
/bin/sh -c " if [ -f /etc/ssl/certs/custom-ca.crt ]; then
|
||||||
update-ca-certificates;
|
update-ca-certificates;
|
||||||
|
|
@ -147,10 +141,10 @@ services:
|
||||||
- REDIS_HOST=${REDIS_HOST:-cache}
|
- REDIS_HOST=${REDIS_HOST:-cache}
|
||||||
- MODEL_SERVER_HOST=${MODEL_SERVER_HOST:-inference_model_server}
|
- MODEL_SERVER_HOST=${MODEL_SERVER_HOST:-inference_model_server}
|
||||||
- INDEXING_MODEL_SERVER_HOST=${INDEXING_MODEL_SERVER_HOST:-indexing_model_server}
|
- INDEXING_MODEL_SERVER_HOST=${INDEXING_MODEL_SERVER_HOST:-indexing_model_server}
|
||||||
- S3_ENDPOINT_URL=${S3_ENDPOINT_URL:-http://minio:9000}
|
- S3_ENDPOINT_URL=${S3_ENDPOINT_URL}
|
||||||
- S3_REGION=us-east-1
|
- S3_REGION=${S3_REGION}
|
||||||
- S3_AWS_ACCESS_KEY_ID=${S3_AWS_ACCESS_KEY_ID:-minioadmin}
|
- S3_AWS_ACCESS_KEY_ID=${S3_AWS_ACCESS_KEY_ID}
|
||||||
- S3_AWS_SECRET_ACCESS_KEY=${S3_AWS_SECRET_ACCESS_KEY:-minioadmin}
|
- S3_AWS_SECRET_ACCESS_KEY=${S3_AWS_SECRET_ACCESS_KEY}
|
||||||
- DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-}
|
- DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-}
|
||||||
- DISCORD_BOT_INVOKE_CHAR=${DISCORD_BOT_INVOKE_CHAR:-!}
|
- DISCORD_BOT_INVOKE_CHAR=${DISCORD_BOT_INVOKE_CHAR:-!}
|
||||||
# API Server connection for Discord bot message processing
|
# API Server connection for Discord bot message processing
|
||||||
|
|
@ -286,18 +280,6 @@ services:
|
||||||
|
|
||||||
inference_model_server:
|
inference_model_server:
|
||||||
image: ${ONYX_MODEL_SERVER_IMAGE:-onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest}}
|
image: ${ONYX_MODEL_SERVER_IMAGE:-onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest}}
|
||||||
build:
|
|
||||||
context: ../../backend
|
|
||||||
dockerfile: Dockerfile.model_server
|
|
||||||
# GPU Support: Uncomment the following lines to enable GPU support
|
|
||||||
# Requires nvidia-container-toolkit to be installed on the host
|
|
||||||
# deploy:
|
|
||||||
# resources:
|
|
||||||
# reservations:
|
|
||||||
# devices:
|
|
||||||
# - driver: nvidia
|
|
||||||
# count: all
|
|
||||||
# capabilities: [gpu]
|
|
||||||
command: >
|
command: >
|
||||||
/bin/sh -c "if [ \"${DISABLE_MODEL_SERVER:-}\" = \"True\" ] || [
|
/bin/sh -c "if [ \"${DISABLE_MODEL_SERVER:-}\" = \"True\" ] || [
|
||||||
\"${DISABLE_MODEL_SERVER:-}\" = \"true\" ]; then
|
\"${DISABLE_MODEL_SERVER:-}\" = \"true\" ]; then
|
||||||
|
|
@ -337,18 +319,6 @@ services:
|
||||||
start_period: 600s
|
start_period: 600s
|
||||||
indexing_model_server:
|
indexing_model_server:
|
||||||
image: ${ONYX_MODEL_SERVER_IMAGE:-onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest}}
|
image: ${ONYX_MODEL_SERVER_IMAGE:-onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest}}
|
||||||
build:
|
|
||||||
context: ../../backend
|
|
||||||
dockerfile: Dockerfile.model_server
|
|
||||||
# GPU Support: Uncomment the following lines to enable GPU support
|
|
||||||
# Requires nvidia-container-toolkit to be installed on the host
|
|
||||||
# deploy:
|
|
||||||
# resources:
|
|
||||||
# reservations:
|
|
||||||
# devices:
|
|
||||||
# - driver: nvidia
|
|
||||||
# count: all
|
|
||||||
# capabilities: [gpu]
|
|
||||||
command: >
|
command: >
|
||||||
/bin/sh -c "if [ \"${DISABLE_MODEL_SERVER:-}\" = \"True\" ] || [
|
/bin/sh -c "if [ \"${DISABLE_MODEL_SERVER:-}\" = \"True\" ] || [
|
||||||
\"${DISABLE_MODEL_SERVER:-}\" = \"true\" ]; then
|
\"${DISABLE_MODEL_SERVER:-}\" = \"true\" ]; then
|
||||||
|
|
@ -496,9 +466,6 @@ services:
|
||||||
# the writable /etc/nginx/conf.d/ inside the container. This avoids
|
# the writable /etc/nginx/conf.d/ inside the container. This avoids
|
||||||
# "Permission denied" errors on Windows Docker bind mounts.
|
# "Permission denied" errors on Windows Docker bind mounts.
|
||||||
- ./data/nginx:/nginx-templates:ro
|
- ./data/nginx:/nginx-templates:ro
|
||||||
# PRODUCTION: Add SSL certificate volumes for HTTPS support:
|
|
||||||
# - ../data/certbot/conf:/etc/letsencrypt
|
|
||||||
# - ../data/certbot/www:/var/www/certbot
|
|
||||||
logging:
|
logging:
|
||||||
driver: json-file
|
driver: json-file
|
||||||
options:
|
options:
|
||||||
|
|
@ -528,13 +495,6 @@ services:
|
||||||
cache:
|
cache:
|
||||||
image: ${BASE_IMAGE_REGISTRY:-docker.io}/library/redis:7.4-alpine
|
image: ${BASE_IMAGE_REGISTRY:-docker.io}/library/redis:7.4-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# DEV: To expose ports, either:
|
|
||||||
# 1. Use docker-compose.dev.yml: docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --wait
|
|
||||||
# 2. Uncomment the ports below
|
|
||||||
# ports:
|
|
||||||
# - "6379:6379"
|
|
||||||
# docker silently mounts /data even without an explicit volume mount, which enables
|
|
||||||
# persistence. explicitly setting save and appendonly forces ephemeral behavior.
|
|
||||||
command: redis-server --save "" --appendonly no
|
command: redis-server --save "" --appendonly no
|
||||||
networks:
|
networks:
|
||||||
- onyx-network
|
- onyx-network
|
||||||
|
|
@ -561,22 +521,99 @@ services:
|
||||||
user: root
|
user: root
|
||||||
volumes:
|
volumes:
|
||||||
- ${DOCKER_SOCK_PATH:-/var/run/docker.sock}:/var/run/docker.sock
|
- ${DOCKER_SOCK_PATH:-/var/run/docker.sock}:/var/run/docker.sock
|
||||||
# uncomment below + comment out the above to use the `docker-in-docker` execution mode
|
|
||||||
# privileged: true
|
|
||||||
|
|
||||||
# PRODUCTION: Uncomment the following certbot service for SSL certificate management
|
# litellm proxy
|
||||||
# certbot:
|
litellm-proxy:
|
||||||
# image: certbot/certbot
|
image: docker.litellm.ai/berriai/litellm:main-stable
|
||||||
# restart: unless-stopped
|
restart: unless-stopped
|
||||||
# volumes:
|
volumes:
|
||||||
# - ../data/certbot/conf:/etc/letsencrypt
|
- ./litellm-config.yaml:/app/config.yaml
|
||||||
# - ../data/certbot/www:/var/www/certbot
|
command: >
|
||||||
# logging:
|
--config /app/config.yaml
|
||||||
# driver: json-file
|
--port 4000
|
||||||
# options:
|
--num_workers 4
|
||||||
# max-size: "50m"
|
--max_requests_before_restart 10000
|
||||||
# max-file: "6"
|
--max_requests_before_restart_jitter 1000
|
||||||
# entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
--run_gunicorn
|
||||||
|
networks:
|
||||||
|
- litellm-network
|
||||||
|
- onyx-network
|
||||||
|
environment:
|
||||||
|
- INFOMANIAK_API_KEY=${LITELLM_INFOMANIAK_API_KEY}
|
||||||
|
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY}
|
||||||
|
- REDIS_HOST=litellm-redis
|
||||||
|
- REDIS_PORT=6379
|
||||||
|
- REDIS_PASSWORD=${LITELLM_REDIS_PASSWORD}
|
||||||
|
- LITELLM_SALT_KEY=${LITELLM_SALT_KEY}
|
||||||
|
- LITELLM_MODE=PRODUCTION
|
||||||
|
- LITELLM_LOG=ERROR
|
||||||
|
- NUM_WORKERS=4
|
||||||
|
- MAX_REQUESTS_BEFORE_RESTART=10000
|
||||||
|
- MAX_REQUESTS_BEFORE_RESTART_JITTER=1000
|
||||||
|
- DATABASE_URL=${LITELLM_DATABASE_URL}
|
||||||
|
env_file:
|
||||||
|
- .env # Load local .env file
|
||||||
|
depends_on:
|
||||||
|
- litellm-db # Indicates that this service depends on the 'db' service, ensuring 'db' starts first
|
||||||
|
- litellm-redis
|
||||||
|
healthcheck:
|
||||||
|
# Defines the health check configuration for the container
|
||||||
|
test:
|
||||||
|
- CMD-SHELL
|
||||||
|
- python3 -c "import urllib.request;
|
||||||
|
urllib.request.urlopen('http://localhost:4000/health/liveliness')" # Command to execute for health check
|
||||||
|
interval: 30s # Perform health check every 30 seconds
|
||||||
|
timeout: 10s # Health check command times out after 10 seconds
|
||||||
|
retries: 3 # Retry up to 3 times if health check fails
|
||||||
|
start_period: 60s # Wait 40 seconds after container start before beginning health checks
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '2.0'
|
||||||
|
memory: 2G
|
||||||
|
reservations:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 512M
|
||||||
|
litellm-db:
|
||||||
|
image: postgres:16
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: litellm
|
||||||
|
POSTGRES_USER: llmproxy
|
||||||
|
POSTGRES_PASSWORD: ${LITELLM_POSTGRES_PASSWORD}
|
||||||
|
networks:
|
||||||
|
- litellm-network
|
||||||
|
volumes:
|
||||||
|
- ./litellm_postgres_data:/var/lib/postgresql/data # Persists Postgres data across container restarts
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD-SHELL
|
||||||
|
- pg_isready -d litellm -U llmproxy
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
litellm-redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- REDIS_HOST=litellm-redis
|
||||||
|
- REDIS_PORT=6379
|
||||||
|
- REDIS_SSL=False
|
||||||
|
networks:
|
||||||
|
- litellm-network
|
||||||
|
volumes:
|
||||||
|
- ./litellm_redis_data:/data
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD
|
||||||
|
- redis-cli
|
||||||
|
- -a
|
||||||
|
- ${LITELLM_REDIS_PASSWORD}
|
||||||
|
- ping
|
||||||
|
interval: 5s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 5
|
||||||
|
command: redis-server --requirepass ${LITELLM_REDIS_PASSWORD} --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
# Persistent data for OpenSearch.
|
# Persistent data for OpenSearch.
|
||||||
|
|
@ -586,6 +623,8 @@ volumes:
|
||||||
networks:
|
networks:
|
||||||
onyx-network:
|
onyx-network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
litellm-network:
|
||||||
|
driver: bridge
|
||||||
web:
|
web:
|
||||||
name: web
|
name: web
|
||||||
external: true
|
external: true
|
||||||
|
|
|
||||||
234
litellm-config.yaml
Normal file
234
litellm-config.yaml
Normal file
|
|
@ -0,0 +1,234 @@
|
||||||
|
general_settings:
|
||||||
|
master_key: os.environ/LITELLM_MASTER_KEY
|
||||||
|
database_url: os.environ/DATABASE_URL
|
||||||
|
store_model_in_db: true
|
||||||
|
store_prompts_in_spend_logs: false
|
||||||
|
use_redis_transaction_buffer: true # Required for high traffic (1000+ RPS) [1]
|
||||||
|
user_api_key_cache_ttl: 300 # Optional: TTL for API key auth cache [2]
|
||||||
|
enable_redis_auth_cache: true
|
||||||
|
allow_requests_on_db_unavailable: true
|
||||||
|
json_logs: true
|
||||||
|
# LiteLLM Proxy Configuration for Infomaniak AI API
|
||||||
|
# Base URL: https://api.infomaniak.com/2/ai/105341/openai/v1
|
||||||
|
|
||||||
|
model_list:
|
||||||
|
# Primary Model: Qwen3.5 (LivQwen)
|
||||||
|
- model_name: LivQwen
|
||||||
|
litellm_params:
|
||||||
|
model: openai/Qwen/Qwen3.5-397B-A17B-FP8
|
||||||
|
api_base: https://api.infomaniak.com/2/ai/105341/openai/v1
|
||||||
|
api_key: os.environ/INFOMANIAK_API_KEY
|
||||||
|
rpm: 50
|
||||||
|
tpm: 100000
|
||||||
|
timeout: 600
|
||||||
|
max_retries: 3
|
||||||
|
retry_policy:
|
||||||
|
RateLimitError: 5
|
||||||
|
Timeout: 3
|
||||||
|
APIConnectionError: 3
|
||||||
|
model_info:
|
||||||
|
id: "infomaniak-qwen-1"
|
||||||
|
base_model: "Qwen/Qwen3.5-397B-A17B-FP8"
|
||||||
|
# Model capabilities (Infomaniak doesn't provide these via API)
|
||||||
|
input_cost_per_token: 0.0 # Set based on Infomaniak pricing
|
||||||
|
output_cost_per_token: 0.0
|
||||||
|
max_tokens: 200000
|
||||||
|
input_cost_per_second: 0.0
|
||||||
|
output_cost_per_second: 0.0
|
||||||
|
# Capabilities
|
||||||
|
supports_vision: true # Qwen3.5 has vision capabilities
|
||||||
|
supports_reasoning: true # Qwen3.5 has enhanced reasoning
|
||||||
|
supports_function_calling: true
|
||||||
|
supports_parallel_function_calling: true
|
||||||
|
supports_response_schema: true
|
||||||
|
supports_system_messages: true
|
||||||
|
supports_tool_choice: true
|
||||||
|
supports_web_search: false # Unless Infomaniak enables it
|
||||||
|
supports_prompt_caching: false
|
||||||
|
supports_embedding: false
|
||||||
|
supports_audio_input: false
|
||||||
|
supports_audio_output: false
|
||||||
|
supports_computer_use: false
|
||||||
|
# Model family info
|
||||||
|
mode: "chat"
|
||||||
|
model_group: "qwen-family"
|
||||||
|
region: "eu-west" # Infomaniak is Switzerland-based
|
||||||
|
|
||||||
|
# Secondary Model: Kimi-K2.6 (LivKimi)
|
||||||
|
- model_name: LivKimi
|
||||||
|
litellm_params:
|
||||||
|
model: openai/moonshotai/Kimi-K2.6
|
||||||
|
api_base: https://api.infomaniak.com/2/ai/105341/openai/v1
|
||||||
|
api_key: os.environ/INFOMANIAK_API_KEY
|
||||||
|
rpm: 50
|
||||||
|
tpm: 100000
|
||||||
|
timeout: 600
|
||||||
|
max_retries: 3
|
||||||
|
retry_policy:
|
||||||
|
RateLimitError: 5
|
||||||
|
Timeout: 3
|
||||||
|
APIConnectionError: 3
|
||||||
|
model_info:
|
||||||
|
id: "infomaniak-kimi-1"
|
||||||
|
base_model: "moonshotai/Kimi-K2.6"
|
||||||
|
# Model capabilities
|
||||||
|
input_cost_per_token: 0.0
|
||||||
|
output_cost_per_token: 0.0
|
||||||
|
max_tokens: 256000
|
||||||
|
input_cost_per_second: 0.0
|
||||||
|
output_cost_per_second: 0.0
|
||||||
|
# Capabilities
|
||||||
|
supports_vision: true # Kimi K2.5+ supports vision
|
||||||
|
supports_reasoning: true # Strong reasoning capabilities
|
||||||
|
supports_function_calling: true
|
||||||
|
supports_parallel_function_calling: true
|
||||||
|
supports_response_schema: true
|
||||||
|
supports_system_messages: true
|
||||||
|
supports_tool_choice: true
|
||||||
|
supports_web_search: false
|
||||||
|
supports_prompt_caching: false
|
||||||
|
supports_embedding: false
|
||||||
|
supports_audio_input: false
|
||||||
|
supports_audio_output: false
|
||||||
|
supports_computer_use: false
|
||||||
|
# Model family info
|
||||||
|
mode: "chat"
|
||||||
|
model_group: "kimi-family"
|
||||||
|
region: "eu-west"
|
||||||
|
|
||||||
|
# Tertiary Model: Gemma-4 (LivGemma)
|
||||||
|
- model_name: LivGemma
|
||||||
|
litellm_params:
|
||||||
|
model: openai/google/gemma-4-31B-it
|
||||||
|
api_base: https://api.infomaniak.com/2/ai/105341/openai/v1
|
||||||
|
api_key: os.environ/INFOMANIAK_API_KEY
|
||||||
|
rpm: 50
|
||||||
|
tpm: 100000
|
||||||
|
timeout: 600
|
||||||
|
max_retries: 3
|
||||||
|
retry_policy:
|
||||||
|
RateLimitError: 5
|
||||||
|
Timeout: 3
|
||||||
|
APIConnectionError: 3
|
||||||
|
model_info:
|
||||||
|
id: "infomaniak-gemma-1"
|
||||||
|
base_model: "google/gemma-4-31B-it"
|
||||||
|
# Model capabilities
|
||||||
|
input_cost_per_token: 0.0
|
||||||
|
output_cost_per_token: 0.0
|
||||||
|
max_tokens: 100000
|
||||||
|
input_cost_per_second: 0.0
|
||||||
|
output_cost_per_second: 0.0
|
||||||
|
# Capabilities
|
||||||
|
supports_vision: false # Gemma-4-31B-it is text-only
|
||||||
|
supports_reasoning: false # Basic reasoning, not enhanced
|
||||||
|
supports_function_calling: true
|
||||||
|
supports_parallel_function_calling: false
|
||||||
|
supports_response_schema: true
|
||||||
|
supports_system_messages: true
|
||||||
|
supports_tool_choice: true
|
||||||
|
supports_web_search: false
|
||||||
|
supports_prompt_caching: false
|
||||||
|
supports_embedding: false
|
||||||
|
supports_audio_input: false
|
||||||
|
supports_audio_output: false
|
||||||
|
supports_computer_use: false
|
||||||
|
# Model family info
|
||||||
|
mode: "chat"
|
||||||
|
model_group: "gemma-family"
|
||||||
|
region: "eu-west"
|
||||||
|
|
||||||
|
# Cost-Optimized Model: Nemotron-3-Nano (LivNemotron)
|
||||||
|
# Best for: high-volume tasks like Onyx contextual retrieval, classification,
|
||||||
|
# summarization, and any workload where cost matters more than
|
||||||
|
# peak reasoning quality.
|
||||||
|
# Infomaniak pricing (CHF): 0.05 / 1M input tokens | 0.20 / 1M output tokens
|
||||||
|
- model_name: LivNemotron
|
||||||
|
litellm_params:
|
||||||
|
model: openai/nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8
|
||||||
|
api_base: https://api.infomaniak.com/2/ai/105341/openai/v1
|
||||||
|
api_key: os.environ/INFOMANIAK_API_KEY
|
||||||
|
rpm: 50
|
||||||
|
tpm: 100000
|
||||||
|
timeout: 600
|
||||||
|
max_retries: 3
|
||||||
|
retry_policy:
|
||||||
|
RateLimitError: 5
|
||||||
|
Timeout: 3
|
||||||
|
APIConnectionError: 3
|
||||||
|
model_info:
|
||||||
|
id: "infomaniak-nemotron-nano-1"
|
||||||
|
base_model: "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8"
|
||||||
|
input_cost_per_token: 0.0
|
||||||
|
output_cost_per_token: 0.0
|
||||||
|
max_tokens: 128000
|
||||||
|
input_cost_per_second: 0.0
|
||||||
|
output_cost_per_second: 0.0
|
||||||
|
# Capabilities
|
||||||
|
supports_vision: false # Text-only model
|
||||||
|
supports_reasoning: false # Standard instruction following, not deep reasoning
|
||||||
|
supports_function_calling: true # Basic tool use supported
|
||||||
|
supports_parallel_function_calling: false
|
||||||
|
supports_response_schema: true
|
||||||
|
supports_system_messages: true
|
||||||
|
supports_tool_choice: true
|
||||||
|
supports_web_search: false
|
||||||
|
supports_prompt_caching: false
|
||||||
|
supports_embedding: false
|
||||||
|
supports_audio_input: false
|
||||||
|
supports_audio_output: false
|
||||||
|
supports_computer_use: false
|
||||||
|
# Model family info
|
||||||
|
mode: "chat"
|
||||||
|
model_group: "nemotron-family"
|
||||||
|
region: "eu-west"
|
||||||
|
|
||||||
|
|
||||||
|
router_settings:
|
||||||
|
redis_host: litellm-redis
|
||||||
|
redis_port: 6379
|
||||||
|
redis_password: os.environ/REDIS_PASSWORD
|
||||||
|
routing_strategy: simple-shuffle
|
||||||
|
num_retries: 3
|
||||||
|
retry_after: 5
|
||||||
|
allowed_fails: 3
|
||||||
|
cooldown_time: 30
|
||||||
|
enable_pre_call_checks: true
|
||||||
|
|
||||||
|
# Retry policy for different error types
|
||||||
|
retry_policy:
|
||||||
|
RateLimitErrorRetries: 5
|
||||||
|
TimeoutErrorRetries: 3
|
||||||
|
AuthenticationErrorRetries: 0
|
||||||
|
BadRequestErrorRetries: 1
|
||||||
|
InternalServerErrorRetries: 4
|
||||||
|
|
||||||
|
# Allowed fails policy before cooldown
|
||||||
|
allowed_fails_policy:
|
||||||
|
BadRequestErrorAllowedFails: 1000
|
||||||
|
AuthenticationErrorAllowedFails: 5
|
||||||
|
TimeoutErrorAllowedFails: 12
|
||||||
|
RateLimitErrorAllowedFails: 10000
|
||||||
|
InternalServerErrorAllowedFails: 20
|
||||||
|
|
||||||
|
fallbacks:
|
||||||
|
- LivQwen: [LivKimi, LivGemma]
|
||||||
|
- LivKimi: [LivGemma, LivQwen]
|
||||||
|
- LivGemma: [LivKimi, LivQwen]
|
||||||
|
|
||||||
|
# LiteLLM module settings
|
||||||
|
litellm_settings:
|
||||||
|
drop_params: false
|
||||||
|
set_verbose: false
|
||||||
|
request_timeout: 600
|
||||||
|
num_retries: 3
|
||||||
|
cache: true # Enable caching [2]
|
||||||
|
cache_params:
|
||||||
|
type: redis
|
||||||
|
host: litellm-redis
|
||||||
|
port: 6379
|
||||||
|
password: os.environ/REDIS_PASSWORD
|
||||||
|
ttl: 3600
|
||||||
|
namespace: "litellm.livtec.caching"
|
||||||
|
redact_user_api_key_info: true
|
||||||
|
turn_off_message_logging: false
|
||||||
Loading…
Add table
Reference in a new issue