File tree Expand file tree Collapse file tree 4 files changed +32
-9
lines changed
scripts/pgbackrest/repo-host Expand file tree Collapse file tree 4 files changed +32
-9
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ postgres-oracle-build:
134134postgres-oracle : postgres-oracle-build
135135
136136pgbouncer-build :
137- docker build $(ROOTPATH ) \
137+ docker build $(ROOTPATH ) --no-cache \
138138 --file $(ROOTPATH ) /docker/pgbouncer/Dockerfile \
139139 --tag cybertec-pg-container/pgbouncer:$(IMAGE_TAG ) \
140140 --build-arg BASE_IMAGE=$(BASE_IMAGE ) \
Original file line number Diff line number Diff line change @@ -131,6 +131,9 @@ COPY --from=micro / /
131131
132132ARG PGVERSION
133133
134+ ENV PATH=$PATH:/usr/pgsql-$PGVERSION/bin \
135+ LD_LIBRARY_PATH=/usr/pgsql-$PGVERSION/lib:$LD_LIBRARY_PATH
136+
134137LABEL org.opencontainers.image.source=https://github.com/cybertec-postgresql/CYBERTEC-pg-container
135138LABEL org.opencontainers.image.description="CYBERTEC-PG-Container - pgBackRest-Container for restore-Container and as Repo-Host"
136139LABEL org.opencontainers.image.licenses=Apache-2.0
Original file line number Diff line number Diff line change 1818sysctl -w vm.dirty_background_bytes=67108864 > /dev/null 2>&1
1919sysctl -w vm.dirty_bytes=134217728 > /dev/null 2>&1
2020mkdir -p " $PGLOG " " $PGDATA " " $RW_DIR /postgresql" " $RW_DIR /tmp" " $RW_DIR /certs"
21- if [ " $( id -u) " -ne 0 ]; then
22- sed -e " s/^postgres:x:[^:]*:[^:]*:/postgres:x:$( id -u) :$( id -g) :/" /etc/passwd > " $RW_DIR /tmp/passwd"
23- cat " $RW_DIR /tmp/passwd" > /etc/passwd
24- rm " $RW_DIR /tmp/passwd"
25- fi
21+ # if [ "$(id -u)" -ne 0 ]; then
22+ # sed -e "s/^postgres:x:[^:]*:[^:]*:/postgres:x:$(id -u):$(id -g):/" /etc/passwd > "$RW_DIR/tmp/passwd"
23+ # cat "$RW_DIR/tmp/passwd" > /etc/passwd
24+ # rm "$RW_DIR/tmp/passwd"
25+ # fi
2626
2727# # Ensure all logfiles exist, most appliances will have
2828# # a foreign data wrapper pointing to these files
Original file line number Diff line number Diff line change @@ -16,13 +16,33 @@ status=$(echo $stanza | jq '.[0].status.code')
1616
1717if [ " $db " == " []" ] && [ " $archive " == " []" ] || [ " $status " == " 1" ]; then
1818 # Check if Primary is ready
19- pgbackrest stanza-create --stanza=db
19+ count=0
20+ while true
21+ do
22+ pgbackrest stanza-create --stanza=db
23+ returnCode=$?
24+ (( count++ ))
25+
26+ if [ " $returnCode " -eq 56 ]; then
27+ echo " WARNING: pgbackrest could not create stanza – No primary found - Attempt $count / 10"
28+ sleep 5
29+ elif [ " $returnCode " -eq 0 ]; then
30+ echo " INFO: pgbackrest stanza successfully created."
31+ break
32+ fi
33+
34+ if [ " $count " -eq 10 ]; then
35+ echo " ERROR: pgbackrest could not create stanza - reached max attempts."
36+ break
37+ fi
38+ done
39+ echo " INFO: create initial backup"
2040 pgbackrest backup --type=full --stanza=db --repo=1
21- echo " Finished : pgBackRest is ready for use"
41+ echo " INFO : pgBackRest is ready for use"
2242else
2343 backupCount=$( pgbackrest info --output=json | jq ' .[0].backup' | jq length)
2444 if [ " $backupCount " == " 0" ]; then
2545 pgbackrest backup --type=full --stanza=db --repo=1
26- echo " Finished : pgBackRest is ready for use"
46+ echo " INFO : pgBackRest is ready for use"
2747 fi
2848fi
You can’t perform that action at this time.
0 commit comments