From dd7d0162043dfc7cb4780e30adcd2a8cff6b472d Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 24 May 2024 12:43:16 -0400 Subject: [PATCH] use python-swiftclient to set backup expiry time This eliminates the need for a scheduled job deleting the older backups. --- .gitignore | 2 +- deploy-static | 2 +- remote-backup | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e000840..e0552be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /backup-key.txt /backup-public-key.txt /backup/ -/cloud-archive-password.txt +/cloud-archive.sh /lock /nginx-tmp/ /static-production/ diff --git a/deploy-static b/deploy-static index 5b1d47e..7aed3ba 100755 --- a/deploy-static +++ b/deploy-static @@ -50,5 +50,5 @@ rsync -pcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.timer rsync -pcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.service $remote:/etc/systemd/system/remote-backup.service rsync -pcv --chmod=644 --fsync --preallocate systemd/system/mjolnir.service $remote:/etc/systemd/system/mjolnir.service rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate systemd/system/matterbridge.service.d $remote:/etc/systemd/system/ -rsync -pcv --chmod=644 --fsync --preallocate backup-public-key.txt cloud-archive-password.txt $remote: +rsync -pcv --chmod=644 --fsync --preallocate backup-public-key.txt cloud-archive.sh $remote: rsync -pcv --chmod=600 --chown postgres:postgres --fsync --preallocate postgres/data/{pg_hba,pg_ident,postgresql}.conf $remote:/var/lib/postgres/data/ diff --git a/remote-backup b/remote-backup index 6a51042..56fdcaa 100755 --- a/remote-backup +++ b/remote-backup @@ -12,6 +12,8 @@ cp -r /etc/matterbridge.toml remote-backup/$timestamp/matterbridge.toml cp -r /etc/synapse remote-backup/$timestamp/synapse cp -r /var/lib/mjolnir remote-backup/$timestamp/mjolnir tar -cC remote-backup $timestamp | zstd -9 | age -r $(cat backup-public-key.txt) -o remote-backup/$timestamp.tar.zst.age -sshpass -f cloud-archive-password.txt rsync -v ./remote-backup/$timestamp.tar.zst.age pca@gateways.storage.gra.cloud.ovh.net:backup/ + +source cloud-archive.sh +swift upload --segment-size 5368709122 -H "X-Delete-After: 5184000" --object-name $timestamp.tar.zst.age backup remote-backup/$timestamp.tar.zst.age rm -rf remote-backup