Created
February 8, 2021 10:01
-
-
Save panterch/911aa92dfda6cf1fd2c1d867378a69c0 to your computer and use it in GitHub Desktop.
Heroku offsite Backup Skript
This file contains 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 | |
current_time=$(date "+%Y.%m.%d-%H.%M") | |
for n in $(heroku apps | grep prod | cut -d ' ' -f 1) | |
do | |
echo "backing up: $n" | |
heroku pg:backups:download --app $n -o /backup/heroku/$n.dump | |
done | |
echo "Finished" | |
# Rotation durch logrotate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Upload the file to 'heroku-database-restore'
Select the file -> edit permissions -> add public access
Copy the public URL
Login to heroku via cli
Start the restore:
heroku pg:backups:restore 'GCLOUD_BUCKET_URL' DATABASE_URL -a APP_NAME -confirm APP_NAME
GCLOUD_BUCKET_URL -> URL to the file
APP_NAME -> name of the app
Delete the file