views:

838

answers:

4

I am attempting to deploy a RoR app using Passenger onto my DreamHost hosting account, but am having trouble getting it up and running.

My application requires two custom gems 'amazon-ecs' and 'nokogiri.' As per the instructions on the DreamHost wiki (http://wiki.dreamhost.com/Freezing%5FGems) I froze the gems to vendors by coding them into my config file (config.gem "nokogiri") and then used the rake gems:unpack command to build them into vendor.

I then froze the rails gems using rake rails:freeze:gems, and uploaded it to my subdomain.

The last seven lines of my backtrace go as follows:

0   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   336   in `abort'
1   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb  336  in `check_gem_dependencies'
2   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb  170  in `process'
3   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb  113  in `send'
4   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb  113  in `run'
5   ./config/environment.rb  9  
6   /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb  31  in `gem_original_require'
7   /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb  31  in `require'

My config file looks like this:

RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
config.gem "nokogiri"
config.gem "amazon-ecs"
config.time_zone = 'UTC'
end

Did I miss a step with the gems? Am I on the right track?

A: 

so /vendor/rails and /vendor/plugins/nokogiri and amazon-ecs exist and look alright to you? You could try again and this time specifying the exact version of the gem in your config like this

config.gem "nokogiri", :version => "1.0"

or if the gem is on Github

config.gem "tenderlove-nokogiri", :version => "1.0", :lib => "nokogiri", :source => "http://gems.github.com"

The backtrace doesn't look very helpfull, what is going on exactly? :-)

Bitterzoet
A: 

I got the same backtrace (on a Passenger error page) with an app I deployed recently. It turned out that it wasn't able to find one of the gems I was depending on (config.gem)... despite the fact that rake gems said it was there ([I] test-unit = 1.2.3).

Dreamhost support suggested that I try freezing/unpacking my gems. That probably would have worked (it didn't have a problem finding any of my other gems, which were frozen), but for some reason rake gems:unpack wasn't doing anything for me, so I ended up just commenting out that config.gem line since I didn't need it in production anyway, and that worked!

So if anyone else is getting this error, it strongly indicates that one of your gems isn't being found. Try commenting out your config.gem lines, one at a time until it starts working or giving a different error?

Tyler Rick
Gems that require native extensions can't be vendored / frozen. Set up your own local rubygems in your DH folder and change paths to use that instead. see my answer.
Brian Hogan
+3  A: 

Any gem that has native extensions can't be vendored with your app, and there's a good bet that on DH, config.gem won't work right either. You have to install your own rubygems and make your app use it. I recommend taking a look at this:

http://railstips.org/2008/11/24/rubygems-yours-mine-and-ours

It has great instructions for setting up your environment on DH. I just had to do this last week after a server upgrade, and it still applies.

Brian Hogan
A: 

I had an issue on DreamHost last week where my working Rails apps suddenly stopped working because of missing gems. I contacted support and here was their response:

It looks like some changes were made to your server and most of the system-installed rubygems were not reinstalled like they should have been. I manually installed the sqlite3 gem for you, but our admin who handles this will have to take a look at this to figure out why they weren't installed. If you have a couple more that you see not working I can look at potentially installing them as a stop gap in the mean time.

It's possible you're being affected by the same thing. Try contacting support to find out.

Martin Gordon