changeset 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 47a434dd5068
files bin/docker_elasticsearch.sh
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/bin/docker_elasticsearch.sh	Wed Aug 24 14:02:22 2016 -0700
+++ b/bin/docker_elasticsearch.sh	Wed Aug 24 14:39:51 2016 -0700
@@ -1,21 +1,28 @@
 #!/bin/bash
 
+# run an ephemeral elasticsearch
+
+# variables
+export IMAGE="elasticsearch"
+export PORT=9200
+
+# Run docker with a CID file so we can attach to it
 export CIDFILE=$(mktemp -u)
-docker run -P --cidfile ${CIDFILE} elasticsearch &
+docker run -P --cidfile "${CIDFILE}" "${IMAGE}" &
 sleep 10
 
+# ensure we can shutdown properly
 script_shutdown() {
     echo "**** Shutting down... ****"
    # http://unix.stackexchange.com/questions/55558/how-can-i-kill-and-wait-for-background-processes-to-finish-in-a-shell-script-whe
     docker kill `cat ${CIDFILE}`
 }
-
 trap 'script_shutdown' INT
 
-# TODO
-# export DOCKER_IP=$(docker-machine ip default)
-# export CONTAINER_PORT=$(docker port `cat ${CIDFILE}` | grep 9200 | sed 's/.*://')
-# export ELASTICSEARCH_URL="http://${DOCKER_IP}:${CONTAINER_PORT}/"
-# open ${ELASTICSEARCH_URL}
+# open the elasticsearch URL
+export ELASTICSEARCH_URL="http://$(docker port `cat "${CIDFILE}"` ${PORT})/"
+echo ${ELASTICSEARCH_URL}
+open "${ELASTICSEARCH_URL}"
+
 wait