diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2021-04-17 12:21:13 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2021-04-17 12:21:13 +0200 |
commit | 338a8ec7da79ecaccb70f2fbd7cecd385a32fae7 (patch) | |
tree | b63ea14497c6eb0099370182b7c6052e843af41c | |
parent | 3135c385054ebd4955c992a1c616eb20c97e0683 (diff) | |
download | infrastructure-338a8ec7da79ecaccb70f2fbd7cecd385a32fae7.tar.gz infrastructure-338a8ec7da79ecaccb70f2fbd7cecd385a32fae7.zip |
Try to migrate to pg_basebackup
-rwxr-xr-x | app/backup/build/backup-matrix/do_backup.sh | 19 | ||||
-rw-r--r-- | app/backup/deploy/backup-matrix.hcl | 7 | ||||
-rw-r--r-- | app/docker-compose.yml | 2 |
3 files changed, 20 insertions, 8 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" diff --git a/app/backup/deploy/backup-matrix.hcl b/app/backup/deploy/backup-matrix.hcl index 1c85e38..cb28c90 100644 --- a/app/backup/deploy/backup-matrix.hcl +++ b/app/backup/deploy/backup-matrix.hcl @@ -7,7 +7,7 @@ job "backup_manual_matrix" { driver = "docker" config { - image = "superboum/backup_matrix:3" + image = "superboum/backup_matrix:4" volumes = [ "secrets/id_ed25519:/root/.ssh/id_ed25519", "secrets/id_ed25519.pub:/root/.ssh/id_ed25519.pub", @@ -27,9 +27,8 @@ TARGET_SSH_USER={{ key "secrets/backup/target_ssh_user" }} TARGET_SSH_PORT={{ key "secrets/backup/target_ssh_port" }} TARGET_SSH_HOST={{ key "secrets/backup/target_ssh_host" }} TARGET_SSH_DIR={{ key "secrets/backup/target_ssh_dir" }} -MATRIX_PSQL_DB={{ key "secrets/chat/synapse/postgres_db" }} -MATRIX_PSQL_USER={{ key "secrets/chat/synapse/postgres_user" }} -MATRIX_PSQL_PWD={{ key "secrets/chat/synapse/postgres_pwd" }} +REPL_PSQL_USER={{ key "secrets/postgres/keeper/pg_repl_username" }} +REPL_PSQL_PWD={{ key "secrets/postgres/keeper/pg_repl_pwd" }} EOH destination = "secrets/env_vars" diff --git a/app/docker-compose.yml b/app/docker-compose.yml index 4195c48..fac84a1 100644 --- a/app/docker-compose.yml +++ b/app/docker-compose.yml @@ -108,4 +108,4 @@ services: backup-matrix: build: context: ./backup/build/backup-matrix - image: superboum/backup_matrix:3 + image: superboum/backup_matrix:4 |