Heroku Rails

Rails 4.1: deploying to Heroku

download the toolbelt kit:

$ wget -O- | sh


$ heroku login

create your app:

$ heroku apps:create [your app name]

or, if you already have an app in Heroku:

$ heroku git:remote -a ticketee-demo

Add the rails_12factor gem, to take care of the standard points a web app should cover. In your gemfile:

gem “rails_12factor”, group: :production

Also, in the same gemfile, to make sure you are using the same Ruby version as in development, add the following line (right under the “source” first line):

source ''
ruby "2.2.1"

Also, to specify a better production server (than the redbrick default), add the following line at the bottom of your gemfile:

gem "puma", group: :production

If you are going to use the Puma server in production, in Heroku, you will also need to add a Procfile in your root folder, with the following content:

web: bundle exec puma -t 5:5 -p ${PORT:-3000}
  -e ${RACK_ENV:-development}

Then, just rebuild your gemfile.lock by running:

bundle install --without=production

And finally, to push to Heroku, checking your code, and push it:

$ git add .
$ git commit -am "setup heroku ruby version and server"
$ git push heroku master

Your code is now there, but you will also need to get the database ready and run all the needed migrations:

heroku run rake db:migrate

If you have any seed files for your db, this is also a good time to run it:

heroku run rake db:seed

If anything goes wrong, you can always see what is happening in the logs:

heroku logs