Question

I'm maintaining an ancient RoR site that we're in the process of rewriting in Django. The site was written by someone else when Rails was in its infancy, and no one kept it updated until I got to it. A night or two ago, the server went down, I suspect due to a MySQL update. In the process of trying to fix it, we broke it, and now mongrel won't start. I see this in the mongrel log:

/home/USER/rails/SITE/config/boot.rb:26:Warning: Gem::SourcUSERdex#search support for String patterns is deprecated, use #find_name
/usr/local/lib/site_ruby/1.8/rubygems.rb:812:in `report_activate_error': RubyGem version error: rails(1.2.3 not >= 3.0) (Gem::LoadError)
    from /usr/local/lib/site_ruby/1.8/rubygems.rb:223:in `activate'
    from /usr/local/lib/site_ruby/1.8/rubygems.rb:258:in `activate'
    from /usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `each'
    from /usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `activate'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:33:in `require'
    from /home/USER/rails/SITE/config/environment.rb:24
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `call'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `listener'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `call'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `initialize'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
    from /usr/local/bin/mongrel_rails:19:in `load'
    from /usr/local/bin/mongrel_rails:19

I searched around and have tried to diagnose the error. It looks like mongrel wants us to have rails 3+ which isn't possible because we're going to be replacing the site in just a few weeks and don't want to bother bringing it up to date (it just needs to work for now). How can I force mongrel to run with the current version of rails?

In config/environment.rb, we have RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION which I thought would force Rails 1.2.3. Also, here's the output of gem list:

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.2.2, 3.0.3, 1.3.3)
actionpack (3.2.2, 3.0.3, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activemodel (3.2.2, 3.0.3)
activerecord (3.2.2, 3.0.3, 1.15.6, 1.15.3)
activeresource (3.2.2, 3.0.3)
activesupport (3.2.2, 3.0.3, 1.4.4, 1.4.2)
acts_as_ferret (0.5.3, 0.4.3)
arel (3.0.2, 2.0.7)
builder (3.0.0, 2.1.2)
bundler (1.1.0, 1.0.9)
cgi_multipart_eof_fix (2.5.0)
daemons (1.1.8, 1.1.0)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
ferret (0.11.6)
gem_plugin (0.2.3)
hike (1.2.1)
i18n (0.6.0, 0.5.0)
jk-ferret (0.11.8.3, 0.11.8.2)
journey (1.0.3)
json (1.6.5)
mail (2.4.3, 2.2.15)
mime-types (1.17.2, 1.16)
mongrel (1.1.5)
multi_json (1.1.0)
polyglot (0.3.3, 0.3.1)
rack (1.4.1, 1.2.1)
rack-cache (1.2)
rack-mount (0.8.3, 0.6.13)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (1.2.3)
railties (3.2.2, 3.0.3)
rake (0.9.2.2, 0.8.7)
rdoc (3.12)
sprockets (2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10, 1.4.9)
tzinfo (0.3.32, 0.3.24)

Thanks for any and all help!


OK, I figured it out. It was incompatible gem(s). Luckily, we have a test server and a production server. We only messed with the test server last night (mongrel on the production server was working), so I did gem list on both servers, and it turned out the test server had quite a different list. I just installed and uninstalled gems on the test server until gem list produced identical lists on both servers.

Was it helpful?

Solution

Mongrel does require the latest rails version available, but your apps require rails 1.2.3, so there is a conflict.

The easiest way to avoid gems conflicts is by using different gemsets (with rvm or rbenv). Or remove the rails 3 gem if it isn't used...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top