summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorIsaac Prior <isaac@stackhpc.com>2019-08-06 12:09:13 +0100
committerMark Goddard <mark@stackhpc.com>2019-08-15 08:04:54 +0000
commit55344adfc67ff2c52a7bdfc5970cec636e1e4518 (patch)
tree08874851d4861124bd7dc0fb3d033a6bf28f1f05 /docker
parentcd4d4b37be3ad75d23a48fd58a550ff08684e270 (diff)
downloadkolla-55344adfc67ff2c52a7bdfc5970cec636e1e4518.tar.gz
kolla-55344adfc67ff2c52a7bdfc5970cec636e1e4518.zip
Ensures monasca-thresh data and worker dirs exist and are empty on start up
This prevents the filesystem from filling up with Apache Storm temporary files which will otherwise not be cleared. Change-Id: Ib07e32f4e67e500f10986103d781dfd3874ffdd2 Partial-Bug: #1839149 (cherry picked from commit 16d4cd91d24d48e4cdf90d5c06991b52e00803ba)
Diffstat (limited to 'docker')
-rw-r--r--docker/monasca/monasca-thresh/extend_start.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/docker/monasca/monasca-thresh/extend_start.sh b/docker/monasca/monasca-thresh/extend_start.sh
index 77e835d44..6c4dda35d 100644
--- a/docker/monasca/monasca-thresh/extend_start.sh
+++ b/docker/monasca/monasca-thresh/extend_start.sh
@@ -1,15 +1,44 @@
#!/bin/bash
-# Create log directory, with appropriate permissions
+# Create log and data directories, with appropriate permissions
MONASCA_LOG_DIR="/var/log/kolla/monasca"
+MONASCA_DATA_DIR="/var/lib/monasca-thresh/data"
+MONASCA_WORKER_DIR="/var/lib/monasca-thresh/worker-artifacts"
if [[ ! -d "$MONASCA_LOG_DIR" ]]; then
mkdir -p $MONASCA_LOG_DIR
fi
+if [[ ! -d "$MONASCA_DATA_DIR" ]]; then
+ mkdir -p $MONASCA_DATA_DIR
+fi
+if [[ ! -d "$MONASCA_WORKER_DIR" ]]; then
+ mkdir -p $MONASCA_WORKER_DIR
+fi
if [[ $(stat -c %U:%G ${MONASCA_LOG_DIR}) != "monasca:kolla" ]]; then
chown monasca:kolla ${MONASCA_LOG_DIR}
fi
+if [[ $(stat -c %U:%G ${MONASCA_DATA_DIR}) != "monasca:kolla" ]]; then
+ chown monasca:kolla ${MONASCA_DATA_DIR}
+fi
+if [[ $(stat -c %U:%G ${MONASCA_WORKER_DIR}) != "monasca:kolla" ]]; then
+ chown monasca:kolla ${MONASCA_WORKER_DIR}
+fi
if [[ $(stat -c %a ${MONASCA_LOG_DIR}) != "755" ]]; then
chmod 755 ${MONASCA_LOG_DIR}
fi
+if [[ $(stat -c %a ${MONASCA_DATA_DIR}) != "755" ]]; then
+ chmod 755 ${MONASCA_DATA_DIR}
+fi
+if [[ $(stat -c %a ${MONASCA_WORKER_DIR}) != "755" ]]; then
+ chmod 755 ${MONASCA_WORKER_DIR}
+fi
+
+# Delete the contents of data and worker-artifacts directories as
+# Apache Storm doesn't clear temp files unless shutdown gracefully.
+if [[ $(ls -Ab ${MONASCA_DATA_DIR}) != "" ]]; then
+ find ${MONASCA_DATA_DIR} -mindepth 1 -delete
+fi
+if [[ $(ls -Ab ${MONASCA_WORKER_DIR}) != "" ]]; then
+ find ${MONASCA_WORKER_DIR} -mindepth 1 -delete
+fi
. /usr/local/bin/kolla_monasca_extend_start