In this post I will show, how you can easily getting started to deploy your Ruby on Rails project in Heroku. Heroku is free cloud platform as service (PaaS), and they bet to easily project deployment service.

This guide is helpful only for those who are trying Heroku at first time! We will skip Active Record begin on this project, when we could better only test Heroku for Rails.

If you are not yet registered to Heroku, do it now:
https://id.heroku.com/signup.

I was using Ruby 1.9.3p484 and Rails 4.0.0 on Ubuntu 13.10 64-bit.

1. Create new Rails project

And generate welcome controller with index action:

$ rails new hello-heroku --skip-active-record
$ cd hello-heroku
$ rails g controller welcome index

Add to root routing from config/routes.rb:

$ nano config/routes.rb

Uncomment next line:

root 'welcome#index'

Heroku require that you modify little bit your project /bin files (bundle, rails, rake) shebang.
Change:

#!/usr/bin/env ruby1.9.1

to

#!/usr/bin/env ruby

1.1. Heroku Procfile

Create new Procfile on project root for Heroku:

$ nano Procfile

And write next code in file Procfile:

web: bundle exec rails server -p $PORT

1.2. Initialize Git

$ git init

Do first commit:

$ git add .
$ git commit -m "first commit"

2. Heroku

Is time to install heroku toolbelt:

$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

Login to Heroku:

$ heroku login

2.1. Create new Heroku app

$ heroku create

Push your project to Heroku:

$ git push heroku master

3. Test

Open your Heroku App to browser:

$ heroku open

If your browser opened page looks like next:

Welcome#index

Find me in app/views/welcome/index.html.erb

You are successfully deploy your Rails app in Heroku!

Source

https://toolbelt.heroku.com/
https://devcenter.heroku.com/articles/getting-started-with-rails4