refactor: support remote Ollama server in docker-compose
- Remove Ollama service from docker-compose.yml (now external/remote)
- Remove ollama_data volume and network configuration
- Simplify compose to only llm-monitor service
- Use env_file for all configuration from .env
- Make API_PORT dynamic with ${API_PORT:-8000}
- Update env.example with Ollama remote server examples:
- Local development: http://localhost:11434
- Remote server: http://ollama.example.com:11434
- Remote with SSL: https://ollama.example.com
- Improve documentation for remote Ollama setup
This allows deployment against any Ollama server (local or remote).
This commit is contained in:
+3
-43
@@ -1,23 +1,6 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Ollama Service
|
|
||||||
ollama:
|
|
||||||
image: ollama/ollama:latest
|
|
||||||
container_name: ollama-server
|
|
||||||
ports:
|
|
||||||
- "11434:11434"
|
|
||||||
environment:
|
|
||||||
OLLAMA_HOST: 0.0.0.0:11434
|
|
||||||
volumes:
|
|
||||||
- ollama_data:/root/.ollama
|
|
||||||
restart: unless-stopped
|
|
||||||
# Keep container running until stopped
|
|
||||||
stdin_open: true
|
|
||||||
tty: true
|
|
||||||
networks:
|
|
||||||
- llm-monitor-network
|
|
||||||
|
|
||||||
# LLM Monitor Dashboard
|
# LLM Monitor Dashboard
|
||||||
llm-monitor:
|
llm-monitor:
|
||||||
build:
|
build:
|
||||||
@@ -25,45 +8,22 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: llm-monitor-app
|
container_name: llm-monitor-app
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "${API_PORT:-8000}:${API_PORT:-8000}"
|
||||||
environment:
|
|
||||||
# Carica variabili da .env
|
|
||||||
OLLAMA_HOST: http://ollama:11434
|
|
||||||
OLLAMA_TIMEOUT: 30
|
|
||||||
API_HOST: 0.0.0.0
|
|
||||||
API_PORT: 8000
|
|
||||||
API_WORKERS: 4
|
|
||||||
CORS_ORIGINS: http://localhost:3000,http://localhost:5173,http://localhost:8000
|
|
||||||
LOG_LEVEL: INFO
|
|
||||||
ENVIRONMENT: production
|
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
depends_on:
|
|
||||||
- ollama
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
networks:
|
|
||||||
- llm-monitor-network
|
|
||||||
# Health check
|
# Health check
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:${API_PORT:-8000}/api/v1/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
volumes:
|
|
||||||
ollama_data:
|
|
||||||
driver: local
|
|
||||||
|
|
||||||
networks:
|
|
||||||
llm-monitor-network:
|
|
||||||
driver: bridge
|
|
||||||
|
|
||||||
# Istruzioni di avvio:
|
# Istruzioni di avvio:
|
||||||
# docker compose up -d # Avvia i servizi
|
# docker compose up -d # Avvia i servizi
|
||||||
# docker compose logs -f # Visualizza i log
|
# docker compose logs -f # Visualizza i log
|
||||||
# docker compose down # Ferma i servizi
|
# docker compose down # Ferma i servizi
|
||||||
# docker compose stop ollama # Ferma solo Ollama
|
# docker compose restart # Riavvia i servizi
|
||||||
# docker compose start ollama # Riavvia Ollama
|
|
||||||
|
|||||||
+7
-3
@@ -1,10 +1,14 @@
|
|||||||
# LLM Monitor - Environment Configuration Example
|
# LLM Monitor - Environment Configuration Example
|
||||||
# Copy this file to .env and adjust values for your environment
|
# Copia questo file in .env e personalizza per il tuo ambiente
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# Ollama Configuration
|
# Ollama Configuration (Remote Server)
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# URL base dell'API Ollama
|
# URL base dell'API Ollama (server remoto)
|
||||||
|
# Esempi:
|
||||||
|
# - http://localhost:11434 (sviluppo locale)
|
||||||
|
# - http://ollama.example.com:11434 (server remoto)
|
||||||
|
# - https://ollama.example.com (con SSL)
|
||||||
OLLAMA_HOST=http://localhost:11434
|
OLLAMA_HOST=http://localhost:11434
|
||||||
|
|
||||||
# Timeout per le richieste a Ollama (secondi)
|
# Timeout per le richieste a Ollama (secondi)
|
||||||
|
|||||||
Reference in New Issue
Block a user