105 lines
3.0 KiB
YAML
105 lines
3.0 KiB
YAML
# Rolle "infra" (LXC/VM auf einem i7-Node): Router, LiteLLM, Postgres, Monitoring.
|
|
# Start: cp .env.example .env && docker compose up -d
|
|
name: knaster-infra
|
|
|
|
x-restart: &restart
|
|
restart: unless-stopped
|
|
labels: {autoheal: "true"}
|
|
|
|
services:
|
|
router:
|
|
<<: *restart
|
|
build:
|
|
context: ../../..
|
|
dockerfile: deploy/docker/router.Dockerfile
|
|
image: knaster/router:${KNASTER_VERSION:-dev}
|
|
env_file: .env
|
|
environment:
|
|
KNASTER_DB_URL: postgresql+psycopg://knaster:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD fehlt}@postgres:5432/knaster
|
|
KNASTER_SITE_DIR: /app/sites/${KNASTER_SITE:-knaster}
|
|
LITELLM_BASE_URL: http://litellm:4000
|
|
ports: ["8080:8080"]
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
litellm: {condition: service_started}
|
|
|
|
litellm:
|
|
<<: *restart
|
|
image: ghcr.io/berriai/litellm:${LITELLM_TAG:-main-stable} # vor Deployment auf feste Version pinnen
|
|
command: ["--config", "/app/config.yaml", "--port", "4000"]
|
|
env_file: .env
|
|
volumes:
|
|
- ../../litellm/config.yaml:/app/config.yaml:ro
|
|
ports: ["4000:4000"]
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:4000/health/liveliness', timeout=4)"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
postgres:
|
|
<<: *restart
|
|
image: pgvector/pgvector:pg16
|
|
environment:
|
|
POSTGRES_USER: knaster
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD fehlt}
|
|
POSTGRES_DB: knaster
|
|
volumes:
|
|
- postgres:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U knaster -d knaster"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
prometheus:
|
|
<<: *restart
|
|
image: prom/prometheus:v2.53.0
|
|
command:
|
|
- --config.file=/etc/prometheus/prometheus.yml
|
|
- --storage.tsdb.retention.time=15d
|
|
- --web.enable-lifecycle
|
|
volumes:
|
|
- ../../prometheus:/etc/prometheus:ro
|
|
- prometheus:/prometheus
|
|
ports: ["9090:9090"]
|
|
|
|
alertmanager:
|
|
<<: *restart
|
|
image: prom/alertmanager:v0.27.0
|
|
command: ["--config.file=/etc/alertmanager/alertmanager.yml"]
|
|
volumes:
|
|
- ../../alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
|
|
- ./secrets/router_token:/etc/alertmanager/router_token:ro
|
|
ports: ["9093:9093"]
|
|
|
|
grafana:
|
|
<<: *restart
|
|
image: grafana/grafana:11.1.0
|
|
profiles: ["dashboards"]
|
|
volumes:
|
|
- grafana:/var/lib/grafana
|
|
ports: ["3000:3000"]
|
|
|
|
pve-exporter:
|
|
<<: *restart
|
|
image: prompve/prometheus-pve-exporter:${PVE_EXPORTER_TAG:-latest} # vor Deployment pinnen
|
|
profiles: ["proxmox"]
|
|
volumes:
|
|
- ./secrets/pve.yml:/etc/prometheus/pve.yml:ro
|
|
ports: ["9221:9221"]
|
|
|
|
autoheal:
|
|
restart: unless-stopped
|
|
image: willfarrell/autoheal:1.2.0
|
|
environment:
|
|
AUTOHEAL_CONTAINER_LABEL: autoheal
|
|
AUTOHEAL_INTERVAL: "15"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
volumes:
|
|
postgres: {}
|
|
prometheus: {}
|
|
grafana: {}
|