Merge branch 'master' of ssh://gitlab.koehn.com:2201/docker/postgres-wal-g

This commit is contained in:
Brad Koehn committed 2019-02-20 12:25:19 -06:00
commit 18b0d9b0ee
3 files changed
+21 -12

No files matched your search

+5 -1
View File
@@ -1,3 +1,7 @@
#!/bin/bash #!/bin/bash
wal-g backup-push /var/lib/postgresql/data/pgsql if [ -z ${PGDATA+x} ]; then
export PGDATA=/var/lib/postgresql/data/pgsql
fi
wal-g backup-push "$PGDATA"
+7 -4
View File
@@ -2,12 +2,15 @@
set -e set -e
export DATA=/var/lib/postgresql/data/pgsql if [ -z ${PGDATA+x} ]; then
export PGDATA=/var/lib/postgresql/data/pgsql
fi
export PG_VERSION=$(ls /usr/lib/postgresql/) export PG_VERSION=$(ls /usr/lib/postgresql/)
# disable recovery mode, re-enable remote connections and archive mode # disable recovery mode, re-enable remote connections and archive mode
mv $DATA/pg_hba.conf.orig $DATA/pg_hba.conf mv $PGDATA/pg_hba.conf.orig $PGDATA/pg_hba.conf
sed -i -e 's/^archive_mode = off/archive_mode = on/' $DATA/postgresql.conf sed -i -e 's/^archive_mode = off/archive_mode = on/' $PGDATA/postgresql.conf
cat <<EOF cat <<EOF
****************** ******************
@@ -17,5 +20,5 @@ cat <<EOF
****************** ******************
EOF EOF
bash -c "sleep 3 && /usr/lib/postgresql/$PG_VERSION/bin/pg_ctl stop -D $DATA" & bash -c "sleep 3 && /usr/lib/postgresql/$PG_VERSION/bin/pg_ctl stop -D $PGDATA" &
+9 -7
View File
@@ -7,17 +7,19 @@ fi
set -e set -e
DATA=/var/lib/postgresql/data/pgsql if [ -z ${PGDATA+x} ]; then
export PGDATA=/var/lib/postgresql/data/pgsql
fi
# fetch most recent full backup # fetch most recent full backup
wal-g backup-fetch $DATA LATEST wal-g backup-fetch $PGDATA LATEST
# enable recovery mode, disable remote connections and archive mode # enable recovery mode, disable remote connections and archive mode
cp /wal-g/recovery.conf $DATA/ cp /wal-g/recovery.conf $PGDATA/
mv $DATA/pg_hba.conf $DATA/pg_hba.conf.orig mv $PGDATA/pg_hba.conf $PGDATA/pg_hba.conf.orig
cp /wal-g/pg_hba.conf $DATA/pg_hba.conf cp /wal-g/pg_hba.conf $PGDATA/pg_hba.conf
sed -i -e 's/^archive_mode = on/archive_mode = off/' $DATA/postgresql.conf sed -i -e 's/^archive_mode = on/archive_mode = off/' $PGDATA/postgresql.conf
PG_VERSION=$(ls /usr/lib/postgresql/) PG_VERSION=$(ls /usr/lib/postgresql/)
/usr/lib/postgresql/$PG_VERSION/bin/pg_ctl start -D $DATA /usr/lib/postgresql/$PG_VERSION/bin/pg_ctl start -D $PGDATA