如何让杂种与捆绑商合作? [英] How to get mongrel working with bundler?
问题描述
gemrails,2.3.8
gemmongrel ,git:http://github.com/dynamix/mongrel.git
bundle install --path / mnt / app / shared / bundle
从
开始 bundle exec mongrel_rails start - 环境=生产...
结果
/mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:166:in`require':
无此类文件加载 - /mnt/services/shared/bundle/ruby/1.9.1/gems/mongrel-1.2.0.beta.1/lib/mongrel/init.rb(MissingSourceFile)
该怎么办?
这个问题似乎是一种交互 bundler
和 mongrel
使用 gem_plug在
。是的,这些可能是在生命支持,但不幸的是很多人的生产配置仍然依赖于他们。
看来,与 mongrel --pre <从
git
源码安装的code>,它正在查看 bundle / ruby / 1.9.1 / gems / mongrel _
而不是 bundle / ruby / 1.9.1 / bundler / gems / mongrel _
这是 bundler
存储宝石克隆自 git
。
因此,为我们的配置工作的解决方案只是符号化它们:
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
这显然是捆绑器可以自动执行的简单事情。完整的例外情况是:
/mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport- 2.3.8 / lib / active_support / dependencies.rb:166:在'require'中:
不需要加载这样的文件 - /mnt/app/shared/bundle/ruby/1.9.1/gems/mongrel-1.2 .0.beta.1 / lib / mongrel / init.rb(MissingSourceFile)$ / b / b / from /mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies .rb:166:在`require'
从/mnt/app/shared/bundle/ruby/1.9.1/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:134:in`block in load '从/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:241:'从'/usr/local/lib/ruby/site_ruby/1.9'每个'
'
.1 / rubygems / source_index.rb:241:在'each'中
来自/mnt/services/shared/bundle/ruby/1.9.1/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112 :`load'
来自/mnt/app/shared/bundle/ruby/1.9.1/bundler/gems/mongrel-f3e69eb8e6fb/lib/mongrel/configurator.rb:231:in`load_plugins'
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?
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:in `require'
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:in `each'
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:in `load'
from /mnt/app/shared/bundle/ruby/1.9.1/bundler/gems/mongrel-f3e69eb8e6fb/lib/mongrel/configurator.rb:231:in `load_plugins'
这篇关于如何让杂种与捆绑商合作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!