version: "3.8"

networks:
  argus-debug-net:
    external: true
    name: ${SYS_DEBUG_NETWORK_NAME:-argus-debug-net}

services:
  bind:
    image: ${BIND_IMAGE_TAG:-argus-bind9:latest}
    container_name: ${SYS_DEBUG_CONTAINER_PREFIX:-argus-debug}-bind
    networks:
      argus-debug-net:
        ipv4_address: ${SYS_DEBUG_BIND_IP:-172.30.0.2}
    volumes:
      - ${SYS_DEBUG_PRIVATE_CORE}:/private
    restart: unless-stopped

  master:
    image: ${MASTER_IMAGE_TAG:-argus-master:latest}
    container_name: ${SYS_DEBUG_CONTAINER_PREFIX:-argus-debug}-master
    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:
      - ${SYS_DEBUG_PRIVATE_CORE}/argus/master:/private/argus/master
      - ${SYS_DEBUG_PRIVATE_CORE}/argus/metric/prometheus:/private/argus/metric/prometheus
      - ${SYS_DEBUG_PRIVATE_CORE}/argus/etc:/private/argus/etc
    networks:
      argus-debug-net:
        ipv4_address: ${SYS_DEBUG_MASTER_IP:-172.30.0.10}
    restart: unless-stopped

  es:
    image: ${ES_IMAGE_TAG:-argus-elasticsearch:latest}
    container_name: ${SYS_DEBUG_CONTAINER_PREFIX:-argus-debug}-es
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
      - ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}
      - ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}
    volumes:
      - ${SYS_DEBUG_PRIVATE_CORE}/argus/log/elasticsearch:/private/argus/log/elasticsearch
      - ${SYS_DEBUG_PRIVATE_CORE}/argus/etc:/private/argus/etc
    ports:
      - "9200:9200"
    networks:
      argus-debug-net:
        ipv4_address: ${SYS_DEBUG_ES_IP:-172.30.0.20}
    restart: unless-stopped

  kibana:
    image: ${KIBANA_IMAGE_TAG:-argus-kibana:latest}
    container_name: ${SYS_DEBUG_CONTAINER_PREFIX:-argus-debug}-kibana
    environment:
      - ELASTICSEARCH_HOSTS=http://es.log.argus.com:9200
      - ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}
      - ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}
    volumes:
      - ${SYS_DEBUG_PRIVATE_CORE}/argus/log/kibana:/private/argus/log/kibana
      - ${SYS_DEBUG_PRIVATE_CORE}/argus/etc:/private/argus/etc
    depends_on:
      - es
    ports:
      - "5601:5601"
    networks:
      argus-debug-net:
        ipv4_address: ${SYS_DEBUG_KIBANA_IP:-172.30.0.30}
    restart: unless-stopped

  node-a:
    image: ubuntu:22.04
    container_name: ${SYS_DEBUG_CONTAINER_PREFIX:-argus-debug}-node-a
    hostname: ${SYS_DEBUG_NODEA_HOST:-dev-yyrshare-nbnyx10-cp2f-pod-0}
    depends_on:
      - master
      - bind
      - es
    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}
      - ES_HOST=es
      - ES_PORT=9200
      - CLUSTER=local
      - RACK=dev
    volumes:
      - ${SYS_DEBUG_PRIVATE_NODEA}/argus/agent/${SYS_DEBUG_NODEA_HOST:-dev-yyrshare-nbnyx10-cp2f-pod-0}:/private/argus/agent/${SYS_DEBUG_NODEA_HOST:-dev-yyrshare-nbnyx10-cp2f-pod-0}
      - ../../agent/dist/argus-agent:/usr/local/bin/argus-agent:ro
      - ../tests/scripts/node_entrypoint.sh:/usr/local/bin/node-entrypoint.sh:ro
      - ../../log/fluent-bit/build/start-fluent-bit.sh:/assets/start-fluent-bit.sh:ro
      - ../../log/fluent-bit/build/etc:/assets/fluent-bit/etc:ro
      - ../../log/fluent-bit/build/packages:/assets/fluent-bit/packages:ro
    entrypoint:
      - /usr/local/bin/node-entrypoint.sh
    dns:
      - ${SYS_DEBUG_BIND_IP:-172.30.0.2}
    ports:
      - "2020:2020"
    networks:
      argus-debug-net:
        ipv4_address: ${SYS_DEBUG_NODEA_IP:-172.30.0.101}
    restart: unless-stopped

  node-b:
    image: ubuntu:22.04
    container_name: ${SYS_DEBUG_CONTAINER_PREFIX:-argus-debug}-node-b
    hostname: ${SYS_DEBUG_NODEB_HOST:-dev-yyrshare-uuuu10-ep2f-pod-0}
    depends_on:
      - master
      - bind
      - es
    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}
      - ES_HOST=es
      - ES_PORT=9200
      - CLUSTER=local
      - RACK=dev
    volumes:
      - ${SYS_DEBUG_PRIVATE_NODEB}/argus/agent/${SYS_DEBUG_NODEB_HOST:-dev-yyrshare-uuuu10-ep2f-pod-0}:/private/argus/agent/${SYS_DEBUG_NODEB_HOST:-dev-yyrshare-uuuu10-ep2f-pod-0}
      - ../../agent/dist/argus-agent:/usr/local/bin/argus-agent:ro
      - ../tests/scripts/node_entrypoint.sh:/usr/local/bin/node-entrypoint.sh:ro
      - ../../log/fluent-bit/build/start-fluent-bit.sh:/assets/start-fluent-bit.sh:ro
      - ../../log/fluent-bit/build/etc:/assets/fluent-bit/etc:ro
      - ../../log/fluent-bit/build/packages:/assets/fluent-bit/packages:ro
    entrypoint:
      - /usr/local/bin/node-entrypoint.sh
    dns:
      - ${SYS_DEBUG_BIND_IP:-172.30.0.2}
    ports:
      - "2021:2020"
    networks:
      argus-debug-net:
        ipv4_address: ${SYS_DEBUG_NODEB_IP:-172.30.0.102}
    restart: unless-stopped
