version: '3.3'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
    container_name: elasticsearch
    environment:
      ES_JAVA_OPTS: "-Xms1g -Xmx8g"
      discovery.type: "single-node"
      ELASTIC_USERNAME: "elastic"
      ELASTIC_PASSWORD: "elastic"
      xpack.security.enabled: "true"
    volumes:
      - elastic_data:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
    restart: unless-stopped

  kibana:
    image: docker.elastic.co/kibana/kibana:7.16.2
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      xpack.security.enabled: "true"
      ELASTICSEARCH_URL: http://elasticsearch:9200
      ELASTICSEARCH_USERNAME: "elastic"
      ELASTICSEARCH_PASSWORD: "elastic"
    depends_on:
      - elasticsearch
    restart: unless-stopped

volumes:
  elastic_data: