Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
FROM ubuntu:xenial
FROM ubuntu:22.04

LABEL maintainer="[email protected]"
LABEL version="1.0"
LABEL version="1.1"

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update \
&& apt-get -y upgrade

RUN apt-get -y install postgresql-9.5 bucardo jq
RUN apt-get -y install postgresql-14 jq wget curl perl make build-essential bucardo

ARG BUCARDO_VERSION=5.6.0

COPY etc/pg_hba.conf /etc/postgresql/9.5/main/
WORKDIR /tmp
RUN wget -O /tmp/bucardo.tgz http://bucardo.org/downloads/Bucardo-${BUCARDO_VERSION}.tar.gz && \
tar zxf /tmp/bucardo.tgz && \
cd Bucardo-${BUCARDO_VERSION} && \
INSTALL_BUCARDODIR=/usr/bin perl Makefile.PL && \
make -j && \
make install && \
rm -rf /tmp/Bucardo-${BUCARDO_VERSION}

COPY etc/pg_hba.conf /etc/postgresql/14/main/
COPY etc/bucardorc /etc/bucardorc

RUN chown postgres /etc/postgresql/9.5/main/pg_hba.conf
RUN chown postgres /etc/bucardorc
RUN chown postgres /var/log/bucardo
RUN mkdir /var/run/bucardo && chown postgres /var/run/bucardo
RUN usermod -aG bucardo postgres
RUN mkdir /var/run/bucardo
RUN chown postgres /etc/postgresql/14/main/pg_hba.conf /etc/bucardorc /var/log/bucardo /var/run/bucardo
RUN usermod -aG postgres bucardo

RUN service postgresql start \
&& su - postgres -c "bucardo install --batch"
Expand All @@ -24,4 +35,6 @@ COPY lib/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

VOLUME "/media/bucardo"
WORKDIR /media/bucardo

CMD ["/bin/bash","-c","/entrypoint.sh"]
2 changes: 1 addition & 1 deletion etc/bucardorc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dbport = 5432
dbuser = bucardo
dbuser = postgres
dbname = bucardo
6 changes: 3 additions & 3 deletions etc/pg_hba.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local all postgres peer
local bucardo bucardo md5
local all postgres trust
local bucardo bucardo trust
local all all peer
host all all 127.0.0.1/32 md5
host all all 127.0.0.1/32 trust
host all all ::1/128 md5
8 changes: 4 additions & 4 deletions lib/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ add_databases_to_bucardo() {
db_id=$(db_attr $db_index id integer)
db_pass=$(load_db_pass $db_index)
run_bucardo_command "del db db$db_id --force"
run_bucardo_command "add db db$db_id dbname=\"$(db_attr $db_index dbname string)\" \
run_bucardo_command "add db db$db_id --force dbname=\"$(db_attr $db_index dbname string)\" \
user=\"$(db_attr $db_index user string)\" \
pass=\"$db_pass\" \
host=\"$(db_attr $db_index host string)\""
db_index=$(expr $db_index + 1)
host=\"$(db_attr $db_index host string)\"" || exit 2
db_index=$(expr $db_index + 1)
done
}

Expand Down Expand Up @@ -161,7 +161,7 @@ add_syncs_to_bucardo() {
run_bucardo_command "add sync sync$sync_index \
dbs=$DB_STRING \
tables=$(sync_attr $sync_index tables list) \
onetimecopy=$one_time_copy"
onetimecopy=$one_time_copy" || exit 2
sync_index=$(expr $sync_index + 1)
done
}
Expand Down