version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0
    container_name: elasticsearch
    environment:
      - cluster.name=vulnwhisperer
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      - xpack.security.enabled=false

    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 8g
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    #restart: always
    networks:
      esnet:
        aliases:
          - elasticsearch.local
  kibana:
    image: docker.elastic.co/kibana/kibana:6.6.0
    container_name: kibana
    environment:
      SERVER_NAME: kibana
      ELASTICSEARCH_URL: http://elasticsearch:9200
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch
    networks:
      esnet:
        aliases:
          - kibana.local
  kibana-config:
    image: alpine
    container_name: kibana-config
    volumes:
      - ./resources/elk6/init_kibana.sh:/opt/init_kibana.sh
      - ./resources/elk6/kibana_APIonly.json:/opt/kibana_APIonly.json
    command: sh -c "apk add --no-cache curl bash && chmod +x /opt/init_kibana.sh && chmod +r /opt/kibana_APIonly.json && cd /opt/ && /bin/bash /opt/init_kibana.sh" # /opt/kibana_APIonly.json"
    networks:
      esnet:
        aliases:
          - kibana-config.local
  logstash:
    image: docker.elastic.co/logstash/logstash:6.6.0
    container_name: logstash
    volumes:
      - ./resources/elk6/pipeline/:/usr/share/logstash/pipeline
      - ./data/:/opt/vulnwhisperer/data
      #- ./resources/elk6/logstash.yml:/usr/share/logstash/config/logstash.yml
    environment:
      - xpack.monitoring.enabled=false
    depends_on:
      - elasticsearch
    networks:
      esnet:
        aliases:
          - logstash.local
  vulnwhisperer:
    image: hasecuritysolutions/vulnwhisperer:latest
    container_name: vulnwhisperer
    entrypoint: [
                  "vuln_whisperer",
                  "-c",
                  "/opt/vulnwhisperer/vulnwhisperer.ini"
    ]    
    volumes:
      - /opt/vulnwhisperer/data/:/opt/vulnwhisperer/data
      - ./data/:/opt/vulnwhisperer/data
      - ./resources/elk6/vulnwhisperer.ini:/opt/vulnwhisperer/vulnwhisperer.ini
    network_mode: host
volumes:
  esdata1:
    driver: local

networks:
  esnet:
