services:
  bind:
    image: ${BIND_IMAGE_TAG:-argus-bind9:latest}
    container_name: argus-bind-agent-e2e
    volumes:
      - ./private:/private
    networks:
      default:
        ipv4_address: 172.28.0.2
    environment:
      - "ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}"
      - "ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}"
    restart: always

  master:
    image: argus-master:latest
    container_name: argus-master-agent-e2e
    depends_on:
      - bind
    environment:
      - OFFLINE_THRESHOLD_SECONDS=6
      - ONLINE_THRESHOLD_SECONDS=2
      - SCHEDULER_INTERVAL_SECONDS=1
      - "ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}"
      - "ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}"
    ports:
      - "32300:3000"
    volumes:
      - ./private/argus/master:/private/argus/master
      - ./private/argus/metric/prometheus:/private/argus/metric/prometheus
      - ./private/argus/etc:/private/argus/etc
    networks:
      default:
        ipv4_address: 172.28.0.10
    restart: always

  agent:
    image: ubuntu:22.04
    container_name: argus-agent-e2e
    hostname: dev-e2euser-e2einst-pod-0
    depends_on:
      - master
      - bind
    environment:
      - MASTER_ENDPOINT=http://master.argus.com:3000
      - REPORT_INTERVAL_SECONDS=2
      - "ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}"
      - "ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}"
    volumes:
      - ./private/argus/agent/dev-e2euser-e2einst-pod-0:/private/argus/agent/dev-e2euser-e2einst-pod-0
      - ./private/argus/agent/dev-e2euser-e2einst-pod-0/health:/private/argus/agent/dev-e2euser-e2einst-pod-0/health
      - ./private/argus/etc:/private/argus/etc
      - ../dist/argus-agent:/usr/local/bin/argus-agent:ro
      - ./scripts/agent_entrypoint.sh:/usr/local/bin/agent-entrypoint.sh:ro
      - ../scripts/agent_deployment_verify.sh:/usr/local/bin/agent_deployment_verify.sh:ro
    entrypoint:
      - /usr/local/bin/agent-entrypoint.sh
    networks:
      default:
        ipv4_address: 172.28.0.20
    restart: always

  agent_env:
    image: ubuntu:22.04
    container_name: argus-agent-env-e2e
    hostname: host_abc
    depends_on:
      - master
      - bind
    environment:
      - MASTER_ENDPOINT=http://master.argus.com:3000
      - REPORT_INTERVAL_SECONDS=2
      - AGENT_ENV=prod
      - AGENT_USER=ml
      - AGENT_INSTANCE=node-3
      - AGENT_HOSTNAME=host_abc
      - "ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}"
      - "ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}"
    volumes:
      - ./private/argus/agent/host_abc:/private/argus/agent/host_abc
      - ./private/argus/agent/host_abc/health:/private/argus/agent/host_abc/health
      - ./private/argus/etc:/private/argus/etc
      - ../dist/argus-agent:/usr/local/bin/argus-agent:ro
      - ./scripts/agent_entrypoint.sh:/usr/local/bin/agent-entrypoint.sh:ro
      - ../scripts/agent_deployment_verify.sh:/usr/local/bin/agent_deployment_verify.sh:ro
    entrypoint:
      - /usr/local/bin/agent-entrypoint.sh
    networks:
      default:
        ipv4_address: 172.28.0.21
    restart: always

networks:
  default:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.28.0.0/16
