services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    restart: unless-stopped
    ports:
      # Loopback: service.yaml's healthcheck + healthcheck.sh curl localhost
      # directly on the node. Tailscale IP: llm-gateway@PIHA reaches this over
      # the mesh as http://solaria:11434 (MagicDNS). No 0.0.0.0 — this is a
      # private service, don't expose wider than local + internal network.
      # Requires .env (from env.example) next to this file at deploy.
      - "127.0.0.1:11434:11434"
      - "${TAILSCALE_BIND_IP}:11434:11434"
    volumes:
      - /opt/homelab/data/ollama:/root/.ollama
    # GPU przywrócone 2026-07-16: sterownik nvidia-driver-595-open (repo distro)
    # zainstalowany, CUDA 13.2, nvidia-container-toolkit już obecny. Patrz
    # docs/infra/ollama-solaria-cutover-2026-07-15.md dla historii cutoveru.
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
