Files
portainer-core/stacks/core-api.yml
T

116 lines
3.2 KiB
YAML

version: '3.8'
# Core API - OpenAPI-compatible functions and AI orchestration for Open WebUI
# Purpose: Provides OpenAI-compatible API (/v1/chat/completions) and tool functions (web scraping)
# Port: 8083 (HTTP API)
# Network: docker-dataplane (shared infrastructure network)
#
# Container image built from: git.schweitz.internal/jpmschweitzer/core-api (internal registry)
services:
core-api:
image: git.schweitz.internal/jpmschweitzer/core-api:latest
container_name: core-api
restart: unless-stopped
ports:
- "8083:8083"
environment:
# Application
- APP_NAME=Core API
- DEBUG=false
# Server
- HOST=0.0.0.0
- PORT=8083
# Logging
- LOG_LEVEL=INFO
# Model Configuration
- DEFAULT_MODEL=gemma:7b
- LIGHTWEIGHT_MODELS=gemma:2b,gemma:7b
- HEAVY_MODELS=mistral:7b,gemma2:9b,mixtral:8x7b
- CODE_MODELS=codestral:latest,codegemma:latest
# Model Aliases (OpenAI → Local)
- ALIAS_GPT35=gemma:7b
- ALIAS_GPT4=mistral:7b
- ALIAS_GPT4_TURBO=mixtral:8x7b
- ALIAS_GPT4_CODE=codestral:latest
# Agent Configuration
# Set to "false" to make agent errors explicit (500 errors) instead of silent fallback.
- AGENT_FALLBACK_ENABLED=false
# Portainer API
- PORTAINER_URL=http://192.168.86.149:8001
- PORTAINER_API_KEY=${PORTAINER_API_KEY}
# Nginx Proxy Manager API
- NPM_URL=http://192.168.86.149:81
- NPM_EMAIL=${NPM_EMAIL}
- NPM_PASSWORD=${NPM_PASSWORD}
# Postgres Shared Database API
- POSTGRES_HOST=192.168.86.149:5432
- POSTGRES_USER=core_api
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# Authentik Configuration
- AUTHENTIK_URL=https://auth.schweitz.net
- AUTHENTIK_USERNAME=${AUTHENTIK_USERNAME}
- AUTHENTIK_PASSWORD=${AUTHENTIK_PASSWORD}
- AUTHENTIK_CORE_API_TOKEN=${AUTHENTIK_CORE_API_TOKEN}
# HOME ASSITANT VARIABLES
- HOMEASSISTANT_URL=http://home-assistant:8123
- HOMEASSISTANT_TOKEN=${HOMEASSISTANT_TOKEN}
# AI SYSTEM VARIABLES
- OLLAMA_BASE_URL=http://192.168.86.149:11434
- OLLAMA_TIMEOUT=300
- SEARXNG_URL=http://192.168.86.149:8080
# Python path
- PYTHONPATH=/app
volumes:
# Data volumes only - no source code
- /home/jpmschweitzer/docker-data/core-api/logs:/app/logs
# Docker socket for direct container access (fallback when Portainer API incomplete)
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/hostfs:ro
environment:
- PSUTIL_PROCFS_PATH=/host/proc
- HOSTFS_ROOT=/hostfs
deploy:
resources:
limits:
cpus: '2.0'
memory: 6G
reservations:
memory: 1G
devices:
- driver: nvidia
count: all
capabilities: [gpu]
labels:
- "com.centurylinklabs.watchtower.enable=true"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8083/health"]
interval: 30s
timeout: 20s
retries: 3
start_period: 60s
networks:
docker-dataplane:
external: true
name: docker-dataplane