-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-compose.external.yml
More file actions
executable file
·93 lines (86 loc) · 3.03 KB
/
docker-compose.external.yml
File metadata and controls
executable file
·93 lines (86 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# External Providers Only Docker Compose Configuration
#
# This setup uses ONLY external cloud providers (OpenAI, Anthropic, Google, etc.)
# without requiring a local Ollama instance.
#
# Quick Start:
# 1. Build locally: docker compose build
# 2. Copy this file to docker-compose.yml (or use with -f flag)
# 3. Set your API keys in .env file (in project root)
# 4. docker-compose up -d
#
# NOTE: The .env file will be mounted to /app/.env in the container.
# If .env doesn't exist, auto-setup will create one.
#
# See: docs/external-providers.md for complete documentation
version: '3.8'
services:
smarterrouter:
image: ghcr.io/peva3/smarterrouter:latest
build:
context: .
dockerfile: Dockerfile
container_name: smarterrouter
ports:
- "11436:11436"
env_file:
- .env
environment:
# Basic router configuration
- ROUTER_PROVIDER=ollama # Keep for compatibility; won't actually connect to local
- ROUTER_OLLAMA_URL=http://localhost:11434 # Not used but required by some components
- ROUTER_HOST=0.0.0.0
- ROUTER_PORT=11436
- ROUTER_DATABASE_URL=sqlite:////app/data/router.db # Persistent database location
# Enable external provider routing
- ROUTER_EXTERNAL_PROVIDERS_ENABLED=true
- ROUTER_EXTERNAL_PROVIDERS=openai,anthropic,google
# provider.db configuration (auto-updates)
- ROUTER_PROVIDER_DB_ENABLED=true
- ROUTER_PROVIDER_DB_AUTO_UPDATE_HOURS=4
# Optional: Set quality preference (0.0=speed, 1.0=quality)
# ROUTER_QUALITY_PREFERENCE=0.5
# Optional: Enable caching for better performance
# ROUTER_CACHE_ENABLED=true
# ROUTER_SEMANTIC_CACHE_SIZE=1000
volumes:
# Mount .env file from project root
# If .env doesn't exist on host, it will be created by auto-setup
- ./.env:/app/.env:rw
# Persist provider.db and SQLite databases
# Ensure the ./data directory exists and is writable by the container user (UID 1000).
# If running for the first time, create the directory and set permissions:
# mkdir -p ./data && chown 1000:1000 ./data
- ./data:/app/data:rw
# Optional: mount logs directory
- ./logs:/app/logs:rw
restart: unless-stopped
networks:
- smarterrouter-network
# No GPU needed for external-only setup
# Uncomment below if you also want local fallback with GPU
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:11436/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Resource limits (adjust as needed)
# deploy:
# resources:
# limits:
# memory: 4G
# cpus: '2.0'
# reservations:
# memory: 2G
# cpus: '1.0'
networks:
smarterrouter-network:
driver: bridge