Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade Heroku Postgres DB plan

I'm sorry if this is a dumb question, I'm new to Heroku hosting and was hoping one of the experts on StackOverflow could help me.

I originally signed up for a basic free postgres DB for my heroku app, but recently I've hit the 10K row limit and would like to upgrade to the $9/month plan. However, I have absolutely no idea how to do so.Is it a relatively simple process? I feel dumb for having to ask this question.

When I log into heroku and click on my app, I see a list of add-ons for my app. When I click on the Postgres add-on, it takes me to a separate webpage but I don't see any options for upgrading my DB plan.

Any tips?

Thanks!

like image 787
android_student Avatar asked Mar 19 '13 16:03

android_student


People also ask

How do I upgrade my heroku tier?

You can upgrade your Heroku Postgres or Heroku Data for Redis plans by running the heroku addons:upgrade command. For more details, see Changing the Plan or Infrastructure of a Heroku Postgres Database and Upgrading a Heroku Data for Redis Plan.

When using the PG upgrade to upgrade to version 13 how much app downtime is required?

If no --version flag is set, the upgrade will default to 14. Performing a pg:upgrade requires app downtime on the order of 30 minutes.

Is PostgreSQL free on Heroku?

Heroku offers a free plan for hosting PostgreSQL databases. This can be handy if you're getting started with a new project or "just quickly need a hosted database" for experimentation or prototyping.


3 Answers

In pratical ways you can do this to upgrade your postgres database plan:

  1. heroku config

    // It will show current database URL
    HEROKU_POSTGRESQL_COPPER_URL: postgres://xxxddxxdx:[email protected]:5432/xdfdsxdxxxx
    HEROKU_POSTGRESQL_SILVER_URL: postgres://fasdfsad:[email protected]:5432/sdfasdfdasfds
    
    // Default database set
    DATABASE_URL:  postgres://fasdfsad:[email protected]:5432/dsfsdf
    
  2. Create a new database heroku addons:create heroku-postgresql:hobby-basic (but I recommend that you go in server resource section and click Edit Addon and add pgsql and change plan from Free to your required plan)

  3. Run these commands to prevent database updates: heroku maintenance:on and heroku ps:scale worker=0

  4. Copy current db to new db: heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_COPPER_URL --app prod-test

    Note:

    DATABASE_URL = It is config veriable which point default current db
    HEROKU_POSTGRESQL_COPPER_URL = This is config variable for which db I just created
    prod-test = It is my APP name
    
  5. Promote new database (Make new db as default db) heroku pg:promote HEROKU_POSTGRESQL_COPPER_URL

  6. Re-enable worker/dynos heroku ps:scale worker=1 and heroku maintenance:off

  7. remove old database heroku addons:remove HEROKU_POSTGRESQL_SILVER_URL

like image 81
Dhiraj Avatar answered Oct 15 '22 07:10

Dhiraj


There is a document on Heroku's site for doing exactly this: Upgrade Heroku postgres with pgbackups.

In short, the steps are as follows:

  • setup a new new basic database
  • Prevent updates (set maintence mode on)
  • Capture your backup
  • Restore the backup to the new database
  • promote your new database
  • make your app active

These are also the same steps to follow if you decide to go to a production plan.

like image 38
Robert H Avatar answered Oct 15 '22 08:10

Robert H


It's a straight forward process. They have an article just for that here.

like image 30
davidrac Avatar answered Oct 15 '22 09:10

davidrac