197 lines
5.0 KiB
YAML
197 lines
5.0 KiB
YAML
version: '3.8'
|
||
|
||
services:
|
||
# Основной веб-интерфейс с поддержкой GPU
|
||
open-webui:
|
||
image: ghcr.io/open-webui/open-webui:main
|
||
container_name: ai-server-webui
|
||
ports:
|
||
- "3000:8080"
|
||
environment:
|
||
# Подключение к Ollama
|
||
- OLLAMA_BASE_URL=http://host.docker.internal:11434
|
||
|
||
# Настройки безопасности
|
||
- WEBUI_SECRET_KEY=ai-server-ubuntu-rtx2060-2024
|
||
- WEBUI_NAME=AI Server RTX 2060
|
||
|
||
# Локализация
|
||
- DEFAULT_LOCALE=ru-RU
|
||
- DEFAULT_MODELS=llama3.2:3b,codellama:7b
|
||
|
||
# Настройки интерфейса
|
||
- SHOW_ADMIN_DETAILS=false
|
||
- ENABLE_SIGNUP=true
|
||
- ENABLE_LOGIN_FORM=true
|
||
- ENABLE_COMMUNITY_SHARING=false
|
||
|
||
# Настройки чатов
|
||
- DEFAULT_USER_ROLE=user
|
||
- ENABLE_MODEL_FILTER=true
|
||
- MODEL_FILTER_LIST=llama3.2:1b;llama3.2:3b;codellama:7b;mistral:7b
|
||
|
||
# Настройки производительности
|
||
- WEBUI_SESSION_COOKIE_SAME_SITE=lax
|
||
- WEBUI_SESSION_COOKIE_SECURE=false
|
||
|
||
volumes:
|
||
# Постоянное хранение данных
|
||
- open-webui-data:/app/backend/data
|
||
|
||
# Кастомные настройки
|
||
- ./config:/app/backend/config:ro
|
||
- ./logs:/app/backend/logs
|
||
|
||
extra_hosts:
|
||
# Доступ к хосту для подключения к Ollama
|
||
- "host.docker.internal:host-gateway"
|
||
|
||
restart: unless-stopped
|
||
networks:
|
||
- ai-network
|
||
|
||
# Ограничения ресурсов (оптимизировано для RTX 2060)
|
||
deploy:
|
||
resources:
|
||
limits:
|
||
cpus: '4.0'
|
||
memory: 6G
|
||
reservations:
|
||
cpus: '1.0'
|
||
memory: 2G
|
||
|
||
# Healthcheck
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 40s
|
||
|
||
# Мониторинг GPU и системы
|
||
nvidia-exporter:
|
||
image: mindprince/nvidia_gpu_prometheus_exporter:0.1
|
||
container_name: ai-server-gpu-exporter
|
||
ports:
|
||
- "9445:9445"
|
||
volumes:
|
||
- /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1:/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1:ro
|
||
- /usr/bin/nvidia-smi:/usr/bin/nvidia-smi:ro
|
||
environment:
|
||
- NVIDIA_VISIBLE_DEVICES=all
|
||
restart: unless-stopped
|
||
networks:
|
||
- ai-network
|
||
profiles:
|
||
- monitoring
|
||
|
||
# Веб-интерфейс для управления Docker
|
||
portainer:
|
||
image: portainer/portainer-ce:latest
|
||
container_name: ai-server-portainer
|
||
ports:
|
||
- "9000:9000"
|
||
volumes:
|
||
- /var/run/docker.sock:/var/run/docker.sock
|
||
- portainer-data:/data
|
||
restart: unless-stopped
|
||
networks:
|
||
- ai-network
|
||
deploy:
|
||
resources:
|
||
limits:
|
||
cpus: '0.5'
|
||
memory: 512M
|
||
profiles:
|
||
- monitoring
|
||
|
||
# Grafana для мониторинга (опционально)
|
||
grafana:
|
||
image: grafana/grafana:latest
|
||
container_name: ai-server-grafana
|
||
ports:
|
||
- "3001:3000"
|
||
environment:
|
||
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||
- GF_USERS_ALLOW_SIGN_UP=false
|
||
volumes:
|
||
- grafana-data:/var/lib/grafana
|
||
restart: unless-stopped
|
||
networks:
|
||
- ai-network
|
||
profiles:
|
||
- monitoring
|
||
|
||
# Prometheus для сбора метрик (опционально)
|
||
prometheus:
|
||
image: prom/prometheus:latest
|
||
container_name: ai-server-prometheus
|
||
ports:
|
||
- "9090:9090"
|
||
volumes:
|
||
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||
- prometheus-data:/prometheus
|
||
command:
|
||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||
- '--storage.tsdb.path=/prometheus'
|
||
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
||
- '--web.console.templates=/etc/prometheus/consoles'
|
||
- '--storage.tsdb.retention.time=200h'
|
||
- '--web.enable-lifecycle'
|
||
restart: unless-stopped
|
||
networks:
|
||
- ai-network
|
||
profiles:
|
||
- monitoring
|
||
|
||
# Reverse proxy для безопасности (опционально)
|
||
nginx:
|
||
image: nginx:alpine
|
||
container_name: ai-server-nginx
|
||
ports:
|
||
- "80:80"
|
||
- "443:443"
|
||
volumes:
|
||
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
|
||
- ./ssl:/etc/nginx/ssl:ro
|
||
depends_on:
|
||
- open-webui
|
||
restart: unless-stopped
|
||
networks:
|
||
- ai-network
|
||
profiles:
|
||
- production
|
||
|
||
networks:
|
||
ai-network:
|
||
driver: bridge
|
||
ipam:
|
||
config:
|
||
- subnet: 172.20.0.0/16
|
||
gateway: 172.20.0.1
|
||
|
||
volumes:
|
||
open-webui-data:
|
||
driver: local
|
||
driver_opts:
|
||
type: none
|
||
o: bind
|
||
device: /opt/ai-server/data
|
||
|
||
portainer-data:
|
||
driver: local
|
||
|
||
grafana-data:
|
||
driver: local
|
||
|
||
prometheus-data:
|
||
driver: local
|
||
|
||
# Конфигурация для production
|
||
x-production-settings: &production-settings
|
||
restart: unless-stopped
|
||
logging:
|
||
driver: "json-file"
|
||
options:
|
||
max-size: "10m"
|
||
max-file: "3" |