Skip to content

Instantly share code, notes, and snippets.

@tedi
Last active August 29, 2015 14:03
Show Gist options
  • Save tedi/634e98c7dd9f036d2a73 to your computer and use it in GitHub Desktop.
Save tedi/634e98c7dd9f036d2a73 to your computer and use it in GitHub Desktop.

###Deploying to Heroku (Heroku official instructions)

##Initial Heroku set-up

  • Sign up for Heroku
  • Download Heroku toolbelt
  • Log in to Heroku from terminal (execute command heroku login)

##Set up PostgreSQL

  • Replace the sqlite3 gem with pg in the gem file
  • Run bundle install
  • If you get a Postgres install error download postgresql as an app from postgresapp.com
  • Config the Rails database to use postgresql instead of sqlite. The database file can be found under config/database.yml
  • Change database names in the config file (name appropriately for each environment. ex: my_app_dev and my_app_prod)
  • Run rake db:create. This will create the database under the PostgreSQL install.
  • Run rake db:migrate.
  • If you have a seed file run rake db:seed

##Create Heroku instance and deploy

  • Create heroku instance (make sure this is a git inventory first). Run heroku create from the terminal. To confirm that this worked run git remote. This should return heroku as one of the destinations.

  • Push app to heroku. Run git push heroku master.

  • Once everything is pushed, you should be able to run heroku open from the terminal. This will run your live app from the browser.

  • If you run into any database errors from Heroku execute the following command from terminal: heroku run rake db:migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment