Setting up a Rails project with Heroku, Eclipse and Domains

I always forget the single steps to create a new rails application that has a staging & production environment, can be deployed to Heroku and has the nameservers properly configured. So here’s the outline (so you and I never forget it):

1) Create Application

rails new $APP
cd $APP

2) Create Eclipse ./.project file

<?xml version="1.0" encoding="UTF-8"?>

3) Update Gemfile

source ''

gem 'rails'
gem 'jquery-rails'
gem "jquery-ui-rails"
gem "anjlab-bootstrap-rails", "~>", :require => "bootstrap-rails"

group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'uglifier'

group :development do
  gem 'sqlite3'

group :production, :staging do
  gem "pg"
  gem "therubyracer"

gem "devise", ">= 2.1.2"
gem "cancan", ">= 1.6.8"
gem "rolify", ">= 3.1.0"

4) Install Bundle

bundle install --without production staging

5) Clean Up

rm ./README.rdoc
rm ./public/index.html
rm ./public/favicon.ico
rm ./app/assets/images/rails.png

6) Create Root Controller

rails generate controller root index

7) Update Routes

root :to => 'root#index'

8) Create Git Repository & Init

git init
git remote add origin $URL

9) Overwrite ./.gitignore


10) Commit

git add .
git commit -a -m "Initial Commit"
git push origin master

11) Create Heroku Endpoints & Push to Heroku

heroku create $APP-staging --remote staging
heroku create $APP --remote production
git push staging master
git push production master

12) Prepare Heroku Domain

heroku domains:add --app $APP www.$

13) Setup your Domain

  • Domain Forward to http://$
  • NameServer Settings: www.$ CNAME $

A) References

Leave a Reply