Replace backup script with autorestic

This commit is contained in:
Tobias Reisinger 2024-10-06 01:59:46 +02:00
parent 13084e3558
commit ed51a86935
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
17 changed files with 180 additions and 224 deletions
roles/backup/files/hooks

View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
backup_path="$1"
cd /opt/services/immich || exit
docker compose exec database sh -c 'pg_dump -U "$DB_USERNAME" "$DB_DATABASE"' | gzip >"$backup_path/immich.sql.gz"

View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
export MAILCOW_BACKUP_LOCATION="$1"
/opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup all

View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
cd "$1"
postgres_tables=$(sudo -u postgres psql -Atc "SELECT datname FROM pg_database WHERE datistemplate = false;")
for i in $postgres_tables
do
printf "dumping %s ..." "$i"
sudo -u postgres pg_dump "$i" | gzip >"pg_dump_$i.sql.gz"
echo " done"
done
echo "dumping all"
sudo -u postgres pg_dumpall | gzip >"pg_dumpall.sql.gz"