From 1f04055f2f0f82f6b4e3eb3ba14e8f6fc0ddaddf Mon Sep 17 00:00:00 2001 From: Doug Aaser Date: Mon, 6 May 2019 17:47:45 +0000 Subject: [PATCH] Add Patroni image Thie patch adds the Patroni Dockerfile to the openstack-helm-images repo. Change-Id: I9bd653a55cd09df1e1fd2daa45c81a987eec5f73 --- patroni/Dockerfile.ubuntu_xenial | 31 +++++++++++++++++ patroni/build.sh | 14 ++++++++ zuul.d/patroni.yaml | 57 ++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 patroni/Dockerfile.ubuntu_xenial create mode 100755 patroni/build.sh create mode 100644 zuul.d/patroni.yaml diff --git a/patroni/Dockerfile.ubuntu_xenial b/patroni/Dockerfile.ubuntu_xenial new file mode 100644 index 0000000..2ea3f1d --- /dev/null +++ b/patroni/Dockerfile.ubuntu_xenial @@ -0,0 +1,31 @@ +FROM postgres:9.5 +MAINTAINER Alexander Kukushkin + +RUN export DEBIAN_FRONTEND=noninteractive \ + && echo 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommend \ + && apt-get update -y \ + && apt-get upgrade -y \ + && apt-cache depends patroni | sed -n -e 's/.* Depends: \(python3-.\+\)$/\1/p' \ + | grep -Ev '^python3-(sphinx|etcd|consul|kazoo|kubernetes)' \ + | xargs apt-get install -y vim-tiny curl jq locales git python3-pip python3-wheel \ + ## Make sure we have a en_US.UTF-8 locale available + && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \ + && pip3 install setuptools \ + && pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \ + && PGHOME=/home/postgres \ + && mkdir -p $PGHOME \ + && chown postgres $PGHOME \ + && sed -i "s|/var/lib/postgresql.*|$PGHOME:/bin/bash|" /etc/passwd \ + # Set permissions for OpenShift + && chmod 775 $PGHOME \ + && chmod 664 /etc/passwd \ + # Clean up + && apt-get remove -y git python3-pip python3-wheel \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* /root/.cache + +EXPOSE 5432 8008 +ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 EDITOR=/usr/bin/editor +USER postgres +WORKDIR /home/postgres diff --git a/patroni/build.sh b/patroni/build.sh new file mode 100755 index 0000000..e84851e --- /dev/null +++ b/patroni/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash +SCRIPT=`realpath $0` +SCRIPT_DIR=`dirname ${SCRIPT}` +## Only build from main folder +cd ${SCRIPT_DIR}/.. + +IMAGE="patroni" +VERSION=${VERSION:-latest} +DISTRO=${DISTRO:-ubuntu_xenial} +REGISTRY_URI=${REGISTRY_URI:-"openstackhelm/"} +EXTRA_TAG_INFO=${EXTRA_TAG_INFO:-""} +docker build -f ${IMAGE}/Dockerfile.${DISTRO} --network=host -t ${REGISTRY_URI}${IMAGE}:${VERSION}-${DISTRO}${EXTRA_TAG_INFO} ${extra_build_args} ${IMAGE} + +cd - diff --git a/zuul.d/patroni.yaml b/zuul.d/patroni.yaml new file mode 100644 index 0000000..e0c7c78 --- /dev/null +++ b/zuul.d/patroni.yaml @@ -0,0 +1,57 @@ +--- +# Copyright 2019, AT&T Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- project: + check: + jobs: + - openstack-helm-images-build-patroni + gate: + jobs: + - openstack-helm-images-upload-patroni + promote: + jobs: + - openstack-helm-images-promote-patroni + periodic: + jobs: + - openstack-helm-images-build-patroni + +- job: + name: openstack-helm-images-build-patroni + parent: openstack-helm-images-build + description: Build patroni images + vars: &patroni_vars + docker_images: + - context: patroni + repository: openstackhelm/patroni + dockerfile: Dockerfile.ubuntu_xenial + tags: + - latest-ubuntu_xenial + files: &patroni_files + - patroni/.* + - zuul.d/patroni.yaml + +- job: + name: openstack-helm-images-upload-patroni + parent: openstack-helm-images-upload + description: Build and upload patroni images + vars: *patroni_vars + files: *patroni_files + +- job: + name: openstack-helm-images-promote-patroni + parent: openstack-helm-images-promote + description: Promote a previously published patroni image to latest. + vars: *patroni_vars + files: *patroni_files