Merge "Update Monasca base and API images"
This commit is contained in:
commit
858c5f0377
@ -80,6 +80,7 @@ ENV PATH {{ virtualenv_path }}/bin:$PATH
|
||||
{% set kolla_toolbox_pip_packages = [
|
||||
'ansible==2.2.0.0',
|
||||
'"cmd2<0.9.0"',
|
||||
'influxdb',
|
||||
'MySQL-python',
|
||||
'os-client-config==1.29.0',
|
||||
'pbr==4.0.0',
|
||||
|
@ -12,9 +12,21 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
||||
|
||||
{% elif install_type == 'source' %}
|
||||
|
||||
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
|
||||
{% set monasca_api_packages = [
|
||||
'mariadb',
|
||||
] %}
|
||||
{% elif base_distro in ['debian', 'ubuntu'] %}
|
||||
{% set monasca_api_packages = [
|
||||
'mariadb-client',
|
||||
] %}
|
||||
{% endif %}
|
||||
{{ macros.install_packages(monasca_api_packages | customizable("packages")) }}
|
||||
|
||||
ADD monasca-api-archive /monasca-api-source
|
||||
|
||||
{% set monasca_api_pip_packages = [
|
||||
'influxdb',
|
||||
'/monasca-api'
|
||||
] %}
|
||||
|
||||
@ -23,9 +35,9 @@ RUN ln -s monasca-api-source/* monasca-api \
|
||||
|
||||
{% endif %}
|
||||
|
||||
COPY extend_start.sh /usr/local/bin/kolla_monasca_extend_start
|
||||
RUN chmod 755 /usr/local/bin/kolla_monasca_extend_start
|
||||
|
||||
{% block monasca_api_footer %}{% endblock %}
|
||||
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
USER monasca
|
||||
|
||||
|
42
docker/monasca/monasca-api/extend_start.sh
Normal file
42
docker/monasca/monasca-api/extend_start.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/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
|
||||
# Set the database name in the monasca database schema
|
||||
sed "s/USE \`mon\`;/USE \`${MONASCA_DATABASE_NAME}\`;/g" \
|
||||
/monasca-api/devstack/files/schema/mon_mysql.sql > /tmp/mon_mysql.sql
|
||||
# Load the schema
|
||||
mysql --host=${MONASCA_DATABASE_ADDRESS} \
|
||||
--port=${MONASCA_DATABASE_PORT} \
|
||||
--user=${MONASCA_DATABASE_USER} \
|
||||
--password=${MONASCA_DATABASE_PASSWORD} \
|
||||
< /tmp/mon_mysql.sql
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# NOTE(pbourke): httpd will not clean up after itself in some cases which
|
||||
# results in the container not being able to restart. (bug #1489676, 1557036)
|
||||
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
|
||||
# Loading Apache2 ENV variables
|
||||
. /etc/apache2/envvars
|
||||
rm -rf /var/run/apache2/*
|
||||
else
|
||||
rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd*
|
||||
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
|
@ -14,8 +14,37 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
||||
|
||||
{% elif install_type == 'source' %}
|
||||
|
||||
RUN mkdir -p /etc/monasca \
|
||||
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
|
||||
{% set monasca_base_packages = [
|
||||
'httpd',
|
||||
'mod_ssl',
|
||||
'mod_wsgi'
|
||||
] %}
|
||||
|
||||
{{ macros.install_packages(monasca_base_packages | customizable("packages")) }}
|
||||
RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
|
||||
&& sed -i -r 's,^(Listen 443),#\1,' /etc/httpd/conf.d/ssl.conf
|
||||
{% elif base_distro in ['debian', 'ubuntu'] %}
|
||||
|
||||
{% set monasca_base_packages = [
|
||||
'apache2',
|
||||
'libapache2-mod-wsgi',
|
||||
] %}
|
||||
|
||||
{{ macros.install_packages(monasca_base_packages | customizable("packages")) }}
|
||||
RUN truncate -s 0 /etc/apache2/ports.conf
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% block monasca_source_install %}
|
||||
|
||||
{% set monasca_base_pip_packages = [
|
||||
] %}
|
||||
|
||||
RUN {{ macros.install_pip(monasca_base_pip_packages | customizable("pip_packages")) }} \
|
||||
&& mkdir -p /etc/monasca \
|
||||
&& chown -R monasca: /etc/monasca
|
||||
{% endblock %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
@ -1,10 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ ! -d "/var/log/kolla/monasca" ]]; then
|
||||
mkdir -p /var/log/kolla/monasca
|
||||
# Create log directory, with appropriate permissions
|
||||
MONASCA_LOG_DIR="/var/log/kolla/monasca"
|
||||
if [[ ! -d "$MONASCA_LOG_DIR" ]]; then
|
||||
mkdir -p $MONASCA_LOG_DIR
|
||||
fi
|
||||
if [[ $(stat -c %a /var/log/kolla/monasca) != "755" ]]; then
|
||||
chmod 755 /var/log/kolla/monasca
|
||||
if [[ $(stat -c %U:%G ${MONASCA_LOG_DIR}) != "monasca:kolla" ]]; then
|
||||
chown monasca:kolla ${MONASCA_LOG_DIR}
|
||||
fi
|
||||
if [[ $(stat -c %a ${MONASCA_LOG_DIR}) != "755" ]]; then
|
||||
chmod 755 ${MONASCA_LOG_DIR}
|
||||
fi
|
||||
|
||||
. /usr/local/bin/kolla_monasca_extend_start
|
||||
|
@ -18,9 +18,11 @@ RUN ln -s monasca-log-api-source/* monasca-log \
|
||||
|
||||
{% endif %}
|
||||
|
||||
COPY extend_start.sh /usr/local/bin/kolla_monasca_extend_start
|
||||
RUN chmod 755 /usr/local/bin/kolla_monasca_extend_start
|
||||
|
||||
{% block monasca_log_api_footer %}{% endblock %}
|
||||
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
USER monasca
|
||||
|
||||
|
27
docker/monasca/monasca-log-api/extend_start.sh
Normal file
27
docker/monasca/monasca-log-api/extend_start.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERVICE="monasca-log-api"
|
||||
|
||||
# NOTE(pbourke): httpd will not clean up after itself in some cases which
|
||||
# results in the container not being able to restart. (bug #1489676, 1557036)
|
||||
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
|
||||
# Loading Apache2 ENV variables
|
||||
. /etc/apache2/envvars
|
||||
rm -rf /var/run/apache2/*
|
||||
else
|
||||
rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd*
|
||||
fi
|
||||
|
||||
# When Apache first starts it writes out the custom log files with root
|
||||
# ownership. This later prevents the Monasca Log 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_LOG_API_LOG_DIR="/var/log/kolla/monasca"
|
||||
for LOG_TYPE in error access; do
|
||||
if [ ! -f "${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log" ]; then
|
||||
touch ${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
|
||||
fi
|
||||
if [[ $(stat -c %U:%G ${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log) != "monasca:kolla" ]]; then
|
||||
chown monasca:kolla ${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log
|
||||
fi
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user