Files
nixos-core/apps/ollama/docker-compose.yml
T
kiskaadee d9013cca0a feat(ollama): implement hybrid security model and initialize llama3
- Reconfigured Traefik labels to support dual-router logic:
  - Priority 100: Token-based bypass via 'X-Ollama-Key' header for automation.
  - Priority 50: Standard Authelia SSO protection for browser access.
- Documented the 'Trusted Payload' flow in docs/usability.md.
- Initialized the service by pulling the 'llama3' model to the shared volume.
2026-05-13 12:38:27 -05:00

46 lines
1.6 KiB
YAML

services:
ollama:
image: ollama/ollama:latest
deploy:
replicas: 3
restart_policy:
condition: on-failure
environment:
- OLLAMA_HOST=0.0.0.0
- OLLAMA_ACCELERATE_SYSTEM=1
devices:
- /dev/dri:/dev/dri
volumes:
- ollama_data:/root/.ollama:rw
networks:
- proxy-net
labels:
- "traefik.enable=true"
# Router 1: API/Automation (Token-based)
- "traefik.http.routers.ollama-api.rule=Host(`ollama.arch-services.mywire.org`) && Header(`X-Ollama-Key`, `sk-ollama-hardened-hub-2026`)"
- "traefik.http.routers.ollama-api.entrypoints=websecure"
- "traefik.http.routers.ollama-api.tls.certresolver=myresolver"
- "traefik.http.routers.ollama-api.priority=100"
- "traefik.http.routers.ollama-api.service=ollama-svc"
# Router 2: Browser/Standard (Authelia Protected)
- "traefik.http.routers.ollama-browser.rule=Host(`ollama.arch-services.mywire.org`)"
- "traefik.http.routers.ollama-browser.entrypoints=websecure"
- "traefik.http.routers.ollama-browser.tls.certresolver=myresolver"
- "traefik.http.routers.ollama-browser.middlewares=authelia-auth@docker"
- "traefik.http.routers.ollama-browser.priority=50"
- "traefik.http.routers.ollama-browser.service=ollama-svc"
# Shared Service
- "traefik.http.services.ollama-svc.loadbalancer.server.port=11434"
- "traefik.http.services.ollama-svc.loadbalancer.healthcheck.path=/api/tags"
- "traefik.http.services.ollama-svc.loadbalancer.healthcheck.interval=10s"
volumes:
ollama_data:
networks:
proxy-net:
external: true