#!/bin/bash
yum -y install epel-release
yum -y install python-pip
pip install docker-compose
echo "vm.max_map_count = 262144" > /etc/sysctl.conf
#install elasticsearch
# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
# sudo yum install elasticsearch
# systemctl start elasticsearch.service
# systemctl enalbe elasticsearch.service

#bulid docker compose
cat<< EOF >docker-compose.yml
version: '2.2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
    container_name: elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
    networks:
      - esnet
  kibana:
    image: docker.elastic.co/kibana/kibana:6.6.1
    ports:
      - 5601:5601
    networks:
      - esnet

volumes:
  esdata1:
    driver: local

networks:
  esnet:
EOF
docker-compose up &