version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.2
    container_name: elasticsearch
    environment:
      - cluster.name=sv2-cluster
      - bootstrap.memory_lock=true
      - ES_JAVA_OPTS=-Xms6g -Xmx6g
      - "xpack.security.enabled=false"
      - "xpack.monitoring.enabled=true"
      - "xpack.graph.enabled=true"
      - "xpack.watcher.enabled=false"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 12g
    cap_add:
      - IPC_LOCK
    volumes:
      - /mnt/data/elasticsearch:/usr/share/elasticsearch/data:rw
      - /var/log/elasticsearch:/usr/share/elasticsearch/logs:rw
      - ./log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties
    ports:
      - 9200:9200
    network_mode: host
  kibana:
    image: docker.elastic.co/kibana/kibana:5.4.2
    environment:
      SERVER_NAME: localhost
      ELASTICSEARCH_URL: http://localhost:9200
      XPACK_SECURITY_ENABLED: "false"
      LOGGING_DEST: /var/log/kibana/kibana.log
      LOGGING_VERBOSE: "false"
    volumes:
      - /var/log/kibana/:/var/log/kibana:rw
    container_name: kibana
    ports:
      - "5601:5601"
    network_mode: host
