aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorKien Nguyen <kiennt65@viettel.com.vn>2018-10-16 17:40:51 +0700
committerKien Nguyen <kiennt65@viettel.com.vn>2018-11-12 02:15:38 +0000
commitcf2b2b55b6a6ceb295c574ac5e0bdcdf40687f9c (patch)
treeccd68be4a3ece20042b24dcd81e991ca65770f90 /docker
parentf16e410542db39472a7672b4cb9b09883db94930 (diff)
downloadkolla-cf2b2b55b6a6ceb295c574ac5e0bdcdf40687f9c.tar.gz
kolla-cf2b2b55b6a6ceb295c574ac5e0bdcdf40687f9c.zip
Update Zaqar image
Follow Zaqar installation documentation [1] [1] https://docs.openstack.org/zaqar/latest/install/ Change-Id: Ic356fb81c19ebbc78aa3c7e871c4946d1f712a45 Implements: blueprint ansible-zaqar
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/zaqar/Dockerfile.j277
-rw-r--r--docker/zaqar/zaqar-base/Dockerfile.j290
-rw-r--r--docker/zaqar/zaqar-base/extend_start.sh15
-rw-r--r--docker/zaqar/zaqar-server/Dockerfile.j218
-rw-r--r--docker/zaqar/zaqar-wsgi/Dockerfile.j212
-rwxr-xr-xdocker/zaqar/zaqar-wsgi/extend_start.sh (renamed from docker/zaqar/extend_start.sh)7
6 files changed, 135 insertions, 84 deletions
diff --git a/docker/zaqar/Dockerfile.j2 b/docker/zaqar/Dockerfile.j2
deleted file mode 100755
index fd354bd0a..000000000
--- a/docker/zaqar/Dockerfile.j2
+++ /dev/null
@@ -1,77 +0,0 @@
-FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
-LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
-
-{% block zaqar_header %}{% endblock %}
-
-{% import "macros.j2" as macros with context %}
-
-{{ macros.configure_user(name='zaqar') }}
-
-{% if install_type == 'binary' %}
-
-{% 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 = [
- 'pymongo',
- '/zaqar'
-] %}
-
-RUN ln -s zaqar-source/* zaqar \
- && {{ macros.install_pip(zaqar_pip_packages | customizable("pip_packages")) }} \
- && mkdir -p /etc/zaqar \
- && cp -r /zaqar/etc/* /etc/zaqar/ \
- && chown -R zaqar: /etc/zaqar
-
-{% endif %}
-
-COPY extend_start.sh /usr/local/bin/kolla_extend_start
-RUN chmod 755 /usr/local/bin/kolla_extend_start
-
-{% block zaqar_footer %}{% endblock %}
-{% block footer %}{% endblock %}
-
-USER zaqar
diff --git a/docker/zaqar/zaqar-base/Dockerfile.j2 b/docker/zaqar/zaqar-base/Dockerfile.j2
new file mode 100644
index 000000000..5c78b5b3d
--- /dev/null
+++ b/docker/zaqar/zaqar-base/Dockerfile.j2
@@ -0,0 +1,90 @@
+FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
+LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
+
+{% block zaqar_base_header %}{% endblock %}
+
+{% import "macros.j2" as macros with context %}
+
+{{ macros.configure_user(name='zaqar') }}
+
+{% if install_type == 'binary' %}
+
+ {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
+ {% set zaqar_base_packages = [
+ 'openstack-zaqar',
+ 'httpd',
+ 'mod_ssl',
+ 'mod_wsgi',
+ 'python2-ldappool'
+ ] %}
+
+{{ macros.install_packages(zaqar_base_packages | customizable("packages")) }} \
+ && mkdir -p /var/www/cgi-bin/zaqar \
+ && chown -R zaqar: /var/www/cgi-bin/zaqar \
+ && cp -a /usr/lib/python2.7/site-packages/zaqar/transport/wsgi/app.py /var/www/cgi-bin/zaqar/ \
+ && 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_base_packages = [
+ 'zaqar-common',
+ 'apache2',
+ 'libapache2-mod-wsgi',
+ 'python-ldappool'
+ ] %}
+
+{{ macros.install_packages(zaqar_base_packages | customizable("packages")) }} \
+ && mkdir -p /var/www/cgi-bin/zaqar \
+ && chown -R zaqar: /var/www/cgi-bin/zaqar \
+ && cp -a /usr/lib/python2.7/dist-packages/zaqar/transport/wsgi/app.py /var/www/cgi-bin/zaqar/ \
+ && echo > /etc/apache2/ports.conf
+ {% endif %}
+
+{% elif install_type == 'source' %}
+
+ {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
+ {% set zaqar_base_packages = [
+ 'httpd',
+ 'mod_ssl',
+ 'mod_wsgi',
+ 'python2-ldappool'
+ ] %}
+
+{{ macros.install_packages(zaqar_base_packages | customizable("packages")) }} \
+ && 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_base_packages = [
+ 'apache2',
+ 'libapache2-mod-wsgi',
+ 'python-ldappool'
+ ] %}
+
+{{ macros.install_packages(zaqar_base_packages | customizable("packages")) }} \
+ && echo > /etc/apache2/ports.conf
+ {% endif %}
+
+{% set zaqar_base_pip_packages = [
+ 'pymongo',
+ '/zaqar',
+ 'gevent'
+] %}
+
+ADD zaqar-base-archive /zaqar-base-source
+
+RUN ln -s zaqar-base-source/* zaqar \
+ && {{ macros.install_pip(zaqar_base_pip_packages | customizable("pip_packages")) }} \
+ && mkdir -p /etc/zaqar /var/lib/zaqar /var/www/cgi-bin/zaqar \
+ && cp -r /zaqar/etc/* /etc/zaqar/ \
+ && cp /zaqar/zaqar/transport/wsgi/app.py /var/www/cgi-bin/zaqar \
+ && chown -R zaqar: /etc/zaqar /var/lib/zaqar /var/www/cgi-bin/zaqar
+
+{% endif %}
+
+COPY extend_start.sh /usr/local/bin/kolla_extend_start
+RUN touch /usr/local/bin/kolla_zaqar_extend_start \
+ && chmod 755 /var/www/cgi-bin/zaqar \
+ && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_zaqar_extend_start
+
+{% block zaqar_base_footer %}{% endblock %}
diff --git a/docker/zaqar/zaqar-base/extend_start.sh b/docker/zaqar/zaqar-base/extend_start.sh
new file mode 100644
index 000000000..f696c024d
--- /dev/null
+++ b/docker/zaqar/zaqar-base/extend_start.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Create log dir for Zaqar logs
+LOG_DIR="/var/log/kolla/zaqar"
+if [[ ! -d "${LOG_DIR}" ]]; then
+ mkdir -p ${LOG_DIR}
+fi
+if [[ $(stat -c %U:%G ${LOG_DIR}) != "zaqar:kolla" ]]; then
+ chown zaqar:kolla ${LOG_DIR}
+fi
+if [[ $(stat -c %a ${LOG_DIR}) != "755" ]]; then
+ chmod 755 ${LOG_DIR}
+fi
+
+. /usr/local/bin/kolla_zaqar_extend_start
diff --git a/docker/zaqar/zaqar-server/Dockerfile.j2 b/docker/zaqar/zaqar-server/Dockerfile.j2
new file mode 100644
index 000000000..72aeaed50
--- /dev/null
+++ b/docker/zaqar/zaqar-server/Dockerfile.j2
@@ -0,0 +1,18 @@
+FROM {{ namespace }}/{{ image_prefix }}zaqar-base:{{ tag }}
+LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
+
+{% block zaqar_server_header %}{% endblock %}
+
+{% import "macros.j2" as macros with context %}
+
+{% if install_type == 'binary' %}
+ {% if base_distro in ['debian', 'ubuntu'] %}
+ {% set zaqar_server_packages = ['zaqar-server'] %}
+
+{{ macros.install_packages(zaqar_server_packages | customizable("packages")) }}
+
+ {% endif %}
+{% endif %}
+
+{% block zaqar_server_footer %}{% endblock %}
+{% block footer %}{% endblock %}
diff --git a/docker/zaqar/zaqar-wsgi/Dockerfile.j2 b/docker/zaqar/zaqar-wsgi/Dockerfile.j2
new file mode 100644
index 000000000..14de1b7ff
--- /dev/null
+++ b/docker/zaqar/zaqar-wsgi/Dockerfile.j2
@@ -0,0 +1,12 @@
+FROM {{ namespace }}/{{ image_prefix }}zaqar-base:{{ tag }}
+LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
+
+{% block zaqar_wsgi_header %}{% endblock %}
+
+{% import "macros.j2" as macros with context %}
+
+COPY extend_start.sh /usr/local/bin/kolla_zaqar_extend_start
+RUN chmod 755 /usr/local/bin/kolla_zaqar_extend_start
+
+{% block zaqar_wsgi_footer %}{% endblock %}
+{% block footer %}{% endblock %}
diff --git a/docker/zaqar/extend_start.sh b/docker/zaqar/zaqar-wsgi/extend_start.sh
index f36093c57..ada839e96 100755
--- a/docker/zaqar/extend_start.sh
+++ b/docker/zaqar/zaqar-wsgi/extend_start.sh
@@ -1,12 +1,5 @@
#!/bin/bash
-if [[ ! -d "/var/log/kolla/zaqar" ]]; then
- mkdir -p /var/log/kolla/zaqar
-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 [[ "$(whoami)" == 'root' ]]; then
# NOTE(pbourke): httpd will not clean up after itself in some cases which