A little over 5 years ago I shared a script that I had written to download a local backup of a Heroku app. Heroku’s CLI and its capabilities have changed a lot since then so I want to share an updated version for anyone who might find it useful.
You can check it out on Github: Heroku Postgres Backup Downloader.
For example, I have a cron job set up to generate a daily backup of Lean Domain Search that uses it:
$ ruby heroku-pgbackup-downloader.rb leandomainsearch "/Users/matt/Projects/LeanDomainSearch/Heroku Backups/" Running backup script for leandomainsearch... Capturing a new backup... New backup id: b282 Downloading new backup... Done
I’ve never had to use the backups and hopefully never will, but having them provides an extra layer of protection in case any of my sites are compromised and the data winds up corrupted or lost.
If you have a different backup strategy for your Heroku apps, I’d love to learn more – drop me a note or leave a comment below. Thanks!