#!/bin/bash set -e NAME="sfive-kibana" IMG="docker.elastic.co/kibana/kibana" PERSIST_D="/srv/build/sfive/kibana" create() { mkdir -p "$PERSIST_D/config" sudo docker run --detach --rm -p 127.0.0.1:5601:5601 --name "$NAME" --link sfive-es:es -e ELASTICSEARCH_URL="http://es:9200" -v "$PERSIST_D/config:/usr/share/kibana/config" "$IMG:$1" } stop() { sudo docker stop "$NAME" } logs() { sudo docker logs "$NAME" $@ } case "$1" in create) if [ -z "$2" ]; then echo "Please specify a version" exit 1 fi create "$2" ;; stop) stop ;; upgrade) if [ -z "$2" ]; then echo "Please specify a version" exit 1 fi tag="$2" sudo docker pull "$IMG:$tag" stop create "$tag" ;; logs) shift logs $@ ;; *) echo "Usage $0 (create|stop|upgrade|logs)" exit 1 ;; esac exit 0