kolla/docker/monasca/monasca-api/extend_start.sh
Mark Goddard 6ef631d229 Refactor Apache httpd setup
All Apache httpd setup has been moved to a new helper script,
kolla_httpd_setup. This includes the existing clean of /run/httpd,
/var/run/httpd, /tmp/httpd etc.

Horizon has an additional bit of Apache config for Debian/binary, which
has been kept in extend_start.sh for horizon.

Change-Id: Ia2af74b69c151db0bd7e452460b0babcee50b282
Related: blueprint centos-rhel-8
(cherry picked from commit 8484190e77)
2020-01-14 13:16:38 +00:00

27 lines
987 B
Bash

#!/bin/bash
SERVICE="monasca-api"
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
monasca_db upgrade
exit 0
fi
# When Apache first starts it writes out the custom log files with root
# ownership. This later prevents the Monasca API (which runs under the
# 'monasca' user) from updating them. To avoid this we create the log
# files with the required permissions here, before Apache does.
MONASCA_API_LOG_DIR="/var/log/kolla/monasca"
for LOG_TYPE in error access; do
if [ ! -f "${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log" ]; then
touch ${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
fi
if [[ $(stat -c %U:%G ${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log) != "monasca:kolla" ]]; then
chown monasca:kolla ${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
fi
done
. /usr/local/bin/kolla_httpd_setup