Capistrano部署:更新失败,但设置和检查工作

时间:2012-03-30 19:52:10

标签: ruby-on-rails deployment capistrano

我是新手,如果这是一个愚蠢的问题,请道歉,但任何人都可以帮我解读这个部署错误吗?我终于设法得到'cap deploy:setup'和'cap deploy:check'来运行而没有错误。现在,我陷入'cap deploy:update'。从错误输出来看,我的部署文件看起来有问题,但我不知道问题可能是什么。 shell输出和部署文件如下。非常感谢任何帮助!

一些背景:我正在部署到正在运行乘客的朋友的服务器上。我们使用的是ruby 1.9.2-p290,rails 3.1.3,capistrano 2.11.2和MacOS 10.6。

以下是部署错误输出的示例:

my-MacBook-Pro:projectfolder myuser$ cap deploy:update
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote ssh://git@server.example.ca/usr/local/git_root/arbiterapi.git master"
*** [deploy:update_code] rolling back
  * executing "rm -rf /usr/local/www/sites/project.example.ca/releases/20120330191423; true"
    servers: ["project.example.ca"]
    [project.example.ca] executing command
    [project.example.ca] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.2-p290@project' -c 'rm -rf /usr/local/www/sites/project.example.ca/releases/20120330191423; true'
    command finished in 663ms
/Users/myuser/.rvm/gems/ruby-1.9.2-p290@project/gems/capistrano-2.11.2/lib/capistrano/recipes/deploy.rb:107:in ``': No such file or directory - git ls-remote ssh://git@server.example.ca/usr/local/git_root/project.git master (Errno::ENOENT)
    from /Users/myuser/.rvm/gems/ruby-1.9.2-p290@project/gems/capistrano-2.11.2/lib/capistrano/recipes/deploy.rb:107:in `block in run_locally'
    from /Users/myuser/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
    from /Users/myuser/.rvm/gems/ruby-1.9.2-p290@project/gems/capistrano-2.11.2/lib/capistrano/recipes/deploy.rb:106:in `run_locally'
    from /Users/myuser/.rvm/gems/ruby-1.9.2-p290@project/gems/capistrano-2.11.2/lib/capistrano/recipes/deploy.rb:44:in `block (3 levels) in load'
    from /Users/myuser/.rvm/gems/ruby-1.9.2-p290@project/gems/capistrano-2.11.2/lib/capistrano/recipes/deploy.rb:96:in `with_env'
    from /Users/myuser/.rvm/gems/ruby-1.9.2-p290@project/gems/capistrano-2.11.2/lib/capistrano/recipes/deploy.rb:44:in `block (2 levels) in load'
    from /Users/myuser/.rvm/gems/ruby-1.9.2-p290@project/gems/capistrano-2.11.2/lib/capistrano/recipes/deploy/scm/git.rb:227:in `query_revision'
... etc.

其余的错误输出也指向capistrano文件夹。输出似乎太长,无法完整地包含在内。但如果可能有帮助,我可以提供其余的帮助!

这是部署文件:

$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano"                  # Load RVM's capistrano plugin.

set :application, "Project"

set :scm, "git"
set :repository,  "ssh://git@server.example.ca/usr/local/git_root/project.git"
set :user, "deploy"

#set :rvm_bin_path, "/usr/local/rvm/bin"
set :rvm_ruby_string, "ruby-1.9.2-p290@project"
set :normalize_asset_timestamps, false

ssh_options[:forward_agent] = false

set :branch, "master"

set :deploy_via, :remote_cache

set :deploy_to, "/usr/local/www/sites/project.example.ca/"

set :use_sudo, false

set :domain, 'project.example.ca'

role :app, domain
role :web, domain
role :db,  domain, :primary => true

1 个答案:

答案 0 :(得分:0)

错误是行

No such file or directory - git ls-remote ssh://git@server.example.ca/usr/local/git_root/project.git master (Errno::ENOENT)

因此在结账时失败了。为什么你有ssh前缀?指定用户(git@)时,您也不应该有协议 - 存储库应该只设置为

git@server.example.ca/usr/local/git_root/project.git

或该项目的git存储库的实际URL。

仅供参考 - deploy:setupdeploy:check实际上都没有检查代码,这就是为什么这两个工作的原因。