views:

38

answers:

1

Transitioning to bundler with an existing production setup. Naively with a gemfile and setup like:

gem "rails", "2.3.8"
gem "mongrel", git: "http://github.com/dynamix/mongrel.git"

bundle install --path /mnt/app/shared/bundle

Starting with

bundle exec mongrel_rails start --environment=production ...

results in

/mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:166:in `require': 
no such file to load -- /mnt/services/shared/bundle/ruby/1.9.1/gems/mongrel-1.2.0.beta.1/lib/mongrel/init.rb (MissingSourceFile)

What to do?

+1  A: 

To answer my own, since I couldn't find a correct solution elsewhere on the web for this scenario:

The problem seems to be an interaction of bundler and mongrel's use of the gem_plugin. Yes, these may be on life support but unfortunately lots of people's production configs still depend on them.

Seems that with mongrel --pre installed from the git source, it's looking in bundle/ruby/1.9.1/gems/mongrel_ instead of bundle/ruby/1.9.1/bundler/gems/mongrel_ which is where bundler is stashing the gem cloned from git.

So the solution that worked for our config is to just symlink them:

ln -s /mnt/app/shared/bundle/ruby/1.9.1/bundle/gems/mongrel* \
 /mnt/app/shared/bundle/ruby/1.9.1/gems/mongrel-1.2.0.beta.1

This is clearly something simple that bundler could do automatically. Full trace of the exception was:

/mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:166:in require': no such file to load -- /mnt/app/shared/bundle/ruby/1.9.1/gems/mongrel-1.2.0.beta.1/lib/mongrel/init.rb (MissingSourceFile) from /mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:166:inrequire' from /mnt/app/shared/bundle/ruby/1.9.1/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:134:in block in load' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:241:ineach' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:241:in each' from /mnt/services/shared/bundle/ruby/1.9.1/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112:inload' from /mnt/app/shared/bundle/ruby/1.9.1/bundler/gems/mongrel-f3e69eb8e6fb/lib/mongrel/configurator.rb:231:in `load_plugins'

tribalvibes