Mercurial > hg > config
annotate 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 |
rev | line source |
---|---|
775
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
1 #!/bin/bash |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
2 |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
3 |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
4 export MACHINE=default |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
5 eval "$(docker-machine env default)" |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
6 export CIDFILE=$(mktemp -u) |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
7 docker run -P --cidfile ${CIDFILE} elasticsearch & |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
8 sleep 10 |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
9 |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
10 script_shutdown() { |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
11 echo "**** Shutting down... ****" |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
12 # http://unix.stackexchange.com/questions/55558/how-can-i-kill-and-wait-for-background-processes-to-finish-in-a-shell-script-whe |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
13 docker kill `cat ${CIDFILE}` |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
14 } |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
15 |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
16 trap 'script_shutdown' INT |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
17 export DOCKER_IP=$(docker-machine ip default) |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
18 export CONTAINER_PORT=$(docker port `cat ${CIDFILE}` | grep 9200 | sed 's/.*://') |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
19 export ELASTICSEARCH_URL="http://${DOCKER_IP}:${CONTAINER_PORT}/" |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
20 open ${ELASTICSEARCH_URL} |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
21 wait |
13dd0ce4fa9f
add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
22 |