Mercurial > hg > config
comparison bin/docker_elasticsearch.sh @ 783:d564f7ad8294
this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Wed, 24 Aug 2016 14:39:51 -0700 |
| parents | f643cb5e020a |
| children |
comparison
equal
deleted
inserted
replaced
| 782:f643cb5e020a | 783:d564f7ad8294 |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # run an ephemeral elasticsearch | |
| 4 | |
| 5 # variables | |
| 6 export IMAGE="elasticsearch" | |
| 7 export PORT=9200 | |
| 8 | |
| 9 # Run docker with a CID file so we can attach to it | |
| 3 export CIDFILE=$(mktemp -u) | 10 export CIDFILE=$(mktemp -u) |
| 4 docker run -P --cidfile ${CIDFILE} elasticsearch & | 11 docker run -P --cidfile "${CIDFILE}" "${IMAGE}" & |
| 5 sleep 10 | 12 sleep 10 |
| 6 | 13 |
| 14 # ensure we can shutdown properly | |
| 7 script_shutdown() { | 15 script_shutdown() { |
| 8 echo "**** Shutting down... ****" | 16 echo "**** Shutting down... ****" |
| 9 # http://unix.stackexchange.com/questions/55558/how-can-i-kill-and-wait-for-background-processes-to-finish-in-a-shell-script-whe | 17 # http://unix.stackexchange.com/questions/55558/how-can-i-kill-and-wait-for-background-processes-to-finish-in-a-shell-script-whe |
| 10 docker kill `cat ${CIDFILE}` | 18 docker kill `cat ${CIDFILE}` |
| 11 } | 19 } |
| 12 | |
| 13 trap 'script_shutdown' INT | 20 trap 'script_shutdown' INT |
| 14 | 21 |
| 15 # TODO | 22 # open the elasticsearch URL |
| 16 # export DOCKER_IP=$(docker-machine ip default) | 23 export ELASTICSEARCH_URL="http://$(docker port `cat "${CIDFILE}"` ${PORT})/" |
| 17 # export CONTAINER_PORT=$(docker port `cat ${CIDFILE}` | grep 9200 | sed 's/.*://') | 24 echo ${ELASTICSEARCH_URL} |
| 18 # export ELASTICSEARCH_URL="http://${DOCKER_IP}:${CONTAINER_PORT}/" | 25 open "${ELASTICSEARCH_URL}" |
| 19 # open ${ELASTICSEARCH_URL} | 26 |
| 20 wait | 27 wait |
| 21 | 28 |
