# Dozzle — container log viewer.
#
# Multi-host layout via compose profiles:
#   COMPOSE_PROFILES=hub   → runs the web UI (deploy on ana-docker)
#   COMPOSE_PROFILES=agent → runs the remote agent (deploy on ana-ml2)
#
# Same compose.yaml on both servers; per-host `.env` picks the profile.
#
# All tunables live in .env — edit that, not this file.

services:
  dozzle:
    image: amir20/dozzle:${DOZZLE_VERSION}
    container_name: dozzle
    profiles: [hub]
    restart: unless-stopped
    ports:
      - "${DOZZLE_PORT}:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - dozzle_data:/data
    environment:
      - DOZZLE_HOSTNAME=${DOZZLE_HOSTNAME}
      - DOZZLE_REMOTE_AGENT=${DOZZLE_REMOTE_AGENT:-}
      - DOZZLE_AUTH_PROVIDER=${DOZZLE_AUTH_PROVIDER:-none}
      - DOZZLE_USERNAME=${DOZZLE_USERNAME:-}
      - DOZZLE_PASSWORD=${DOZZLE_PASSWORD:-}
    healthcheck:
      test: ["CMD", "/dozzle", "healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 15s
    networks:
      - tnet
    labels:
      - homepage.group=Monitoring
      - homepage.name=Dozzle
      - homepage.icon=mdi-text-box-search
      - homepage.description=Container logs (ana-docker + ana-ml2)
      - homepage.href=http://10.250.50.70:${DOZZLE_PORT}

  dozzle-agent:
    image: amir20/dozzle:${DOZZLE_VERSION}
    container_name: dozzle-agent
    profiles: [agent]
    restart: unless-stopped
    command: agent
    ports:
      - "${DOZZLE_AGENT_BIND:-0.0.0.0}:${DOZZLE_AGENT_PORT}:7007"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - dozzle_agent_data:/data
    environment:
      - DOZZLE_HOSTNAME=${DOZZLE_HOSTNAME}
    networks:
      - tnet

volumes:
  dozzle_data:
  dozzle_agent_data:

networks:
  tnet:
    name: traefik-net
    external: true
