【问题标题】:Why does Capistrano 2 refuse to cap deploy:cold after cap deploy:setup was successfull?为什么 Capistrano 2 在 cap deploy:setup 成功后拒绝 cap deploy:cold?
【发布时间】:2010-12-23 16:40:56
【问题描述】:

我正在尝试使用 Capistrano (2.5.19) 部署 Rails3 应用程序。我已经成功运行了:

cap deploy:setup

并且在服务器上创建了正确的目录。但是当我运行 cap deploy:cold 或 cap deploy 时,脚本会挂到一半。

    shell$ cap deploy:cold
  * executing `deploy:cold'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "git ls-remote git@server.foo.com:test.git master"
  * executing "git clone -q git@server.foo.com:test.git /home/deployer/www/apps/test/releases/20101223162936 && cd /home/deployer/www/apps/test/releases/20101223162936 && git checkout -q -b deploy be3165b74d52540742873c125fb85d04e1ee3063 && git submodule -q init && git submodule -q sync && git submodule -q update && (echo be3165b74d52540742873c125fb85d04e1ee3063 > /home/deployer/www/apps/test/releases/20101223162936/REVISION)"
    servers: ["server.foo.com"]
    [server.foo.com] executing command

这是我的 deploy.rb:

$:.unshift(File.expand_path("~/.rvm/lib"))
    require 'rvm/capistrano'
    set :rvm_ruby_string, 'jruby'

    # main details
    set :application, "test_sqlserver"
    role :web, "server.foo.com"
    role :app, "server.foo.com"
    role :db,  "server.foo.com", :primary => true

    # server details
    default_run_options[:pty] = true
    ssh_options[:forward_agent] = true
    set :deploy_to, "/home/deployer/www/apps/#{application}"
    set :deploy_via, :checkout
    set :user, :deployer
    set :use_sudo, false

    # repo details
    set :scm, :git
    set :repository, "git@server.foo.com:test.git"
    set :branch, "master"
    set :git_enable_submodules, 1

我相信我的文件权限设置正确

【问题讨论】:

    标签: deployment capistrano


    【解决方案1】:

    至少从 1.6.5 开始,JRuby 中似乎存在一个错误——请参阅 SSH Agent forwarding does not work with jRuby (which lets capistrano ssh-deployments fail)

    显然,一种“解决方法”是不使用 SSH 代理转发,尽管这可能是不可接受的。如果您希望更快地发现并解决问题(我知道我愿意),查看问题可能会有所帮助。

    【讨论】:

    • 再回头看看引用的问题,看来这将在 JRuby 1.7 中修复。
    【解决方案2】:

    看起来你不能在 jruby 下运行 Capistrano,因为 jruby-openssl 不支持 Capistrano 基础的 Net:SSH

    http://jruby-extras.rubyforge.org/jruby-openssl/

    【讨论】:

    • 那么cap deploy:setup(和cap deploy:check)不会因为同样的原因而失败吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-22
    • 1970-01-01
    • 1970-01-01
    • 2012-03-15
    • 2015-12-06
    • 2014-01-16
    相关资源
    最近更新 更多