0

我正在使用 Capistrano v2.13.4 进行部署。

之前的 Capistrano 任务 ( deploy:special_treats)deploy:finalize_update未执行。

该任务deploy:special_treats为 做一些准备(设置互联网访问)bundle:install,否则bundle:install将无法访问互联网 ([out :: servername] Could not reach https://rubygems.org/

config/deploy.rb

before 'deploy:finalize_update', 'deploy:special_treats'

namespace :deploy do
  task :special_treats do
    run "echo 'something special treats: setup the Internet access'"
  end
end

结果为cap deploy:update

$ cap deploy:update
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "svn info https://svnlinks --username username --password password --no-auth-cache  -rHEAD"
    command finished in 10336ms
  * getting (via export) revision 33268 to /tmp/20120927171608
    executing locally: svn export -q --username username --password password --no-auth-cache  -r33268 https://svnlinks /tmp/20120927171608
    command finished in 79314ms
  * processing exclusions...
  * Compressing /tmp/20120927171608 to /tmp/20120927171608.tar.gz
    executing locally: tar czf 20120927171608.tar.gz 20120927171608
    command finished in 1401ms
    servers: ["servername"]
 ** sftp upload /tmp/20120927171608.tar.gz -> /tmp/20120927171608.tar.gz
    [servername] /tmp/20120927171608.tar.gz
    [servername] done
  * sftp upload complete
  * executing "cd /usr/website/rr/releases && tar xzf /tmp/20120927171608.tar.gz && rm /tmp/20120927171608.tar.gz"
    servers: ["servername"]
    [servername] executing command
    command finished in 774ms
  * executing `deploy:finalize_update'
    triggering before callbacks for `deploy:finalize_update'
  * executing `bundle:install'
  * executing "cd /usr/website/rr/releases/20120927171608 && bundle install --gemfile /usr/website/rr/releases/20120927171608/Gemfile --path /usr/website/rr/shared/bundle --deployment --quiet --without development 

test"
    servers: ["servername"]
    [servername] executing command
 ** [out :: servername] Could not reach https://rubygems.org/
    command finished in 1403ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /usr/website/rr/releases/20120927171608; true"
    servers: ["servername"]
    [servername] executing command
    command finished in 344ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.3-p194' -c 'cd /usr/website/rr/releases/20120927171608 && bundle install --gemfile /usr/website/rr/releases/20120927171608/Gemfile --path 

/usr/website/rr/shared/bundle --deployment --quiet --without development test'" on servername
4

1 回答 1

0

我只是遇到了同样的问题,但在after deploy:finalize_update触发器中。不同的是我的脚本在另一台机器上工作了很长时间。

我没有将 capistrano 锁定为 中的 gem Gemfile,所以我尝试恢复到相同版本的工作机器,2.6.0但这并没有解决它。

经过一些研究和几次试验,我在 github 项目中发现了一些问题,导致了这种情况但看起来人们无法完全重现它。

然后我前往文档并浏览我发现 Capistrano 的行为受到了0.9.x与命名空间冲突有关的 rake 版本的最新更改的影响,正如您在部署时可以找到的简短注释中看到的那样:Capistrano 任务 wiki 页面的 create_symlink 部分

我没有时间修复脚本以使用 rake 和 capistrano 的最新版本,但通过将 rake 恢复为 version ,我能够让它在另一台机器上重新工作0.8.7

我希望这可以让您继续前进并为解决方案提供一些线索。

于 2012-09-28T06:11:27.103 回答