version: "3.8"

networks:
  default:
    name: argus-sys-net
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.29.0.0/16

services:
  bind:
    image: ${BIND_IMAGE_TAG:-argus-bind9:latest}
    container_name: argus-bind-sys
    networks:
      default:
        ipv4_address: 172.29.0.2
    volumes:
      - ./private:/private
    restart: unless-stopped

  master:
    image: ${MASTER_IMAGE_TAG:-argus-master:latest}
    container_name: argus-master-sys
    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.29.0.10
    restart: unless-stopped

  es:
    image: argus-elasticsearch:latest
    container_name: argus-es-sys
    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:
      - ./private/argus/log/elasticsearch:/private/argus/log/elasticsearch
      - ./private/argus/etc:/private/argus/etc
    ports:
      - "9200:9200"
    restart: unless-stopped

  kibana:
    image: argus-kibana:latest
    container_name: argus-kibana-sys
    environment:
      - ELASTICSEARCH_HOSTS=http://es.log.argus.com:9200
      - ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}
      - ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}
    volumes:
      - ./private/argus/log/kibana:/private/argus/log/kibana
      - ./private/argus/etc:/private/argus/etc
    depends_on:
      - es
    ports:
      - "5601:5601"
    restart: unless-stopped

  node-a:
    image: ubuntu:22.04
    container_name: argus-node-a
    hostname: 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:
      - ./private-nodea/argus/agent/dev-yyrshare-nbnyx10-cp2f-pod-0:/private/argus/agent/dev-yyrshare-nbnyx10-cp2f-pod-0
      - ../../agent/dist/argus-agent:/usr/local/bin/argus-agent:ro
      - ./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:
      - 172.29.0.2
    ports:
      - "2020:2020"
    restart: unless-stopped

  node-b:
    image: ubuntu:22.04
    container_name: argus-node-b
    hostname: 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:
      - ./private-nodeb/argus/agent/dev-yyrshare-uuuu10-ep2f-pod-0:/private/argus/agent/dev-yyrshare-uuuu10-ep2f-pod-0
      - ../../agent/dist/argus-agent:/usr/local/bin/argus-agent:ro
      - ./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:
      - 172.29.0.2
    ports:
      - "2021:2020"
    restart: unless-stopped
