Sunday, March 7, 2010

Rails 3: Heroku

Last week I was pleased to discover that Heroku now supports the rails 3 beta. To use it you have to switch the application stack. The main Heroku stack (Argent Aspen) runs ruby 1.8.6 which does not work with Rails 3. Heroku enabled a new stack (Badious Bamboo) which runs either Ruby Enterprise Edition 1.8.7  or MRI 1.9.1 which both support Rails 3. 


To get your Rails 3 app running on Heroku you need switch to your stack by following the Heroku stacks documentation. After you have the correct stack set up you need to make sure you have all of your gems set up in your Gemfile. I ran into issues because I use SQLite during development and I didn't have the required pg gem set up in my Gemfile.


That is all there is to getting up and running. I tried out a few of the add-ons, none of them seemed to break my app, but they did not all work quite right. The New Relic add-on reported on deployments but it still has not registered a single request. 

Update: Rails 3 beta2 breaks on heroku when the New Relic add-on is added.

6 comments:

Unknown said...

How did you define the pg gem in your Gemfile? Did you install any pg files locally?

When I push my code via rake, its complaining that I don't have the postgresql driver installed. And if I gem install it, it wants the postgresql software installed on my dev system. Did you end up installing all of postgresql to get the gem installed?

Thanks for the help. I've been fighting this for days.

Unknown said...

I ended up installing postgres on my development box. I spent a bit of time trying to play around with only loading the pg gem in the production environment but I haven't figured out how to get that to work yet.

Nicholas Henry said...

@nathan

You can specify gems to be used in production only in the Gemfile:

gem "pg", :group => :production

or for multiple gems:

group :production do
gem "pg"
# ... add more gems here
end

is that what you tried?

Unknown said...

@nicholas

Yes, I did try that. It still tries to install the gem when you run bundle install. Also the rake system seems to load enough of the environment that it needs all of the database drivers to be installed.

Unknown said...

What you want to use with bundler on your dev box is:

bundle install --without production

Then if pg is only used on Heroku it won't try install it on your dev machine

Anonymous said...

The First Casino Review (2021) - Casinoworld.com
We take a dafabet look at what casinos do and can't-buy fun88 soikeotot online slots at a 퍼스트카지노 and we'll have the same information as our casinos before us!