aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Gonzalez <dabarren@gmail.com>2017-04-12 16:17:43 +0100
committerEduardo Gonzalez <dabarren@gmail.com>2017-04-20 09:03:04 +0100
commita159c686d7fbbf71a21a28a09608d000b99471e0 (patch)
treedcb6f35635632f02648c3827473eb32a98f2780d
parentbf84c20e8f7b9eed03275ece9d492492e2c00c62 (diff)
downloadkolla-a159c686d7fbbf71a21a28a09608d000b99471e0.tar.gz
kolla-a159c686d7fbbf71a21a28a09608d000b99471e0.zip
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
-rw-r--r--docker/zun/zun-api/Dockerfile.j22
-rw-r--r--docker/zun/zun-api/extend_start.sh10
-rw-r--r--docker/zun/zun-base/Dockerfile.j242
-rw-r--r--docker/zun/zun-compute/Dockerfile.j22
-rwxr-xr-xkolla/common/config.py4
5 files changed, 50 insertions, 10 deletions
diff --git a/docker/zun/zun-api/Dockerfile.j2 b/docker/zun/zun-api/Dockerfile.j2
index a23e8d67d..c28df1c40 100644
--- a/docker/zun/zun-api/Dockerfile.j2
+++ b/docker/zun/zun-api/Dockerfile.j2
@@ -15,5 +15,3 @@ RUN chmod 755 /usr/local/bin/kolla_zun_extend_start
{% block zun_api_footer %}{% endblock %}
{% block footer %}{% endblock %}
-
-USER zun
diff --git a/docker/zun/zun-api/extend_start.sh b/docker/zun/zun-api/extend_start.sh
index eaed680e2..92f669064 100644
--- a/docker/zun/zun-api/extend_start.sh
+++ b/docker/zun/zun-api/extend_start.sh
@@ -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
diff --git a/docker/zun/zun-base/Dockerfile.j2 b/docker/zun/zun-base/Dockerfile.j2
index fe0e97a08..cecea50ee 100644
--- a/docker/zun/zun-base/Dockerfile.j2
+++ b/docker/zun/zun-base/Dockerfile.j2
@@ -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 %}
diff --git a/docker/zun/zun-compute/Dockerfile.j2 b/docker/zun/zun-compute/Dockerfile.j2
index 7d6fc41fd..f7badbf1c 100644
--- a/docker/zun/zun-compute/Dockerfile.j2
+++ b/docker/zun/zun-compute/Dockerfile.j2
@@ -12,5 +12,3 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
{% block zun_compute_footer %}{% endblock %}
{% block footer %}{% endblock %}
-
-USER zun
diff --git a/kolla/common/config.py b/kolla/common/config.py
index 6001c0c64..d2c2e5df0 100755
--- a/kolla/common/config.py
+++ b/kolla/common/config.py
@@ -812,6 +812,10 @@ USERS = {
'opendaylight-user': {
'uid': 42462,
'gid': 42462,
+ },
+ 'zun-user': {
+ 'uid': 42463,
+ 'gid': 42463,
}
}