如何让 mongrel 与捆绑器一起工作?

发布于 2024-09-26 13:50:50 字数 588 浏览 2 评论 0原文

过渡到具有现有生产设置的捆绑器。天真地使用 gemfile 和设置,例如:

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

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

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

结果

/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)

开始做什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵情客 2024-10-03 13:50:50

回答我自己的问题,因为我在网络上的其他地方找不到针对这种情况的正确解决方案:

问题似乎是 bundlermongrel 使用的交互gem_plugin 的。是的,这些可能需要生命支持,但不幸的是很多人的生产配置仍然依赖于它们。

似乎从 git 源安装 mongrel --pre 后,它会在 bundle/ruby/1.9.1/gems/mongrel_ 而不是中查找bundle/ruby/1.9.1/bundler/gems/mongrel_ 这是 bundler 存储从 git 克隆的 gem 的地方。

因此,适用于我们的配置的解决方案就是对它们进行符号链接:

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: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'

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'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文