matrix.grapheneos.org/remote-backup
2024-05-28 15:38:38 -04:00

21 lines
758 B
Bash
Executable File

#!/bin/bash
set -o errexit -o nounset -o pipefail
timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
rm -rf remote-backup
mkdir remote-backup
mkdir remote-backup/$timestamp
pg_dumpall -U postgres > remote-backup/$timestamp/all_databases.sql
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
source cloud-archive.sh
swift upload --skip-container-put --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