Skip to content

Commit

Permalink
use python-swiftclient to set backup expiry time
Browse files Browse the repository at this point in the history
This eliminates the need for a scheduled job deleting the older backups.
  • Loading branch information
thestinger committed May 24, 2024
1 parent ac5c82b commit 197c242
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/backup-key.txt
/backup-public-key.txt
/backup/
/cloud-archive-password.txt
/cloud-archive.sh
/lock
/nginx/blocked.conf
/venv/
2 changes: 1 addition & 1 deletion deploy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rsync -pcv --chmod=D755,F644 --fsync --preallocate my.cnf.d/server.cnf $remote:/
rsync -rpcv --chmod=D755,F644 --fsync --preallocate php/{php.ini,php-fpm.d} $remote:/etc/php/
rsync -rpcv --chmod=D755,F644 --fsync --preallocate php-legacy/{php.ini,php-fpm.d} $remote:/etc/php-legacy/
rsync -pcv --chmod=755 --fsync --preallocate {flarum-asset-compress,flarum-deploy,remote-backup,stopforumspam-update} $remote:/usr/local/bin/
rsync -pcv --chmod=644 --chown flarum-admin:flarum-admin --fsync --preallocate backup-public-key.txt cloud-archive-password.txt $remote:/home/flarum-admin/
rsync -pcv --chmod=644 --chown flarum-admin:flarum-admin --fsync --preallocate backup-public-key.txt cloud-archive.sh $remote:/home/flarum-admin/
rsync -pcv --chown root:geoipupdate --chmod=F640 --fsync --preallocate GeoIP.conf $remote:/etc/GeoIP.conf
rsync -prcv --chmod=D755,F644 --fsync --preallocate systemd/system/ $remote:/etc/systemd/system
ssh $remote nginx -s reload
4 changes: 3 additions & 1 deletion remote-backup
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ mkdir remote-backup/$timestamp
mariadb-dump --all-databases --single-transaction > remote-backup/$timestamp/all_databases.sql
cp -r /opt/flarum remote-backup/$timestamp/flarum
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 [email protected]: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

0 comments on commit 197c242

Please sign in to comment.