comparison bin/docker_elasticsearch.sh @ 775:13dd0ce4fa9f

add elasticsearch test platform for Mac (shouldnt really need on linux)
author Jeff Hammel <k0scist@gmail.com>
date Tue, 14 Jun 2016 17:28:17 -0700
parents
children f643cb5e020a
comparison
equal deleted inserted replaced
774:baf7ea9b9b2c 775:13dd0ce4fa9f
1 #!/bin/bash
2
3
4 export MACHINE=default
5 eval "$(docker-machine env default)"
6 export CIDFILE=$(mktemp -u)
7 docker run -P --cidfile ${CIDFILE} elasticsearch &
8 sleep 10
9
10 script_shutdown() {
11 echo "**** Shutting down... ****"
12 # http://unix.stackexchange.com/questions/55558/how-can-i-kill-and-wait-for-background-processes-to-finish-in-a-shell-script-whe
13 docker kill `cat ${CIDFILE}`
14 }
15
16 trap 'script_shutdown' INT
17 export DOCKER_IP=$(docker-machine ip default)
18 export CONTAINER_PORT=$(docker port `cat ${CIDFILE}` | grep 9200 | sed 's/.*://')
19 export ELASTICSEARCH_URL="http://${DOCKER_IP}:${CONTAINER_PORT}/"
20 open ${ELASTICSEARCH_URL}
21 wait
22