Skip to content

Instantly share code, notes, and snippets.

@wreulicke
Created July 29, 2017 20:44
Show Gist options
  • Save wreulicke/edab95dbb1acb7be554c6100a24dc865 to your computer and use it in GitHub Desktop.
Save wreulicke/edab95dbb1acb7be554c6100a24dc865 to your computer and use it in GitHub Desktop.
Elasticsearch初期化する何か
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.3.3
ports:
- "9200:9200"
- "9300:9300"
container_name: elasticsearch
hostname: elasticsearch
environment:
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "http.host=0.0.0.0"
- "transport.host=127.0.0.1"
- "xpack.security.enabled=false"
setup:
image: docker.elastic.co/elasticsearch/elasticsearch:5.3.3
volumes:
- ../elasticsearch/:/usr/share/elasticsearch/es-config
- ./wait-and-setup.sh:/usr/share/elasticsearch/wait-and-setup.sh
command: ["./wait-and-setup.sh"]
links:
- "elasticsearch"
#!/bin/bash
# wait-for-postgres.sh
sleep 10
until curl http://elasticsearch:9200/_template ; do
echo elasticsearch is unavailable
sleep 5
done
for i in $(find es-config -type f -name "*.json"); do
FILE_NAME=${i##*/}
TEMPLATE_NAME=${FILE_NAME%.*}
curl http://elasticsearch:9200/_template/$TEMPLATE_NAME -XPUT -d @$i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment