Fork me on GitHub
Subscribe to RSS Feed

Elijah Miller

24 Apr 2009

Deploy Your Rails Application in 2 Minutes with Heroku

Heroku, Instant Ruby Platform. We've been using Heroku's free service for hosting staging servers for a few weeks now. It takes just a moment to setup and it couldn't be any easier to use.

Today Heroku announced a pricing model and we should be using them for more than staging servers in the near future.

Start the clock

First timer? You'll need to do some minor setup. The middle command will ask you for your Heroku login/password and upload your SSH pubkey.

sudo gem install heroku
heroku keys:add
heroku create

Heroku installs gem dependencies for your app when you do a git push, so it needs to have a .gems file in an easy to parse format.

Run these commands to install a rake task for automatically generating a .gems file from your Rails gem dependencies. You'll need to rerun the rake task whenever you change your dependencies.

curl > lib/tasks/heroku.rake
rake heroku:gems
git add lib/tasks/heroku.rake .gems
git commit lib/tasks/heroku.rake .gems -m "Adding gem manifest for Heroku."

Here we go, push your app, migrate the database and open it in a web browser!

git push heroku master
heroku rake db:migrate
heroku open


Your application is up and running on Heroku's servers, 100% ready to use. Check out the next guide on setting up multiple environments with Heroku.


If the application had any trouble starting try the commands below to get a better view.

heroku logs     # view the application logs
heroku open     # some error messages show on the web