Add Apache packages to ironic-api container

This is required to be able to run ironic-api under wsgi,
instead of standalone.

Change-Id: I5944b969c4b64ae73c285bc9f8260cdef9cfceaa
Related-Blueprint: apache-packages-for-apis
This commit is contained in:
Dmitry Tantsur 2017-06-14 11:36:02 +02:00
parent a3ab3f2557
commit 41c102a525
2 changed files with 47 additions and 2 deletions

View File

@ -7,13 +7,45 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set ironic_api_packages = ['openstack-ironic-api'] %} {% set ironic_api_packages = [
'httpd',
'mod_ssl',
'mod_wsgi',
'openstack-ironic-api'
] %}
{% elif base_distro in ['debian', 'ubuntu'] %} {% elif base_distro in ['debian', 'ubuntu'] %}
{% set ironic_api_packages = ['ironic-api'] %} {% set ironic_api_packages = [
'apache2',
'ironic-api',
'libapache2-mod-wsgi'
] %}
{% endif %} {% endif %}
{% elif install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set ironic_api_packages = [
'httpd',
'mod_ssl',
'mod_wsgi'
] %}
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set ironic_api_packages = [
'apache2',
'libapache2-mod-wsgi'
] %}
{% endif %}
{% endif %}
{{ macros.install_packages(ironic_api_packages | customizable("packages")) }} {{ macros.install_packages(ironic_api_packages | customizable("packages")) }}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
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'] %}
RUN echo > /etc/apache2/ports.conf
{% endif %} {% endif %}
COPY extend_start.sh /usr/local/bin/kolla_ironic_extend_start COPY extend_start.sh /usr/local/bin/kolla_ironic_extend_start

View File

@ -6,3 +6,16 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
ironic-dbsync upgrade ironic-dbsync upgrade
exit 0 exit 0
fi fi
# Assume the service runs on top of Apache when user is root
if [[ "$(whoami)" == '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