main icon indicating copy to clipboard operation
main copied to clipboard

Change database setup on heroku

Open rabble opened this issue 7 years ago • 8 comments

Currently we've got the same database being used by staging and production. That's a terrible idea, the staging one should be a mirror / backup of production, but NOT the exact same database.

We also should setup regular backups of the database.

And remove Harpo's zipcode records since that's costing us $30 a month.

rabble avatar May 10 '17 21:05 rabble

Hey, I don’t have permissions to create new paid resources.

What we need to do is create a new database in production, or detach the staging database and use it only in production (I don’t know if this is possible tho).

Once the new database is created I can take it from there.

This will be the following steps:

To copy the original to the new one: heroku pg:copy ORIGINAL_DB_NAME NEW_DB_NAME --app advocacycommons

Then update the env variable of the production environment database to use the new database.

To copy the production database to the staging one: heroku pg:copy advocacycommons::DB_NAME STAGING_DB_NAME --app staging-advocacycommons

REFERENCE: https://devcenter.heroku.com/articles/heroku-postgres-backups#direct-database-to-database-copies

agustinrhcp avatar May 17 '17 15:05 agustinrhcp

I have admin access and can do this. @rabble, assign to me if you want me to go ahead.

harpojaeger avatar May 17 '17 16:05 harpojaeger

go for it @harpojaeger

rabble avatar May 17 '17 16:05 rabble

Re: the zipcodes thing, I'm assuming it's fine to just drop that table altogether?

harpojaeger avatar May 17 '17 17:05 harpojaeger

Bugger, it turns out it won't let me add paid add-ons. @rabble if you can provision a new DB on production we'll hand this back to @agustinrhcp. I already dropped the ZIP table and ran a full DB backup on staging.

harpojaeger avatar May 17 '17 17:05 harpojaeger

I set up staging DB daily backups too and can do the same for production once it's created.

harpojaeger avatar May 17 '17 17:05 harpojaeger

I'm taking this ticket out of the current sprint and putting it back into backlog. two reasons: We haven't touched it in two weeks, so it's clearly not that critical, and more importantly we should probably just get rid of staging entirely.

Matt-Holland avatar May 31 '17 23:05 Matt-Holland

@rabble let's make a firm decision: shall we drop "Staging", or not?

Matt-Holland avatar Sep 20 '17 22:09 Matt-Holland