Skip to content

Commit

Permalink
Fixing docker issues after replication support (#85)
Browse files Browse the repository at this point in the history
Issue: the pg-tde-streaming-repl script exited if it was executed
without replication turned on. This exit command actually exited
the docker instance instead of just the initialization script.

The curl binary was also missing from the docker image, required
for vault support, and the extension failed to build.
  • Loading branch information
dutow authored Dec 12, 2023
1 parent b015863 commit 24eb75a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This setup is intended for developmenet, and stores the keys unencrypted in the
1. To build `pg_tde` from source code, you require the following on Ubuntu/Debian:

```sh
sudo apt install make gcc libjson-c-dev postgresql-server-dev-16
sudo apt install make gcc libjson-c-dev postgresql-server-dev-16 libcurl4-openssl-dev
```

2. Install or build postgresql 16 [(see reference commit below)](#base-commit)
Expand Down
6 changes: 4 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ RUN apt-get update; \
libssl-dev \
gcc \
postgresql-server-dev-16 \
make
make \
libcurl4-openssl-dev

WORKDIR /opt/postgres-tde-ext

COPY . .

RUN make USE_PGXS=1 && \
RUN ./configure && \
make USE_PGXS=1 && \
make USE_PGXS=1 install
RUN cp /usr/share/postgresql/postgresql.conf.sample /etc/postgresql/postgresql.conf; \
echo "shared_preload_libraries = 'pg_tde'" >> /etc/postgresql/postgresql.conf; \
Expand Down
13 changes: 6 additions & 7 deletions docker/pg-tde-streaming-repl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ PG_PRIMARY=${PG_PRIMARY:-"false"}
PG_REPLICATION=${PG_REPLICATION:-"false"}
REPL_PASS=${REPL_PASS:-"replpass"}

if [ !PG_REPLICATION = "true "] ; then
exit 0
fi

if [ $PG_PRIMARY == "true" ] ; then
if [ "$PG_REPLICATION" == "true" ] ; then
if [ "$PG_PRIMARY" == "true" ] ; then
psql -c "CREATE ROLE repl WITH REPLICATION PASSWORD '${REPL_PASS}' LOGIN;"
echo "host replication repl 0.0.0.0/0 trust" >> ${PGDATA}/pg_hba.conf
else
else
rm -rf ${PGDATA}/*
pg_basebackup -h pg-primary -p 5432 -U repl -D ${PGDATA} -Fp -Xs -R
fi
fi
fi

0 comments on commit 24eb75a

Please sign in to comment.