Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku PGBackups add-ons: Why choose anything but the free one month retention option?

Tags:

heroku

I'm looking into database backup options for our Heroku rails app, and it looks like the free PGBackups add-ons would work well.

However, I'm confused by the options. They are:

Basic - 2 manual back-ups
Plus - 7 manual back-ups
Auto One Week - 7 automatic daily and 2 manual
Auto One Month - 7 automatic daily, 5 automatic weekly, 10 manual

They're all free. I must be missing something here because I don't see why you'd choose any but the last option. Is there a downside that I'm missing? What are the pros and cons I'm supposed to be weighing here?

like image 427
Gabe Durazo Avatar asked Mar 29 '12 16:03

Gabe Durazo


People also ask

Where are heroku backups stored?

Snapshots are stored directly in AWS's S3 object store. Base backups and WAL files are pushed to' S3 through an application called WAL-E as soon as they are made available by Postgres. All databases managed by Heroku Postgres provide continuous protection by persisting snapshots, base backups and WAL files to S3.

How much data can I store on Heroku?

Maximum storage of 1GB for hobby-dev and 10GB for hobby-basic plans. Maximum of 20 connections. No in-memory cache: The lack of an in-memory cache limits performance, because the data can't be accessed on low-latency storage.

How do I restore a Heroku database backup?

As per Heroku's docs: In order for PG Backups to access and import your dump file you will need to upload it somewhere with an HTTP-accessible URL. Keep in mind the URL should be a downloadable link as in the mentioned question.

How secure is Heroku Postgres database?

Secure & compliantThe Heroku platform is built for security from the ground up in compliance with key ​industry standards​ for data protection. For apps in regulated industries, ​Heroku Shield Postgres​ delivers PCI and HIPAA compliance.


3 Answers

This add on is a bit of a misnomer. For starters, all databases on Heroku are backed up by Heroku and are restorable as part of their disaster recovery processes, so you don't really need to do your own backups at all to be honest, but better safe than sorry.

However, peace of mind is a good thing, and if you want your own SQL dumps of your database on a periodic basis then choosing one of these options is up to you. If you're paranoid, go for the last option. If you're just running a staging environment, choose the first, it's up to you.

Note that the PGBackups dumps go into their S3 buckets, so if you want your own copy you'll need to then download them from there.

For more information on what Heroku do out of the box, see here: https://devcenter.heroku.com/articles/heroku-postgres-documentation#continuous_protection

like image 190
Neil Middleton Avatar answered Oct 03 '22 23:10

Neil Middleton


If you have a dev or basic plan for Heroku Postgres, you cannot choose the auto- options. That's the point.

like image 26
Nikki Avatar answered Oct 04 '22 01:10

Nikki


This isn't necessarily an answer to the question, but here's what I do with my Heroku database backups and I thought anybody else that comes to this thread might find it useful.

Just choose the free pgbackups add-on and use a local cron task to dump and download the dump daily.

Here's my script that I have cron run:

#!/bin/bash
now=$(date +"%y%m%d_%H%M")
fn="/home/username/dumps/backup_$now.dump"
cd /home/username/app && heroku pgbackups:capture --expire
cd /home/username/app && heroku pgbackups:url | xargs wget -O $fn

The now variable is simply to append the date and time to the filename. fn is the file path.

The 3rd line:

cd /home/username/app && heroku pgbackups:capture --expire

changes to the Heroku app directory then runs the Heroku call to pgbackups to create a dump and also remove the oldest dump.

The 4th line:

cd /home/username/app && heroku pgbackups:url | xargs wget -O $fn

gets the temporary URL of the dump file and uses wget to download and rename the file to the file path that I set in line 2: fn.

This has worked really well for me, and I can rest assured that I have daily backups of my database. I will soon expand this to remove local backups that are older than 90 days.

like image 34
RebelOfBabylon Avatar answered Oct 04 '22 00:10

RebelOfBabylon