services:

  dobby:
    image: agent0ai/agent-zero:latest
    container_name: dobby
    ports:
      - "50001:80"    # direct local access for debugging
    volumes:
      - ./agents/dobby:/a0/usr
      - ${HOME}/.ssh:/root/.ssh
    restart: unless-stopped
    environment:
      AUTH_LOGIN: ${AUTH_LOGIN}
      AUTH_PASSWORD: ${AUTH_PASSWORD}
    extra_hosts:
      - "host.docker.internal:host-gateway"

  gemma:
    image: agent0ai/agent-zero:latest
    container_name: gemma
    ports:
      - "50002:80"
    volumes:
      - ./agents/gemma:/a0/usr
      - ${HOME}/.ssh:/root/.ssh
    restart: unless-stopped
    environment:
      AUTH_LOGIN: ${AUTH_LOGIN}
      AUTH_PASSWORD: ${AUTH_PASSWORD}
    extra_hosts:
      - "host.docker.internal:host-gateway"

  gunnar:
    image: agent0ai/agent-zero:latest
    container_name: gunnar
    ports:
      - "50003:80"
    volumes:
      - ./agents/gunnar:/a0/usr
      - ${HOME}/.ssh:/root/.ssh
    restart: unless-stopped
    environment:
      AUTH_LOGIN: ${AUTH_LOGIN}
      AUTH_PASSWORD: ${AUTH_PASSWORD}
    extra_hosts:
      - "host.docker.internal:host-gateway"

  rind:
    image: agent0ai/agent-zero:latest
    container_name: rind
    ports:
      - "50005:80"
    volumes:
      - ./agents/rind:/a0/usr
      - ${HOME}/.ssh:/root/.ssh
    restart: unless-stopped
    environment:
      AUTH_LOGIN: ${AUTH_LOGIN}
      AUTH_PASSWORD: ${AUTH_PASSWORD}
    extra_hosts:
      - "host.docker.internal:host-gateway"

  abyssinthia:
    image: agent0ai/agent-zero:latest
    container_name: abyssinthia
    ports:
      - "50006:80"
    volumes:
      - ./agents/abyssinthia:/a0/usr
      - ${HOME}/.ssh:/root/.ssh
    restart: unless-stopped
    environment:
      AUTH_LOGIN: ${AUTH_LOGIN}
      AUTH_PASSWORD: ${AUTH_PASSWORD}
    extra_hosts:
      - "host.docker.internal:host-gateway"

  gerhard:
    image: agent0ai/agent-zero:latest
    container_name: gerhard
    ports:
      - "50007:80"
    volumes:
      - ./agents/gerhard:/a0/usr
      - ${HOME}/.ssh:/root/.ssh
    restart: unless-stopped
    environment:
      AUTH_LOGIN: ${AUTH_LOGIN}
      AUTH_PASSWORD: ${AUTH_PASSWORD}
    extra_hosts:
      - "host.docker.internal:host-gateway"

  postgres:
    image: postgres:16-alpine
    container_name: festinger-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: festinger
      POSTGRES_PASSWORD: festinger
      POSTGRES_DB: festinger
    volumes:
      - festinger-pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U festinger"]
      interval: 5s
      timeout: 5s
      retries: 10

  festinger:
    build:
      context: ./plugins/festinger
    container_name: festinger
    ports:
      - "11435:11434"    # exposed on host as 11435 to avoid conflict with real Ollama
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      POSTGRES_DSN: "postgresql://festinger:festinger@postgres:5432/festinger"
    extra_hosts:
      - "host.docker.internal:host-gateway"

  glitch-tunnel:
    build:
      context: .
      dockerfile: Dockerfile.tunnel
    container_name: glitch-tunnel
    restart: always
    volumes:
      - ./tunnel:/run/tunnel:ro
    depends_on:
      - dobby
      - gemma
      - gunnar
      - rind
      - abyssinthia
      - gerhard

volumes:
  festinger-pgdata:
