kopia lustrzana https://github.com/kartoza/docker-postgis
add stanza script
rodzic
3085b9e89f
commit
afb6536a47
|
@ -118,6 +118,11 @@ RUN chmod 777 /var/log/pgbackrest/postgres-stanza-create.log
|
|||
# Copy pgBackRest configuration file
|
||||
COPY ./pgbackrest/pgbackrest.conf /etc/pgbackrest/pgbackrest.conf
|
||||
|
||||
# Copy stanza-create script
|
||||
COPY ./stanza-create.sh /usr/local/bin/stanza-create.sh
|
||||
RUN chmod +x /usr/local/bin/stanza-create.sh
|
||||
|
||||
|
||||
# Add a backup script
|
||||
COPY ./pgbackrest/backup-script.sh /usr/local/bin/backup-script.sh
|
||||
RUN chmod +x /usr/local/bin/backup-script.sh
|
||||
|
@ -216,7 +221,8 @@ RUN set -eux \
|
|||
RUN echo 'figlet -t "Kartoza Docker PostGIS"' >> ~/.bashrc
|
||||
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "-c", "/scripts/docker-entrypoint.sh && cron -f"]
|
||||
ENTRYPOINT ["/bin/bash", "-c", "/scripts/docker-entrypoint.sh && /usr/local/bin/stanza-create.sh && cron -f"]
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Wait for PostgreSQL to be ready
|
||||
until pg_isready -h localhost -U "$POSTGRES_USER" -d "$POSTGRES_DB"; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Create the stanza if it doesn't exist
|
||||
if ! pgbackrest info --stanza=postgres > /dev/null 2>&1; then
|
||||
echo "Creating pgBackRest stanza..."
|
||||
pgbackrest --stanza=postgres stanza-create
|
||||
else
|
||||
echo "Stanza already exists."
|
||||
fi
|
Ładowanie…
Reference in New Issue