version: "3.8"
services:
  es:
    build:
      context: ../elasticsearch/build
      dockerfile: Dockerfile
    image: argus-elasticsearch:latest
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
    volumes:
      - ./private/argus/:/private/argus/
    ports: ["9200:9200"]
    healthcheck:
      test: ["CMD-SHELL", "curl -fs http://localhost:9200 >/dev/null || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 30
    restart: always

  kibana:
    build:
      context: ../kibana/build
      dockerfile: Dockerfile
    image: argus-kibana:latest
    environment:
      - ELASTICSEARCH_HOSTS=http://es.log.argus.com:9200
    volumes:
      - ./private/argus/:/private/argus/
    ports: ["5601:5601"]
    depends_on:
      es:
        condition: service_healthy

  fluent-bit-host01:
    image: ubuntu:22.04
    environment:
      - CLUSTER=local
      - RACK=dev
      - HOSTNAME=host01
      - ES_HOST=es
      - ES_PORT=9200
    volumes:
      - ../fluent-bit/build:/private/
    ports: ["2020:2020"]
    depends_on:
      es:
        condition: service_healthy
    command: /private/start-fluent-bit.sh
    healthcheck:
      test: ["CMD-SHELL", "curl -fs http://localhost:2020/api/v2/metrics >/dev/null || exit 1"]
      interval: 15s
      timeout: 10s
      retries: 30

  fluent-bit-host02:
    image: ubuntu:22.04
    environment:
      - CLUSTER=local
      - RACK=dev
      - HOSTNAME=host02
      - ES_HOST=es
      - ES_PORT=9200
    volumes:
      - ../fluent-bit/build:/private/
    ports: ["2021:2020"]
    depends_on:
      es:
        condition: service_healthy
    command: /private/start-fluent-bit.sh
    healthcheck:
      test: ["CMD-SHELL", "curl -fs http://localhost:2020/api/v2/metrics >/dev/null || exit 1"]
      interval: 15s
      timeout: 10s
      retries: 30
    restart: always

  bind9:
      image: argus-bind9:latest
      volumes:
        - ./private/argus:/private/argus/
      restart: always

