Skip to content

Commit

Permalink
use fsync and preallocation for rsync
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Jul 26, 2023
1 parent 6b7dff0 commit af04353
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions deploy-static
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ echo target is $target
echo

ssh $remote "rm -rf $target && cp -a $active $target"
rsync -rpcv --fsync --chmod=D755,F644 --delete static-tmp/ $remote:$target
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate static-tmp/ $remote:$target
ssh $remote "ln -snf $target /srv/element.grapheneos.org && sync /srv/element.grapheneos.org"

echo "root $target;" > nginx-tmp/root_element.grapheneos.org.conf
rsync -rptcv --fsync --chmod=D755,F644 --delete nginx-tmp/{nginx.conf,mime.types,root_element.grapheneos.org.conf,snippets} $remote:/etc/nginx/
rsync -ptcv --fsync --chmod=755 {local-backup,remote-backup} $remote:/usr/local/bin/
rsync -ptcv --fsync --chmod=644 systemd/system/remote-backup.timer $remote:/etc/systemd/system/remote-backup.timer
rsync -ptcv --fsync --chmod=644 systemd/system/remote-backup.service $remote:/etc/systemd/system/remote-backup.service
rsync -rptcv --chmod=D755,F644 --delete --fsync --preallocate nginx-tmp/{nginx.conf,mime.types,root_element.grapheneos.org.conf,snippets} $remote:/etc/nginx/
rsync -ptcv --chmod=755 --fsync --preallocate {local-backup,remote-backup} $remote:/usr/local/bin/
rsync -ptcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.timer $remote:/etc/systemd/system/remote-backup.timer
rsync -ptcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.service $remote:/etc/systemd/system/remote-backup.service
ssh $remote nginx -s reload

echo
Expand Down
2 changes: 1 addition & 1 deletion local-backup
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ ssh $remote "mkdir local-backup/$timestamp"
ssh $remote "pg_dumpall -U postgres > local-backup/$timestamp/all_databases.sql"
ssh $remote "cp -r /etc/synapse local-backup/$timestamp/synapse"
ssh $remote "tar -cC local-backup $timestamp | zstd -9 | age -r \$(cat backup-public-key.txt) -o local-backup/$timestamp.tar.zst.age"
rsync -v $remote:./local-backup/$timestamp.tar.zst.age backup/
rsync -v --fsync --preallocate $remote:./local-backup/$timestamp.tar.zst.age backup/

ssh $remote "rm -rf local-backup"

0 comments on commit af04353

Please sign in to comment.