changeset 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 baf7ea9b9b2c
children 67fa26b40dc6
files bin/docker_elasticsearch.sh
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/docker_elasticsearch.sh	Tue Jun 14 17:28:17 2016 -0700
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+
+export MACHINE=default
+eval "$(docker-machine env default)"
+export CIDFILE=$(mktemp -u)
+docker run -P --cidfile ${CIDFILE} elasticsearch &
+sleep 10
+
+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
+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}
+wait
+