Last active
January 4, 2023 12:30
-
-
Save keiya/c327d34417bb97456aab20ff2dc70de6 to your computer and use it in GitHub Desktop.
PostgreSQL in docker online remote backup script (with encryption) useful for Mastodon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /home/ec2-user/mastodon | |
TMPFILE=$(mktemp) | |
PASSWORD=xxxxxxx | |
DAY=$(date +"%a") | |
docker-compose exec db pg_dump -Z1 -Fc -U postgres postgres | openssl enc -aes-128-ctr -md sha256 -e -pass pass:$PASSWORD > $TMPFILE | |
rsync -avc --no-compress --progress $TMPFILE [email protected]:pg-backup-$DAY.encrypted | |
rm -f $TMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to decrypt: