diff --git a/docker/congress/congress-api/Dockerfile.j2 b/docker/congress/congress-api/Dockerfile.j2 new file mode 100644 index 0000000000..b23548746e --- /dev/null +++ b/docker/congress/congress-api/Dockerfile.j2 @@ -0,0 +1,11 @@ +FROM {{ namespace }}/{{ image_prefix }}congress-base:{{ tag }} +MAINTAINER {{ maintainer }} + +COPY extend_start.sh /usr/local/bin/kolla_congress_extend_start +RUN chmod 755 /usr/local/bin/kolla_congress_extend_start + +{% block congress_api_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER congress diff --git a/docker/congress/congress-api/extend_start.sh b/docker/congress/congress-api/extend_start.sh new file mode 100644 index 0000000000..b18446d7f4 --- /dev/null +++ b/docker/congress/congress-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/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 + congress-db-manage --config-file /etc/congress/congress.conf upgrade head + exit 0 +fi diff --git a/docker/congress/congress-base/Dockerfile.j2 b/docker/congress/congress-base/Dockerfile.j2 new file mode 100644 index 0000000000..2a69643872 --- /dev/null +++ b/docker/congress/congress-base/Dockerfile.j2 @@ -0,0 +1,43 @@ +FROM {{ namespace }}/{{ image_prefix}}openstack-base:{{ tag }} +MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + {% if base_distro in ['ubuntu'] %} + {% set congress_base_packages = [ + 'congress-common', + 'congress-server'] + %} + +# TODO(Md Nadeem): need to add congress binary package when it is available in rpm base distro +#https://trunk.rdoproject.org/ + {% elif base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + + {% endif %} + +RUN {{ macros.install_packages(congress_base_packages | customizable("packages")) }} + +{% elif install_type == 'source' %} + +ADD congress-base-archive /congress-base-source +RUN ln -s congress-base-source/* congress \ + && useradd --user-group congress \ + && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /congress \ + && mkdir -p /etc/congress /home/congress \ + && cp -r /congress/etc/* /etc/congress/ \ + && chown -R congress: /etc/congress /home/congress + +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN usermod -a -G kolla congress \ + && touch /usr/local/bin/kolla_congress_extend_start \ + && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_congress_extend_start + +{% block congress_base_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} \ No newline at end of file diff --git a/docker/congress/congress-base/extend_start.sh b/docker/congress/congress-base/extend_start.sh new file mode 100644 index 0000000000..99e16e1bf0 --- /dev/null +++ b/docker/congress/congress-base/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/congress" ]]; then + mkdir -p /var/log/kolla/congress +fi +if [[ $(stat -c %a /var/log/kolla/congress) != "755" ]]; then + chmod 755 /var/log/kolla/congress +fi + +. /usr/local/bin/kolla_congress_extend_start diff --git a/docker/congress/congress-datasource/Dockerfile.j2 b/docker/congress/congress-datasource/Dockerfile.j2 new file mode 100644 index 0000000000..5a62891ec0 --- /dev/null +++ b/docker/congress/congress-datasource/Dockerfile.j2 @@ -0,0 +1,8 @@ +FROM {{ namespace }}/{{ image_prefix }}congress-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block congress_datasource_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER congress diff --git a/docker/congress/congress-policy-engine/Dockerfile.j2 b/docker/congress/congress-policy-engine/Dockerfile.j2 new file mode 100644 index 0000000000..6a1a6d056b --- /dev/null +++ b/docker/congress/congress-policy-engine/Dockerfile.j2 @@ -0,0 +1,8 @@ +FROM {{ namespace }}/{{ image_prefix }}congress-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block congress_policy_engine_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER congress diff --git a/kolla/common/config.py b/kolla/common/config.py index 9bb51ab6c1..2f5c436730 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -45,7 +45,8 @@ _PROFILE_OPTS = [ help='Main images'), cfg.ListOpt('aux', default=['aodh', 'designate', 'gnocchi', 'ironic', - 'magnum', 'mistral', 'trove,' 'zaqar', 'zookeeper'], + 'magnum', 'mistral', 'trove,' 'zaqar', 'zookeeper', + 'congress'], help='Aux Images'), cfg.ListOpt('default', default=['cron', 'kolla-toolbox', 'glance', 'haproxy', @@ -178,6 +179,10 @@ SOURCES = { 'type': 'url', 'location': ('http://tarballs.openstack.org/cinder/' 'cinder-master.tar.gz')}, + 'congress-base': { + 'type': 'url', + 'location': ('http://tarballs.openstack.org/congress/' + 'congress-master.tar.gz')}, 'designate-base': { 'type': 'url', 'location': ('http://tarballs.openstack.org/designate/' diff --git a/tests/test_build.py b/tests/test_build.py index 76fabc48f3..d0ea83813f 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -71,8 +71,8 @@ class BuildTestCentosBinary(BuildTest, base.BaseTestCase): "neutron-networking-sfc-agent", "senlin-base", "vmtp", - "watcher-base" - ] + "watcher-base", + "congress-base"] def setUp(self): super(BuildTestCentosBinary, self).setUp() @@ -93,8 +93,8 @@ class BuildTestCentosSource(BuildTest, base.BaseTestCase): class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase): excluded_images = ["neutron-networking-sfc-agent", "vmtp", - "zaqar" - ] + "zaqar", + "congress-base"] def setUp(self): super(BuildTestUbuntuBinary, self).setUp() @@ -116,8 +116,8 @@ class BuildTestOracleLinuxBinary(BuildTest, base.BaseTestCase): "neutron-networking-sfc-agent", "senlin-base", "vmtp", - "watcher-base" - ] + "watcher-base", + "congress-base"] def setUp(self): super(BuildTestOracleLinuxBinary, self).setUp()