summaryrefslogtreecommitdiffstats
path: root/src/main/docker/kibana
diff options
context:
space:
mode:
authorac2550 <ac2550@intl.att.com>2018-10-11 09:27:15 +0200
committerac2550 <ac2550@intl.att.com>2018-10-11 12:04:08 +0200
commit5a23e6aa072db54ad2651b01284536327269279b (patch)
treeec7c10ebfec01dbf193d94567d5f5d176c835643 /src/main/docker/kibana
parenta61b86e64180519482a89ff3fafaed7f70904a17 (diff)
Docker-compose for heat integration lab
Issue-ID: CLAMP-230 Change-Id: If825138e82f814e4c4804001f99da807d87f27c9 Signed-off-by: ac2550 <ac2550@intl.att.com>
Diffstat (limited to 'src/main/docker/kibana')
-rw-r--r--src/main/docker/kibana/Dockerfile.kibana2
-rwxr-xr-xsrc/main/docker/kibana/startup.sh27
2 files changed, 27 insertions, 2 deletions
diff --git a/src/main/docker/kibana/Dockerfile.kibana b/src/main/docker/kibana/Dockerfile.kibana
index 993edd4a..6df02042 100644
--- a/src/main/docker/kibana/Dockerfile.kibana
+++ b/src/main/docker/kibana/Dockerfile.kibana
@@ -47,7 +47,7 @@ RUN yum install -y python-requests && yum clean all
# ├── visualization-cb896270-c190-11e8-a550-27f2e3138fee.json
# └── visualization-d837b120-c190-11e8-a550-27f2e3138fee.json
-RUN mkdir /saved-objects/
+RUN mkdir /saved-objects/ && chown kibana:kibana /saved-objects/
USER kibana
diff --git a/src/main/docker/kibana/startup.sh b/src/main/docker/kibana/startup.sh
index bbd9d45d..a232706e 100755
--- a/src/main/docker/kibana/startup.sh
+++ b/src/main/docker/kibana/startup.sh
@@ -30,9 +30,25 @@ LOG_FILE="/tmp/load.kibana.log"
KIBANA_LOAD_CMD="/usr/local/bin/kibana-docker -H 127.0.0.1 -l $LOG_FILE"
TIMEOUT=60
WAIT_TIME=2
+LOADED_FLAG=$SAVED_OBJECTS_ROOT/.loaded
-if [ -n "$(ls -A ${SAVED_OBJECTS_PATH})" ];
+if [ -f $LOADED_FLAG ];
then
+ echo "---- Kibana saved objects already restored. Remove $LOADED_FLAG if you want to restore them again."
+elif [ -n "$(ls -A ${SAVED_OBJECTS_PATH})" ];
+then
+ echo "---- Waiting for elasticsearch to be up..."
+ RES=-1
+ PING_TIMEOUT=60
+ elastic_url=$(grep elasticsearch.url /usr/share/kibana/config/kibana.yml | cut -d\ -f2)
+ while [ ! "$RES" -eq "0" ] && [ "$PING_TIMEOUT" -gt "0" ];
+ do
+ curl $elastic_url
+ RES=$?
+ sleep $WAIT_TIME
+ let PING_TIMEOUT=$PING_TIMEOUT-$WAIT_TIME
+ done
+
echo "---- Saved objects found, restoring files."
$KIBANA_LOAD_CMD &
@@ -62,10 +78,19 @@ then
# restore files
for saved_objects_path in $SAVED_OBJECTS_ROOT/*
do
+ # skip files as we only need directories
+ [ -f $saved_objects_path ] && continue
+
echo "Restoring content of $saved_objects_path"
$RESTORE_CMD -C $saved_objects_path
sleep 1
done
+
+ touch $LOADED_FLAG
+ if [ "$?" != "0" ];
+ then
+ echo "WARNING: Could not save $LOADED_FLAG, saved objects will be restored on next startup." >&2
+ fi
# cleanup
kill $KIB_PID