Skip to content

Instantly share code, notes, and snippets.

@QuintinAdam
Last active August 29, 2015 13:56
Show Gist options
  • Save QuintinAdam/8815794 to your computer and use it in GitHub Desktop.
Save QuintinAdam/8815794 to your computer and use it in GitHub Desktop.

#Heroku Setup

This information can be found in more detail here: https://devcenter.heroku.com/articles/getting-started-with-rails3#prerequisites

###Prerequisites

$ heroku login
# Login with your heroku email and password.
# If it asks "Would you like to generate one? [Yn]". Enter "y".

##Rails 3

###Setting up PostgreSQL

#####New Rails Project

  1. rails new myapp --database=postgresql

#####Excising Rails Project

  1. In your gemfile change gem 'sqlite3' to gem 'pg'.
  2. $ bundle install
  3. Change your config/database.yml to look something like this.
development:
  adapter: postgresql
  encoding: unicode
  database: myapp_development
  pool: 5
  username: myapp
  password:
test:
  adapter: postgresql
  encoding: unicode
  database: myapp_test
  pool: 5
  username: myapp
  password:
production:
  adapter: postgresql
  encoding: unicode
  database: myapp_production
  pool: 5
  username: myapp
  password:
  1. Switch the username and password.

###Setting Up Rails

  1. In your config/application.rb change this line of code.
config.assets.initialize_on_precompile = false
  1. In your gemfile add ruby '2.0.0' (This makes Heroku happy.)

###Setting Up Git

  1. Run.
$ git init
$ git add .
$ git commit -m "init"
  1. Create your heroku app. You can add a app name to the end of the command but it must be unique.
$ heroku create (optional name)
  1. Push your code to heroku
$ git push heroku master
  1. Visit your site and hope its not broken...
$ heroku open
  1. Run your migrations
$ heroku run rake db:migrate
  1. Restart Heroku
$ heroku restart

###Figaro SetUp:

If you are useing figaro you will need to run rake figaro:heroku to tell heroku about your secert vaiables.

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