summaryrefslogtreecommitdiff
path: root/docker/monasca/monasca-log-api/extend_start.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docker/monasca/monasca-log-api/extend_start.sh')
-rw-r--r--docker/monasca/monasca-log-api/extend_start.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/docker/monasca/monasca-log-api/extend_start.sh b/docker/monasca/monasca-log-api/extend_start.sh
new file mode 100644
index 0000000..bcccdf1
--- /dev/null
+++ b/docker/monasca/monasca-log-api/extend_start.sh
@@ -0,0 +1,27 @@
1#!/bin/bash
2
3SERVICE="monasca-log-api"
4
5# NOTE(pbourke): httpd will not clean up after itself in some cases which
6# results in the container not being able to restart. (bug #1489676, 1557036)
7if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
8 # Loading Apache2 ENV variables
9 . /etc/apache2/envvars
10 rm -rf /var/run/apache2/*
11else
12 rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd*
13fi
14
15# When Apache first starts it writes out the custom log files with root
16# ownership. This later prevents the Monasca Log API (which runs under the
17# 'monasca' user) from updating them. To avoid this we create the log
18# files with the required permissions here, before Apache does.
19MONASCA_LOG_API_LOG_DIR="/var/log/kolla/monasca"
20for LOG_TYPE in error access; do
21 if [ ! -f "${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log" ]; then
22 touch ${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
23 fi
24 if [[ $(stat -c %U:%G ${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log) != "monasca:kolla" ]]; then
25 chown monasca:kolla ${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
26 fi
27done