Deploying a Hobo Rails App on Heroku

June 11, 2010 by · 2 Comments 

In my previous post I created my first Hobo application.  I wanted to show off the fruits of the 5 minutes of hard labor to my partner, so I decided to push it to Heroku.  I ran into some problems because I’m using Rails 2.3.8, which Heroku hasn’t deployed for general use.  It is available on their bamboo stack.

After much fumbling and my inability to get the .gems file right (because of gem dependencies of Hobo) I decided to give Gem Bundler a try and it magically solved all my problems.

Here’s what I did…

Install Gem Bundler (gem install bundler).

Create a Gemfile with the following:

source :gemcutter
gem 'rails', '2.3.8'
gem 'hobo', '1.0.1'

Then to bundle your gems, run bundle install from your app directory.  When Gem Bundler is done crunching, the next thing to do is get it up to Heroku.  Since I needed to run this on their Bamboo stack, I had to create an app specifically for that stack.

First things first, add everything you need to your git repository (Heroku explains how to do this).

To create a Bamboo stack application, just run

heroku create --stack bamboo-ree-1.8.7 --remote appname

…then push your git up to Heroku…

git push appname master

…you’ll notice a lot of activity while Heroku installs gems.  Hobo is a pretty complete framework so it uses a ton of them.  Grab a snack while you wait.

Finally, just migrate your database…

heroku rake db:migrate --app heroku-app-name

Make sure you use the app name Heroku uses.

That’s it!  I had my Hobo app running in just a few minutes.  If you’re using a Rails version that doesn’t require the Bamboo stack, it should be even easier using the normal Heroku deployment tricks.  I’m glad to see Gem Bundler will be the default gem management tool for Rails 3.  It definitely made my life a lot easier.

About dave@kiwiluv.com

Comments

2 Responses to “Deploying a Hobo Rails App on Heroku”
  1. Derrick says:

    How do u create a gem file for the above to work?

  2. Hi Derrick,

    You don’t need to create a gem file. Here are the basic steps.

    1. Install Gem Bundler with gem install bundler.
    2. Create a file named “Gemfile” at the root directory of your Rails app.
    3. Add to the Gemfile you just created a source “source :gemcutter” (quotes not included in the file).
    4. Add to the Gemfile you just created all of the gems your app requires in the format “gem ‘rails’, ’2.3.8′ ” Note that the double quotes don’t go into the file. You can probably find examples by googling.
    5. From the command line in the root directory of your app, invoke ‘bundle install’ and bundler will package up the Gem’s.

    Yehuda Katz has a much more detailed post. Gem Bundler will probably be the preferred way to manage gem dependencies in Rails 3, so we’d all better start learning how it works!

    http://yehudakatz.com/2009/11/03/using-the-new-gem-bundler-today/

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!