Fix zun images

Zun uses wsgi to start process.
Rework zun-base image to make use of wsgi.
Create zun user with macros to maintain static uids.
Zun compute need root to connect docker

Change-Id: Idd417e1b804148543ee5f403a836fa1f3e6f7fb0
Closes-Bug: #1682142
This commit is contained in:
Eduardo Gonzalez 2017-04-12 16:17:43 +01:00
parent bf84c20e8f
commit a159c686d7
5 changed files with 50 additions and 10 deletions

View File

@ -15,5 +15,3 @@ RUN chmod 755 /usr/local/bin/kolla_zun_extend_start
{% block zun_api_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER zun

View File

@ -1,5 +1,15 @@
#!/bin/bash
# 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
# 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

View File

@ -5,6 +5,8 @@ MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='zun') }}
{% if install_type == 'binary' %}
RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
@ -12,6 +14,33 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
{% elif install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set zun_base_packages = [
'httpd',
'mod_wsgi',
'mod_ssl',
'python-ldappool'
] %}
{{ macros.install_packages(zun_base_packages | customizable("packages")) }}
RUN mkdir -p /var/www/cgi-bin/zun \
&& 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 zun_base_packages = [
'apache2',
'libapache2-mod-wsgi',
'python-ldappool'
] %}
{{ macros.install_packages(zun_base_packages | customizable("packages")) }}
RUN mkdir -p /var/www/cgi-bin/zun \
&& echo > /etc/apache2/ports.conf
{% endif %}
ADD zun-base-archive /zun-base-source
{% set zun_base_pip_packages = [
@ -19,18 +48,19 @@ ADD zun-base-archive /zun-base-source
] %}
RUN ln -s zun-base-source/* zun \
&& useradd --user-group --create-home --home-dir /var/lib/zun zun \
&& {{ macros.install_pip(zun_base_pip_packages | customizable("pip_packages")) }} \
&& mkdir -p /etc/zun \
&& cp -r /zun/etc/* /etc/zun/ \
&& chown -R zun: /etc/zun
&& mkdir -p /etc/zun /var/www/cgi-bin/zun \
&& cp -r /zun/etc/zun/* /etc/zun/ \
&& cp /zun/zun/api/app.wsgi /var/www/cgi-bin/zun \
&& cp -r /zun/etc/nova /etc/zun/ \
&& chown -R zun: /etc/zun /var/www/cgi-bin/zun
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN usermod -a -G kolla zun \
&& touch /usr/local/bin/kolla_zun_extend_start \
RUN touch /usr/local/bin/kolla_zun_extend_start \
&& chmod 755 /var/www/cgi-bin/zun \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_zun_extend_start
{% block zun_base_footer %}{% endblock %}

View File

@ -12,5 +12,3 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
{% block zun_compute_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER zun

View File

@ -812,6 +812,10 @@ USERS = {
'opendaylight-user': {
'uid': 42462,
'gid': 42462,
},
'zun-user': {
'uid': 42463,
'gid': 42463,
}
}