Migrate services part

This commit is contained in:
Tobias Reisinger 2024-09-27 00:02:36 +02:00
parent 7c59e4ae57
commit 73bce8f6e5
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
157 changed files with 3883 additions and 9 deletions
roles/backup/files/node002

View file

@ -0,0 +1,5 @@
backup_path="$BACKUP_LOCATION/immich"
mkdir -p "$backup_path"
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,14 @@
mkdir -p "$BACKUP_LOCATION/postgres"
cd "$BACKUP_LOCATION/postgres" || exit
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"