Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: install latest bucardo to fix https://github.com/pelgrim/bucardo_docker_image/issues/6 #7

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tmp
.idea
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
- docker

install:
- echo "$DOCKER_PASSWORD" | docker login -u jefftian --password-stdin


script:
- docker build -t jefftian/bucardo .
- docker push jefftian/bucardo
33 changes: 28 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,45 @@ FROM ubuntu:xenial
LABEL maintainer="[email protected]"
LABEL version="1.0"

ENV PG_VERSION 12

RUN apt-get update \
&& apt-get -y install software-properties-common wget jq netcat

RUN add-apt-repository \
"deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"

RUN wget -q -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

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-${PG_VERSION} postgresql-plperl-${PG_VERSION} libdbi-perl libpq-dev libdbd-pg-perl libdbix-safe-perl

COPY etc/pg_hba.conf /etc/postgresql/9.5/main/
RUN apt-get -y install build-essential git
RUN git clone https://github.com/bucardo/bucardo
RUN cd bucardo && perl Makefile.PL && make && make install

RUN apt-get -y install vim

COPY etc/pg_hba.conf /etc/postgresql/${PG_VERSION}/main/
COPY etc/bucardorc /etc/bucardorc

RUN chown postgres /etc/postgresql/9.5/main/pg_hba.conf
RUN chown postgres /etc/postgresql/${PG_VERSION}/main/pg_hba.conf
RUN chown postgres /etc/bucardorc
RUN chown postgres /var/log/bucardo
RUN mkdir -p /var/log/bucardo
RUN touch /var/log/bucardo/log.bucardo
RUN chown postgres /var/log/bucardo/log.bucardo
RUN mkdir /var/run/bucardo && chown postgres /var/run/bucardo
RUN groupadd bucardo
RUN usermod -aG bucardo postgres

RUN service postgresql start \
&& su - postgres -c "bucardo install --batch"
&& service postgresql status \
&& su - postgres -c "bucardo install --batch && bucardo set log_level=debug"

COPY etc/bucardorc2 /etc/bucardorc
RUN chown postgres /etc/bucardorc

COPY lib/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
Expand Down
1 change: 1 addition & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build -t jefftian/bucardo .
4 changes: 2 additions & 2 deletions etc/bucardorc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dbport = 5432
dbuser = bucardo
dbname = bucardo
dbuser = postgres
dbname = bucardo
3 changes: 3 additions & 0 deletions etc/bucardorc2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dbport = 5432
dbuser = bucardo
dbname = bucardo
4 changes: 4 additions & 0 deletions etc/pg_hba.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ local bucardo bucardo md5
local all all peer
host all all 127.0.0.1/32 md5
host all all ::1/128 md5

local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
13 changes: 11 additions & 2 deletions lib/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,26 @@ add_syncs_to_bucardo() {
db_sync_string $sync_index
local one_time_copy="$(one_time_copy_attr $sync_index)"
run_bucardo_command "del sync sync$sync_index"
echo "will adding ..."
echo "add sync sync$sync_index \
dbs=$DB_STRING \
tables=$(sync_attr $sync_index tables list) \
onetimecopy=$one_time_copy conflict_strategy=latest"

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 conflict_strategy=latest"

echo "added"

sync_index=$(expr $sync_index + 1)
done
}

start_bucardo() {
echo "[CONTAINER] Starting Bucardo..."
run_bucardo_command "start"
run_bucardo_command "start --verbose"
}

bucardo_status() {
Expand Down