Merge "Add support to deploy manila-api with Apache/wsgi"

This commit is contained in:
Zuul 2018-09-06 22:15:28 +00:00 committed by Gerrit Code Review
commit f1646ade63
3 changed files with 70 additions and 6 deletions

View File

@ -6,19 +6,62 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% import "macros.j2" as macros with context %}
{% if install_type == 'binary' %}
{% if base_distro in ['debian', 'ubuntu'] %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set manila_api_packages = [
'httpd',
'mod_ssl',
'mod_wsgi'
] %}
{{ macros.install_packages(manila_api_packages | customizable("packages")) }}
RUN mkdir -p /var/www/cgi-bin/manila \
&& cp -a /usr/bin/manila-wsgi /var/www/cgi-bin/manila/manila-wsgi \
&& 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 manila_api_packages = [
'apache2',
'libapache2-mod-wsgi',
'manila-api'
] %}
{{ macros.install_packages(manila_api_packages | customizable("packages")) }}
RUN mkdir -p /var/www/cgi-bin/manila \
&& cp -a /usr/bin/manila-wsgi /var/www/cgi-bin/manila/manila-wsgi \
&& echo > /etc/apache2/ports.conf
{% endif %}
{% endif%}
{% endif%}
{% elif install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set manila_api_packages = [
'httpd',
'mod_ssl',
'mod_wsgi'
] %}
{{ macros.install_packages(manila_api_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 manila_api_packages = [
'apache2',
'libapache2-mod-wsgi'
] %}
{{ macros.install_packages(manila_api_packages | customizable("packages")) }}
RUN echo > /etc/apache2/ports.conf
{% endif %}
RUN mkdir -p /var/www/cgi-bin/manila \
&& cp -a /var/lib/kolla/venv/bin/manila-wsgi /var/www/cgi-bin/manila/manila-wsgi
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_manila_extend_start
RUN chmod 755 /usr/local/bin/kolla_manila_extend_start
RUN chmod 755 /usr/local/bin/kolla_manila_extend_start \
&& chown -R manila: /var/www/cgi-bin/manila \
&& chmod 755 /var/www/cgi-bin/manila/manila-wsgi
{% block manila_api_footer %}{% endblock %}
{% block footer %}{% endblock %}

View File

@ -7,3 +7,16 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
manila-manage db sync
exit 0
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

View File

@ -0,0 +1,8 @@
---
features:
- |
The manila-api dockerfile now contains support for httpd and mod_wsgi
packages for all supported platforms. It also contains the mod_ssl
package for RHEL/centos and oraclelinux. Docker entrypoints can now use
the httpd configuration seeded to run the manila-api service with
httpd/mod_wsgi.