version: '2'

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    hostname: elasticsearch
    container_name: elasticsearch
    restart: always
    environment:
      - node.name=elastic
      - cluster.name=cluster01
      - cluster.initial_master_nodes=elastic
      - bootstrap.memory_lock=true
      - ES_JAVA_OPTS=-Xms1g -Xmx1g
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./elastic:/usr/share/elasticsearch/data
#      - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    expose:
      - 9200
      - 9300
    networks:
      mynet:
        ipv4_address: 172.1.0.101

  kibana:
    image: docker.elastic.co/kibana/kibana:7.6.2
    hostname: kibana
    container_name: kibana
    restart: always
    environment:
      SERVER_NAME: kibana.hatthieves.es
      ELASTICSEARCH_HOSTS: http://elasticsearch:9200
    expose:
      - 5601
    networks:
      mynet:
        ipv4_address: 172.1.0.102
    
  logstash:
    image: docker.elastic.co/logstash/logstash:7.6.2
    hostname: logstash
    container_name: logstash
    restart: always
    entrypoint:
      - logstash
      - -f
      - nginx.conf
#    expose:
#      - 5044
    volumes:
      - ./nginx.conf:/usr/share/logstash/nginx.conf:ro
      - ./file:/usr/share/logstash/data/plugins/inputs/file
      - /opt/docker/production/nginx/logs/access.log:/access.log
    networks:
      mynet:
        ipv4_address: 172.1.0.103
    
#  filebeat:
#    image: docker.elastic.co/beats/filebeat:7.6.2
#    hostname: filebeat
#    container_name: filebeat
#    restart: always
#    entrypoint:
#      - /bin/sleep
#      - infinity
## - /usr/local/bin/docker-entrypoint -e
#    volumes:
#      - ./filebeat.yml:/usr/share/filebeat/filebeat.yml
#      - /opt/docker/nginx/logs/access.log:/access.log
#    networks:
#      mynet:
#        ipv4_address: 172.1.0.104
    
networks:
  mynet:
    driver: bridge
    ipam:
      config:
      - subnet: 172.1.0.0/24
