diff options
Diffstat (limited to 'docker/placement/placement-api')
| -rw-r--r-- | docker/placement/placement-api/Dockerfile.j2 | 62 | ||||
| -rw-r--r-- | docker/placement/placement-api/extend_start.sh | 18 |
2 files changed, 80 insertions, 0 deletions
diff --git a/docker/placement/placement-api/Dockerfile.j2 b/docker/placement/placement-api/Dockerfile.j2 new file mode 100644 index 000000000..0ef86d6b2 --- /dev/null +++ b/docker/placement/placement-api/Dockerfile.j2 @@ -0,0 +1,62 @@ +FROM {{ namespace }}/{{ image_prefix }}placement-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block placement_api_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + + {% set placement_api_packages = [ + 'httpd', + 'mod_ssl', + 'mod_wsgi', + 'openstack-placement-api' + ] %} + +{{ macros.install_packages(placement_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 placement_api_packages = [ + 'apache2', + 'libapache2-mod-wsgi', + 'placement-api' + ] %} + +{{ macros.install_packages(placement_api_packages | customizable("packages")) }} +RUN truncate -s 0 /etc/apache2/ports.conf + + {% endif %} +{% elif install_type == 'source' %} + {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + + {% set placement_api_packages = [ + 'httpd', + 'mod_ssl', + 'mod_wsgi' + ] %} + +{{ macros.install_packages(placement_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 placement_api_packages = [ + 'apache2', + 'libapache2-mod-wsgi' + ] %} + +{{ macros.install_packages(placement_api_packages | customizable("packages")) }} +RUN truncate -s 0 /etc/apache2/ports.conf + + {% endif %} +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_placement_extend_start + +{% block placement_api_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/placement/placement-api/extend_start.sh b/docker/placement/placement-api/extend_start.sh new file mode 100644 index 000000000..a8e9635d1 --- /dev/null +++ b/docker/placement/placement-api/extend_start.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# 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 + placement-manage db sync + exit 0 +fi + +# 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 |
