Deploying a Hobo app to Heroku

December 28th, 2009

Hobo and Heroku make for a killer combination for getting your app built and deployed in record time.

These instructions are for Hobo 0.9.102. If you’re using an older version the steps may differ.

$ hobo myapp
$ cd myapp
$ git init
$ heroku create yourappname

Create a .gems file, since Hobo isn’t pre-installed on Heroku:

hobo --version 0.9.102

It is recommend to specify a particular version of any gem you use, in case a future release isn’t fully backwards compatible. (There’s no longer any need to specify will_paginate here.)

Next, create a .gitignore file:

log/*
db/*.sqlite3

Generate the database migrations:

$ script/generate hobo_migration

Choose [m] to migrate now and give it a name such as create users.

To generate the auto dryml files in app/views/taglibs/auto/, you’ll need to access the site once locally. Hobo cannot create these on Heroku because the filesystem is read-only. So run:

$ script/server

And open http://localhost:3000 in your browser.

You can then add all your files into the git repository, and push them to Heroku:

$ git add *
$ git add .gems
$ git add .gitignore
$ git commit -m "initial import" 
$ git push heroku master

It will take a couple of minutes to install the Hobo gem the first time you deploy, but subsequent deployments will be faster.

Next, run the database migration on Heroku:

$ heroku rake db:migrate

If you don’t see any error message, then you should be good to go:

$ heroku open

Common Problems

If you see the Rails “something went wrong” error, use heroku console to view the error log.

  • “relation “users” does not exist” – you probably forgot to run heroku rake db:migrate

3 Responses to “Deploying a Hobo app to Heroku”

  1. Chris Says:

    Great thanks!

  2. Paul Says:

    thanks for this Andy – I found this while trying to fix my previously working hobo/heroku installation.

    running through your steps now leads me to an app which doesn’t start … which looks increasingly like a heroku issue to me :(

    App failed to start

    You need to explicitly specify your Rails version on your Gemfile or .gems file.

    Read the docs on managing gems for more information. Original Error

    Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have install

  3. Andy Says:

    @Paul

    I haven’t tried it, but this may be the solution:

    http://groups.google.com/group/hobousers/browse_frm/thread/207a74f7864556f4

Leave a Reply