aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rwxr-xr-xapp/backup/build/backup-matrix/do_backup.sh2
-rw-r--r--app/backup/deploy/backup-matrix.hcl2
-rw-r--r--app/docker-compose.yml2
-rw-r--r--app/postgres/build/postgres/0001-Add-max-rate-to-pg_basebackup.patch25
-rw-r--r--app/postgres/build/postgres/Dockerfile2
-rw-r--r--app/postgres/deploy/postgres.hcl2
6 files changed, 31 insertions, 4 deletions
diff --git a/app/backup/build/backup-matrix/do_backup.sh b/app/backup/build/backup-matrix/do_backup.sh
index 4da62bd..74cd9da 100755
--- a/app/backup/build/backup-matrix/do_backup.sh
+++ b/app/backup/build/backup-matrix/do_backup.sh
@@ -16,7 +16,7 @@ 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 datura.machine.deuxfleurs.fr -p 5433 $MATRIX_PSQL_DB | \
+pg_dump -v -Fc -U $MATRIX_PSQL_USER -h 192.168.0.2 -p 5433 $MATRIX_PSQL_DB | \
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 8d0eb32..1c85e38 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:2"
+ image = "superboum/backup_matrix:3"
volumes = [
"secrets/id_ed25519:/root/.ssh/id_ed25519",
"secrets/id_ed25519.pub:/root/.ssh/id_ed25519.pub",
diff --git a/app/docker-compose.yml b/app/docker-compose.yml
index 2bb7f57..0d82cab 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:2
+ image: superboum/backup_matrix:3
diff --git a/app/postgres/build/postgres/0001-Add-max-rate-to-pg_basebackup.patch b/app/postgres/build/postgres/0001-Add-max-rate-to-pg_basebackup.patch
new file mode 100644
index 0000000..9277ac4
--- /dev/null
+++ b/app/postgres/build/postgres/0001-Add-max-rate-to-pg_basebackup.patch
@@ -0,0 +1,25 @@
+From c4e0e967752868626772a3317a17d25d181daeda Mon Sep 17 00:00:00 2001
+From: Quentin Dufour <quentin@deuxfleurs.fr>
+Date: Thu, 15 Apr 2021 12:35:12 +0200
+Subject: [PATCH] Add max-rate to pg_basebackup
+
+---
+ internal/postgresql/postgresql.go | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/internal/postgresql/postgresql.go b/internal/postgresql/postgresql.go
+index 00c14bc..a37a28c 100644
+--- a/internal/postgresql/postgresql.go
++++ b/internal/postgresql/postgresql.go
+@@ -963,7 +963,7 @@ func (p *Manager) SyncFromFollowed(followedConnParams ConnParams, replSlot strin
+
+ log.Infow("running pg_basebackup")
+ name := filepath.Join(p.pgBinPath, "pg_basebackup")
+- args := []string{"-R", "-v", "-P", "-Xs", "-D", p.dataDir, "-d", followedConnString}
++ args := []string{"-R", "-v", "-P", "--max-rate", "5M", "-Xs", "-D", p.dataDir, "-d", followedConnString}
+ if replSlot != "" {
+ args = append(args, "--slot", replSlot)
+ }
+--
+2.30.2
+
diff --git a/app/postgres/build/postgres/Dockerfile b/app/postgres/build/postgres/Dockerfile
index 5217bc5..64fef61 100644
--- a/app/postgres/build/postgres/Dockerfile
+++ b/app/postgres/build/postgres/Dockerfile
@@ -5,6 +5,8 @@ WORKDIR /stolon
RUN git clone https://github.com/sorintlab/stolon .
RUN git pull && git checkout ${STOLON_VERSION}
RUN go mod download
+COPY 0001-Add-max-rate-to-pg_basebackup.patch .
+RUN git am 0001-Add-max-rate-to-pg_basebackup.patch
RUN make && chmod +x /stolon/bin/*
FROM amd64/debian:stretch
diff --git a/app/postgres/deploy/postgres.hcl b/app/postgres/deploy/postgres.hcl
index 96f44fa..6173cd6 100644
--- a/app/postgres/deploy/postgres.hcl
+++ b/app/postgres/deploy/postgres.hcl
@@ -49,7 +49,7 @@ job "postgres9.6" {
"--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500",
"--port", "${NOMAD_PORT_psql_proxy_port}",
"--listen-address", "0.0.0.0",
- "--log-level", "debug"
+ "--log-level", "info"
]
ports = [ "psql_proxy_port" ]
}