处于部署模式的捆绑器找不到宝石 [英] Bundler in deployment mode does not find Gems

查看:93
本文介绍了处于部署模式的捆绑器找不到宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的托管人迁移服务器时,我在Capistrano设置上苦苦挣扎:

I was heavily struggling with my Capistrano Setup, when my Hoster migrated the server:

迁移服务器后,Capistrano3部署失败

我遇到的一件事是捆绑器上的工作正常,现在看来是一团糟:

One thing I ran into that used to work just fine on the old machine and now seems to be a mess is bundler:

我可以通过Capistrano成功运行捆绑器:

I could successfully run bundler through Capistrano:

cap staging bundler:install

在服务器上的以下命令中

This resulted in the following command on the server

/usr/bin/env bundle install --binstubs \ 
/var/www/mydomain.com/subdomains/dev/shared/bin \
--path /var/www/mydomain.com/subdomains/dev/shared/bundle \
--without development test \
--deployment

但是现在我运行服务器 cap登台deploy:start_passenger 结果如下:

But now when I ran my server cap staging deploy:start_passenger which results in the following:

/usr/bin/env passenger start --socket tmp/passenger.socket -e staging -d

然后我在日志文件中看到错误,表明缺少Rake:

Then I got the error in my log file, that Rake was missing:

Could not find rake-10.2.2 in any of the sources (Bundler::GemNotFound)
<pre>  /var/www/mydomain.com/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/spec_set.rb:92:in `block in materialize&#39;

非常奇怪的是,红宝石版本 2.1.2 (我真正使用的那个)显示为 2.1.0。我的项目中没有可见的对 2.1.0`的引用,并且我的Gemfile包含:

What is very weird, is the fact that the ruby version 2.1.2(the one I really use) shows up with 2.1.0. I have no visible reference to2.1.0` in my project, and my Gemfile contains:

ruby '2.1.2'

由于在服务器上使用了RBENV,所以我可以运行 rbenv版本:

Since RBENV is used on the server I can run rbenv versions which shows me:

  system
* 2.1.2 (set by /var/www/mydomain.com/.rbenv/version)

那奇怪的地方 2.1.0 的来源以及如何确保我的服务器具有它所需的所有依赖项。

So where does that weird 2.1.0 come from and how can I make sure that my server has all the dependencies it requires.

推荐答案

我终于设法在新服务器上部署了我的应用程序。

I finally managed to deploy my application on the new server.

执行这些步骤是必需的。但是,由于我与之作战了几个小时,所以其中有些可能是多余的:

These steps were required to do it. However since I fought with it for a few hours some of it might be redundant:


  • gem install bundler& & rbenv rehash :这是必需的,因为 bundler 是我需要在Rails App上下文中外部的宝石之一

  • 另一个是 gem install passenger&& rbenv rehash

  • 我现在正在使用 https:/ /github.com/capistrano/rbenv ,但是为此我不得不从系统中删除RVM,这是我不太热衷的步骤。

  • 我必须确保已创建当前符号链接,因此将其添加到 deploy.rb

  • gem install bundler && rbenv rehash: This is required since bundler is one of the gems that I need outside of the Rails App context in terms of dependencies.
  • Another one is gem install passenger && rbenv rehash
  • I am now using https://github.com/capistrano/rbenv but for this I had to wipe RVM from my system, which was a step I wasn't too enthusiastic of doing.
  • I had to make sure the current symlink was created so I added this to the deploy.rb

after 'deploy:set_current_revision', 'deploy:symlink:release'


  • 我不得不删除一些共享目录:

  • I had to delete some of the shared directories:

    rm -fr bin
    rm -fr shared/bundle/
    rm -fr bundle
    


  • 这篇关于处于部署模式的捆绑器找不到宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆