From 4dc10e0f9930e55c4355e627396f38494e053556 Mon Sep 17 00:00:00 2001 From: SneedBot Date: Thu, 7 Sep 2023 12:09:56 +0000 Subject: [PATCH] sneed --- scripts/p2 | 1 + scripts/pitr.sh | 30 ++++++++++++++++-------------- scripts/s4 | 1 + 3 files changed, 18 insertions(+), 14 deletions(-) create mode 100755 scripts/p2 mode change 100755 => 100644 scripts/pitr.sh diff --git a/scripts/p2 b/scripts/p2 new file mode 100755 index 0000000000..fd0168b086 --- /dev/null +++ b/scripts/p2 @@ -0,0 +1 @@ +psql "$RECOVERY_DATABASE_URL" diff --git a/scripts/pitr.sh b/scripts/pitr.sh old mode 100755 new mode 100644 index 67ee9621da..8fa914bb8d --- a/scripts/pitr.sh +++ b/scripts/pitr.sh @@ -1,17 +1,19 @@ -change recovery_target_time in /etc/postgresql/15/main/postgresql.conf like this -recovery_target_time = '2023-08-12 06:07:00' +change recovery_target_time in /var/lib/postgresql/15/new/postgresql.auto.conf like this +recovery_target_time = '2023-09-07 3:18:24' -systemctl stop postgresql@15-main -mv /var/lib/postgresql/15/main/pg_wal /pg_wal -rm -rf /var/lib/postgresql/15/main -mkdir /var/lib/postgresql/15/main -cp -a /database_backup/. /var/lib/postgresql/15/main -chown postgres:postgres /var/lib/postgresql/15/main -chmod 700 /var/lib/postgresql/15/main -rm -rf /var/lib/postgresql/15/main/pg_wal -mv /pg_wal /var/lib/postgresql/15/main/pg_wal -touch /var/lib/postgresql/15/main/recovery.signal -systemctl start postgresql@15-main +systemctl stop postgresql@15-new + +rm -r /var/lib/postgresql/15/new +cp -ar /database_backup/. /var/lib/postgresql/15/new +chmod 700 /var/lib/postgresql/15/new + +rm -r /var/lib/postgresql/15/new/pg_wal +cp -ar /var/lib/postgresql/15/main/pg_wal/. /var/lib/postgresql/15/new/pg_wal + +touch /var/lib/postgresql/15/new/recovery.signal +systemctl start postgresql@15-new + +psql "${DATABASE_URL/5432/"5433"}" wait after recovery is done then: -rm /var/lib/postgresql/15/main/recovery.signal +rm /var/lib/postgresql/15/new/recovery.signal diff --git a/scripts/s4 b/scripts/s4 index 00eb5e7296..7d333bb370 100755 --- a/scripts/s4 +++ b/scripts/s4 @@ -2,5 +2,6 @@ cd /staging git pull . /e export SITE="staging.rdrama.net" +export DATABASE_URL=RECOVERY_DATABASE_URL export WORKER_COUNT="1" gunicorn files.__main__:app -b 0.0.0.0:5002 -t 0