aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin André <m.andre@redhat.com>2017-05-02 15:14:36 +0200
committerMartin André <m.andre@redhat.com>2017-05-02 15:15:50 +0200
commita2c0087b3842c00e27440e69abc3c57125a50cc0 (patch)
tree377654918c25ecdc30de8baacfd454c44e15a807
parent4433a95698da147f3eae8f12b526c2fc204b7a42 (diff)
downloadkolla-a2c0087b3842c00e27440e69abc3c57125a50cc0.tar.gz
kolla-a2c0087b3842c00e27440e69abc3c57125a50cc0.zip
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
-rwxr-xr-xdocker/zaqar/Dockerfile.j249
-rwxr-xr-xdocker/zaqar/extend_start.sh13
2 files changed, 54 insertions, 8 deletions
diff --git a/docker/zaqar/Dockerfile.j2 b/docker/zaqar/Dockerfile.j2
index b17ffdd08..eeac2eef1 100755
--- a/docker/zaqar/Dockerfile.j2
+++ b/docker/zaqar/Dockerfile.j2
@@ -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 = [
diff --git a/docker/zaqar/extend_start.sh b/docker/zaqar/extend_start.sh
index b7ce7bb04..e0fb2142e 100755
--- a/docker/zaqar/extend_start.sh
+++ b/docker/zaqar/extend_start.sh
@@ -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