通过Capistrano(& rvm)进行部署时,捆绑安装错误 [英] Bundle install error when deploying via capistrano (& rvm)

查看:83
本文介绍了通过Capistrano(& rvm)进行部署时,捆绑安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我必须承认,就这个部署百灵鸟而言,我在黑暗中绊了一下。我会尽力解释情况;我已经建立了一个测试部署服务器,并尝试使用capistrano将应用程序部署到该服务器上,但是,由于宝石下面的错误,我在围绕宝石和它们的依存关系时遇到了一些困难。

Now I must admit that I'm stumbling around in the dark a little bit as far as this deployment lark is concerned. I'll try and explain the situation best I can; I have set up a test deployment server and am trying to deploy my app to it with capistrano, however, I am encountering some difficulties surrounding my gems and their dependencies, as the error below shoes.

[mike-test] executing command
[mike-test] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.3' -c 'cd /home/deploy/myapp/releases/20120910081544 && bundle install --gemfile /home/deploy/myapp/releases/20120910081544/Gemfile --path /home/depoy/myapp/shared/bundle --deployment --quiet --without development test'
 ** [out :: mike-test] Some gems seem to be missing from your vendor/cache directory.
 ** [out :: mike-test] Could not find log4r-1.1.10 in any of the sources
command finished in 9134ms
*** [deploy:update_code] rolling back

log4r 不在我的gemfile中,所以我只能假设它是另一个gem的依赖项(也许仅是生产?)。我不知道为什么捆扎机无法下载并安装gem?我将gem放入我的gemfile中,在本地安装捆绑软件,然后再次提交和部署,并得到了相同的错误,但这次有不同的gem(电子表格),因此看来只能解决这种情况下的错误,但是不会不能找出问题所在。

log4r isn't in my gemfile so I can only assume it's a (perhaps production only?) dependency of another gem. I don't know why bundler isn't downloading the gem and installing it if it can't find it? I put the gem in my gemfile, ran bundle install locally, and then committed and deployed again and got the same error but with a different gem this time (spreadsheet), so that appeared to solve the error in that case only, but doesn't identify the problem.

还有其他事情要弄混,我正在尝试在生产服务器上使用RVM,尽管阅读了很多,但我仍然没有100%确定我知道它是如何工作的,所以这可能是一个因素。

Something else to muddy the water, I'm trying to use RVM on the production server and despite reading a lot about it I'm still not 100% sure I get how it works, so that might be a factor.

我的 deploy.rb

require "bundler/capistrano"
require "rvm/capistrano"

# SCM Settings
set :rvm_ruby_string, '1.9.3' 
set :use_sudo, false

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

set :branch, :mikedev
set :deploy_via, :remote_cache
set :copy_cache, true
set :git_enable_submodules, 0
set :repository, "our_git_repo.git"
set :scm, :git
set :user, :deploy
set :keep_releases, 1

set :application, "myapp"
set :deploy_to, "/home/deploy/myapp"
set :branch, "mikedev"

role :web, "mike-test"                          
role :app, "mike-test"                          
role :db,  "mike-test", :primary => true      

namespace :deploy do

  desc "Restarting mod_rails with restart.txt"
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "touch #{current_path}/tmp/restart.txt"
  end

  [:start, :stop].each do |t|
    desc "#{t} task is a no-op with mod_rails"
    task t, :roles => :app do ; end
  end

end

任何指导将不胜感激。

推荐答案

捆绑安装-部署... 不会下载存在供应商/缓存的所有宝石。它将在那里寻找宝石。有两个选项:

bundle install --deployment ... will not download any gems if vendor/cache is present. It'll look for gems just there. There are two options:


  • 删除 vendor / cache 目录(即使该目录已经存在)空)

  • 或运行捆绑包并将所有新文件添加到供应商/缓存到您的VCS

  • remove vendor/cache directory (even if it's already empty) from your VCS
  • or run bundle package and add all new files under vendor/cache to your VCS

后者似乎是更好的选择。这样,您可以保护部署免受rubygems服务器中断的影响。

The latter seems to be better option. In this way you protect your deployment from outages of rubygems servers.

这篇关于通过Capistrano(& rvm)进行部署时,捆绑安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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