Add Apache packages to zaqar container

Some projects that use Kolla docker containers (TripleO) run zaqar
under httpd. This patch adds the httpd package so that it exists in the
container and can optionally by used via Docker entrypoints.

As many of these projects do not require the use of Apache (it is
opt-in) at this point not all deployment frameworks support the use of
it so the existing configuration defaults have been left as-is for now.

Change-Id: I35cfd1c2320eb972890b44668c8f9f0a047a65dc
Partially-Implements: blueprint apache-packages-for-apis
This commit is contained in:
Martin André 2017-05-02 15:14:36 +02:00
parent 4433a95698
commit a2c0087b38
2 changed files with 54 additions and 8 deletions

View File

@ -9,17 +9,50 @@ LABEL maintainer="{{ maintainer }}"
{% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set zaqar_packages = ['openstack-zaqar'] %}
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set zaqar_packages = [
'zaqar-common',
'zaqar-server'
] %}
{% endif %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set zaqar_packages = [
'httpd',
'mod_ssl',
'mod_wsgi',
'openstack-zaqar'
] %}
{{ macros.install_packages(zaqar_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 zaqar_packages = [
'apache2',
'libapache2-mod-wsgi'
'zaqar-common',
'zaqar-server'
] %}
{{ macros.install_packages(zaqar_packages | customizable("packages")) }}
RUN echo > /etc/apache2/ports.conf
{% endif %}
{% elif install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set zaqar_packages = [
'httpd',
'mod_ssl',
'mod_wsgi'
] %}
{{ macros.install_packages(zaqar_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 zaqar_packages = [
'apache2',
'libapache2-mod-wsgi'
] %}
{{ macros.install_packages(zaqar_packages | customizable("packages")) }}
RUN echo > /etc/apache2/ports.conf
{% endif %}
ADD zaqar-archive /zaqar-source
{% set zaqar_pip_packages = [

View File

@ -6,3 +6,16 @@ fi
if [[ $(stat -c %a /var/log/kolla/zaqar) != "755" ]]; then
chmod 755 /var/log/kolla/zaqar
fi
# Assume the service runs on top of Apache when user is root
if [[ $USER == 'root' ]]; then
# 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
fi