Search code examples
postgresqlherokuheroku-postgres

how to take heroku postgress DB backup on remote location?


hi I take backup of my heroku database using PGBackups but its provide me backup on there pre define places .now I wont to take that backup on my remote location folder on S3 or some other remote storage.

how can we do that periodically like every week or month it's own/automatically.

my app on Ruby on Rails help me to achieve this.


Solution

  • The latest backup is always available to you by entering heroku pgbackups:url. So, set up a cron job or the equivalent that fetches that URL once a week or once a day.

    You could write a rake or Ruby script and call it with Heroku Scheduler (a free addon), or use a different remote machine to pull the backup, or do a shell script and:

    curl -O `heroku pgbackups:url`
    

    Here is a Gem that appears to do what you want: https://coderwall.com/p/w4wpvw