Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4608986
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:55:21+00:00 2026-05-22T00:55:21+00:00

We use Heroku’s PG Backups which has been great http://addons.heroku.com/pgbackups I’m currently manually downloading

  • 0

We use Heroku’s PG Backups which has been great http://addons.heroku.com/pgbackups

I’m currently manually downloading the backups everyday to my computer and then uploading it to my S3 account. Does anyone know how to setup a cron job to automatically create a backup (daily is fine) and send it directly to my S3 account?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:55:22+00:00Added an answer on May 22, 2026 at 12:55 am

    If you add this to lib/tasks and have the cron addon running herkou will run this:

    namespace :heroku do
      desc "PostgreSQL database backups from Heroku to Amazon S3"
      task :backup => :environment do
        begin
          require 'right_aws'
          puts "[#{Time.now}] heroku:backup started"
          name = "#{ENV['APP_NAME']}-#{Time.now.strftime('%Y-%m-%d-%H%M%S')}.dump"
          db = ENV['DATABASE_URL'].match(/postgres:\/\/([^:]+):([^@]+)@([^\/]+)\/(.+)/)
          system "PGPASSWORD=#{db[2]} pg_dump -Fc -i --username=#{db[1]} --host=#{db[3]} #{db[4]} > tmp/#{name}"
          s3 = RightAws::S3.new(ENV['s3_access_key_id'], ENV['s3_secret_access_key'])
          bucket = s3.bucket("#{ENV['APP_NAME']}-heroku-backups", true, 'private')
          bucket.put(name, open("tmp/#{name}"))
          system "rm tmp/#{name}"
          puts "[#{Time.now}] heroku:backup complete"
        # rescue Exception => e
        #   require 'toadhopper'
        #   Toadhopper(ENV['hoptoad_key']).post!(e)
        end
      end
    end
    
    task :cron => :environment do
      Rake::Task['heroku:backup'].invoke
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use currently use Heroku for rails hosting which uses a Git repository for
I've read Heroku's documentation: http://devcenter.heroku.com/articles/custom-domains#wildcard_domains They say to add: To use with a custom
I used to use whurl.heroku.com to make http web requests and share the responses
I've try to use Heroku. I've a account which is name 'work'. $ heroku
I've been migrating some of my MySQL queries to PostgreSQL to use Heroku. Most
I have a Sinatra application running on Heroku which makes use of Dalli to
I'm studying how to use caching in Heroku for my Rails app. HTTP cache
What is a good .gitignore to use with Rails on Heroku? *.log *.sqlite3 what
use LWP::Simple; use Parallel::ForkManager; @links=( [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-windows.exe,SweetHome3D-2.1-windows.exe], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-macosx.dmg,SweetHome3D-2.1-macosx.dmg], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3DViewer-2.1.zip,SweetHome3DViewer-2.1.zip], ); # Max 30 processes for
I am trying to use Heroku and apparently Postgresql is a lot more strict

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.