annotate bin/docker_elasticsearch.sh @ 782:f643cb5e020a

docker-machine is so last month
author Jeff Hammel <k0scist@gmail.com>
date Wed, 24 Aug 2016 14:02:22 -0700
parents 13dd0ce4fa9f
children d564f7ad8294
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 export CIDFILE=$(mktemp -u)
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 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
5 sleep 10
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 script_shutdown() {
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 echo "**** Shutting down... ****"
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 # 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
10 docker kill `cat ${CIDFILE}`
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 }
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 trap 'script_shutdown' INT
782
f643cb5e020a docker-machine is so last month
Jeff Hammel <k0scist@gmail.com>
parents: 775
diff changeset
14
f643cb5e020a docker-machine is so last month
Jeff Hammel <k0scist@gmail.com>
parents: 775
diff changeset
15 # TODO
f643cb5e020a docker-machine is so last month
Jeff Hammel <k0scist@gmail.com>
parents: 775
diff changeset
16 # export DOCKER_IP=$(docker-machine ip default)
f643cb5e020a docker-machine is so last month
Jeff Hammel <k0scist@gmail.com>
parents: 775
diff changeset
17 # export CONTAINER_PORT=$(docker port `cat ${CIDFILE}` | grep 9200 | sed 's/.*://')
f643cb5e020a docker-machine is so last month
Jeff Hammel <k0scist@gmail.com>
parents: 775
diff changeset
18 # export ELASTICSEARCH_URL="http://${DOCKER_IP}:${CONTAINER_PORT}/"
f643cb5e020a docker-machine is so last month
Jeff Hammel <k0scist@gmail.com>
parents: 775
diff changeset
19 # open ${ELASTICSEARCH_URL}
775
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20 wait
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
21