Commit 8ebcc5c2 authored by Oleksii Kliukin's avatar Oleksii Kliukin
Browse files

Docker image configuration for the BDR PostgreSQL.

No related merge requests found
Showing with 22 additions and 9 deletions
+22 -9
......@@ -17,16 +17,21 @@ RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
# Add PGDG repositories
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
RUN echo "deb http://packages.2ndquadrant.com/bdr/apt/ $(lsb_release -cs)-2ndquadrant main" >> /etc/apt/sources.list.d/pgdg.list
RUN curl -s -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
# import the BDR plugin
RUN curl -s -o - http://packages.2ndquadrant.com/bdr/apt/AA7A6805.asc | sudo apt-key add -
RUN apt-get update
ENV PGVERSION 9.4
ENV PGTYPE postgresql-bdr
ENV PGCOMPATIBLETYPE postgresql
ENV PGHOME /home/postgres
ENV PGDATA $PGHOME/pgdata/data
# Install PostgreSQL 9.4 binaries, contrib, pgq, plproxy, pgq and plpython
RUN apt-get install postgresql-${PGVERSION} postgresql-${PGVERSION}-dbg postgresql-server-dev-${PGVERSION} postgresql-client-${PGVERSION} postgresql-contrib-${PGVERSION} postgresql-${PGVERSION}-plproxy postgresql-${PGVERSION}-pgq3 postgresql-${PGVERSION}-postgis postgresql-plpython3-${PGVERSION} postgresql-plpython-${PGVERSION} postgresql-${PGVERSION}-plr -y \
RUN apt-get install ${PGTYPE}-${PGVERSION} ${PGTYPE}-${PGVERSION}-bdr-plugin ${PGTYPE}-${PGVERSION}-dbg ${PGTYPE}-server-dev-${PGVERSION} ${PGTYPE}-client-${PGVERSION} ${PGTYPE}-contrib-${PGVERSION} ${PGCOMPATIBLETYPE}-${PGVERSION}-plproxy ${PGCOMPATIBLETYPE}-${PGVERSION}-plr ${PGCOMPATIBLETYPE}-${PGVERSION}-pgq3 ${PGCOMPATIBLETYPE}-${PGVERSION}-postgis -y \
## # install all build-dependencies for postgresql-9.4 in order to be able to compile 9.4
&& apt-get clean \
## # Remove the default cluster, which Debian stupidly starts right after installation of the packages
......@@ -60,9 +65,12 @@ RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etc
RUN cp /etc/ssl/private/ssl-cert-snakeoil.key $PGHOME/dummy.key && cp /etc/ssl/certs/ssl-cert-snakeoil.pem $PGHOME/dummy.crt
# Install Patroni
ENV PATRONIVERSION 0.75
ENV PATRONIVERSION feature/bdr
WORKDIR $PGHOME
RUN pip install patroni==$PATRONIVERSION
RUN git clone https://github.com/zalando/patroni -b ${PATRONIVERSION}
RUN ln -s $PGHOME/patroni/patronictl.py /usr/local/bin/patronictl \
&& ln -s $PGHOME/patroni/patroni/scripts/aws.py /usr/local/bin/patroni_aws \
&& ln -s $PGHOME/patroni/patroni/scripts/wale_restore.py /usr/local/bin/patroni_wale_restore
ADD postgres_ha.sh /
RUN chown postgres:postgres $PGHOME -R
......@@ -71,6 +79,7 @@ RUN chmod 700 /postgres_ha.sh
ENV ETCD_DISCOVERY_DOMAIN postgres.acid.example.com
ENV SCOPE test
ENV BDR_DATABASE bdrtest
ENV WAL_S3_BUCKET spilo-example-com
ENV DEBUG 0
# Shoud be 3am by GMT+2 aka Berlin Summer Time
......
......@@ -68,6 +68,9 @@ __EOF__
fi
cat >> postgres.yml <<__EOF__
bdr:
enable: 'on'
database: ${BDR_DATABASE}
postgresql:
name: postgresql_${HOSTNAME}
scope: *scope
......@@ -106,12 +109,15 @@ postgresql:
password: zalando
parameters:
archive_mode: "on"
wal_level: hot_standby
archive_command: "envdir ${WALE_ENV_DIR} wal-e --aws-instance-profile wal-push \"%p\" -p 1"
max_wal_senders: 5
max_worker_processes: 10
max_replication_slots: 10
max_wal_senders: 10
shared_preload_libraries: 'bdr'
track_commit_timestamp: true
wal_level: 'logical'
wal_keep_segments: 8
archive_timeout: 1800s
max_replication_slots: 5
hot_standby: "on"
tcp_keepalives_idle: 900
tcp_keepalives_interval: 100
......@@ -198,7 +204,5 @@ write_archive_command_environment
) &
[[ "$DEBUG" == 1 ]] && exec /bin/bash
exec patroni "$PGHOME/postgres.yml"
exec patroni/patroni.py "$PGHOME/postgres.yml"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment