You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# Immediatly exit on command failure (e)
|
|
|
|
# and quit on unset variables (u)
|
|
|
|
set -ue
|
|
|
|
|
|
|
|
export BACKUP_REPO=ssh://cttuebak/media/borg/cttue/matrix
|
|
|
|
export BACKUP_NAME_DB="db_$(date -u +'%Y-%m-%dT%H:%M%Z')"
|
|
|
|
export BACKUP_NAME_DATA="synapse-storage_$(date -u +'%Y-%m-%dT%H:%M%Z')"
|
|
|
|
export BORG_PASSPHRASE=$(cat "$(dirname $0)/borg_passphrase.txt")
|
|
|
|
|
|
|
|
# Dump the database into borg create
|
|
|
|
echo "Starting Backup of Matrix / Synapse Database..."
|
|
|
|
docker exec matrix-postgres pg_dump synapse -U synapse |
|
|
|
|
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} -
|
|
|
|
|
|
|
|
echo "Backup done. Pruning Matrix / Synapse Database..."
|
|
|
|
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "db_*" ${BACKUP_REPO}
|
|
|
|
|
|
|
|
echo "Starting Backup of Matrix / Synapse Storage..."
|
|
|
|
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DATA} /matrix/synapse/storage
|
|
|
|
|
|
|
|
echo "Backup done. Pruning Matrix / Synapse Storage..."
|
|
|
|
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "synapse-storage_*" ${BACKUP_REPO}
|
|
|
|
|
|
|
|
echo "Done"
|