aboutsummaryrefslogtreecommitdiff
path: root/app/backup/build/backup-matrix/do_backup.sh
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-04-17 12:21:13 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2021-04-17 12:21:13 +0200
commit338a8ec7da79ecaccb70f2fbd7cecd385a32fae7 (patch)
treeb63ea14497c6eb0099370182b7c6052e843af41c /app/backup/build/backup-matrix/do_backup.sh
parent3135c385054ebd4955c992a1c616eb20c97e0683 (diff)
downloadinfrastructure-338a8ec7da79ecaccb70f2fbd7cecd385a32fae7.tar.gz
infrastructure-338a8ec7da79ecaccb70f2fbd7cecd385a32fae7.zip
Try to migrate to pg_basebackup
Diffstat (limited to 'app/backup/build/backup-matrix/do_backup.sh')
-rwxr-xr-xapp/backup/build/backup-matrix/do_backup.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/app/backup/build/backup-matrix/do_backup.sh b/app/backup/build/backup-matrix/do_backup.sh
index 74cd9da..7461409 100755
--- a/app/backup/build/backup-matrix/do_backup.sh
+++ b/app/backup/build/backup-matrix/do_backup.sh
@@ -14,9 +14,22 @@ Host backuphost
EOF
echo "export sql"
-# note, -Fc means that postgresql compresses the output
-export PGPASSWORD=$MATRIX_PSQL_PWD
-pg_dump -v -Fc -U $MATRIX_PSQL_USER -h 192.168.0.2 -p 5433 $MATRIX_PSQL_DB | \
+export PGPASSWORD=$REPL_PSQL_PWD
+pg_basebackup \
+ --pgdata=- \
+ --format=tar \
+ --max-rate=1M \
+ --no-slot \
+ --wal-method=none \
+ --gzip \
+ --compress=8 \
+ --checkpoint=spread \
+ --progress \
+ --verbose \
+ --status-interval=10 \
+ --username=$REPL_PSQL_USER \
+ --port=5432 \
+ --host=psql-proxy.service.2.cluster.deuxfleurs.fr | \
age -r "$(cat /root/.ssh/id_ed25519.pub)" | \
ssh backuphost "cat > $TARGET_SSH_DIR/matrix/db-$(date --iso-8601=minute).gz.age"