version: '3.3'

services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.3.0
    container_name: elasticsearch
    restart: always
    user: 1000:1000
    environment:
      - node.name=es01
      - cluster.initial_master_nodes=es01
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - /opt/elk/data:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet

  kibana:
    image: docker.elastic.co/kibana/kibana:7.3.0
    container_name: kibana
    restart: always
    ports:
      - 5601:5601
    networks:
      - esnet
    depends_on:
      - elasticsearch
      
  logstash:
    image: docker.elastic.co/logstash/logstash:7.1.1
    container_name: logstash
    restart: always
    volumes:
      - /opt/elk/settings/:/usr/share/logstash/config/
      - /opt/elk/postgresql-42.2.6.jar:/usr/share/logstash/postgresql-42.2.6.jar
    ports:
      - 5044:5044
    networks:
      - esnet
    depends_on:
      - elasticsearch

networks:
  esnet:
