diff --git a/Dockerfile b/Dockerfile index d44a9af3..d8e27c2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -## This Dockerfile is meant to aid in the building and debugging governor whilst developing on your local machine +## This Dockerfile is meant to aid in the building and debugging patroni whilst developing on your local machine ## It has all the necessary components to play/debug with a single node appliance, running etcd FROM ubuntu:14.04 MAINTAINER Feike Steenbergen @@ -13,22 +13,23 @@ RUN apt-get update -y RUN apt-get upgrade -y ENV PGVERSION 9.4 -RUN apt-get install python python-psycopg2 python-yaml python-requests python-boto postgresql-${PGVERSION} python-dnspython -y +RUN apt-get install python python-psycopg2 python-yaml python-requests python-boto postgresql-${PGVERSION} python-dnspython python-pip -y +RUN pip install zake ENV PATH /usr/lib/postgresql/${PGVERSION}/bin:$PATH -RUN mkdir -p /governor/helpers -ADD governor.py /governor/governor.py -ADD helpers /governor/helpers -ADD postgres0.yml /governor/ +RUN mkdir -p /patroni/helpers +ADD patroni.py /patroni/patroni.py +ADD helpers /patroni/helpers +ADD postgres0.yml /patroni/ ENV ETCDVERSION 2.0.12 RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-amd64.tar.gz | tar xz -C /bin --strip=1 --wildcards --no-anchored etcd etcdctl ## Setting up a simple script that will serve as an entrypoint RUN mkdir /data/ && touch /var/log/etcd.log /var/log/etcd.err && chown postgres:postgres /var/log/etcd.* -RUN chown postgres:postgres -R /governor/ /data/ -RUN /bin/echo -e "etcd --data-dir /tmp/etcd.data > /var/log/etcd.log 2> /var/log/etcd.err &\n/governor/governor.py /governor/postgres0.yml \"\$@\"" >> /entrypoint.sh && chmod +x /entrypoint.sh +RUN chown postgres:postgres -R /patroni/ /data/ +ADD entrypoint.sh /entrypoint.sh -ENTRYPOINT /entrypoint.sh +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] USER postgres diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..ab76a0dd --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash +etcd --data-dir /tmp/etcd.data > /var/log/etcd.log 2> /var/log/etcd.err & +exec /patroni/patroni.py /patroni/postgres0.yml "$@"