Kolla provides production-ready containers and deployment tools for operating OpenStack clouds
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

extend_start.sh 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. SERVICE="monasca-api"
  3. # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
  4. # of the KOLLA_BOOTSTRAP variable being set, including empty.
  5. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
  6. # Set the database name in the monasca database schema
  7. sed "s/USE \`mon\`;/USE \`${MONASCA_DATABASE_NAME}\`;/g" \
  8. /monasca-api/devstack/files/schema/mon_mysql.sql > /tmp/mon_mysql.sql
  9. # Load the schema
  10. mysql --host=${MONASCA_DATABASE_ADDRESS} \
  11. --port=${MONASCA_DATABASE_PORT} \
  12. --user=${MONASCA_DATABASE_USER} \
  13. --password=${MONASCA_DATABASE_PASSWORD} \
  14. < /tmp/mon_mysql.sql
  15. exit 0
  16. fi
  17. # NOTE(pbourke): httpd will not clean up after itself in some cases which
  18. # results in the container not being able to restart. (bug #1489676, 1557036)
  19. if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
  20. # Loading Apache2 ENV variables
  21. . /etc/apache2/envvars
  22. rm -rf /var/run/apache2/*
  23. else
  24. rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd*
  25. fi
  26. # When Apache first starts it writes out the custom log files with root
  27. # ownership. This later prevents the Monasca API (which runs under the
  28. # 'monasca' user) from updating them. To avoid this we create the log
  29. # files with the required permissions here, before Apache does.
  30. MONASCA_API_LOG_DIR="/var/log/kolla/monasca"
  31. for LOG_TYPE in error access; do
  32. if [ ! -f "${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log" ]; then
  33. touch ${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
  34. fi
  35. if [[ $(stat -c %U:%G ${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log) != "monasca:kolla" ]]; then
  36. chown monasca:kolla ${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
  37. fi
  38. done