帽子流产了! rvm:检查部署期间的中断(Cap3)

时间:2014-04-11 08:22:18

标签: ruby-on-rails rvm capistrano capistrano3 rvm-capistrano

通过Capistrano 3部署rails app(Rails -v 3.2.12)

$ bundle exec cap production deploy --trace

并面对以下内容:

** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke production (first_time)
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy (first_time)
** Invoke git:deploy (first_time)
** Execute git:deploy
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO [87d2f4bf] Running /usr/bin/env mkdir -p /tmp/project/ on 111.111.111.111
DEBUG [87d2f4bf] Command: /usr/bin/env mkdir -p /tmp/project/
cap aborted!
Net::SSH::AuthenticationFailed: user
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh.rb:215:in `start'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/connection_pool.rb:25:in `create_or_reuse_connection'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:126:in `block in _execute'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.1.0/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
The deploy has failed with an error: #<Net::SSH::AuthenticationFailed: user>
** Invoke deploy:failed (first_time)
** Execute deploy:failed

Capfile:

require 'capistrano/setup'
require 'capistrano/deploy'
#require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails'

注意:我评论了'capistrano / rvm'。当它取消注释时,我将面对以下输出:

** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
DEBUG [7410609e] Running /usr/local/rvm/bin/rvm version on 111.111.111.111
DEBUG [7410609e] Command: /usr/local/rvm/bin/rvm version
cap aborted!
Net::SSH::AuthenticationFailed: user

因此两个版本都以错误

结束

这是我的设置:

deploy.rb

set :repo_url, 'git@bitbucket.org:user/project.git'
set :application, 'project'
application = 'project'
set :rvm_type, :system
set :rvm_ruby_version, '2.0.0-p353'
set :deploy_to, '/var/www/apps/project'
set :user, 'user'
set :ssh_options, {
  #verbose: :debug,
  user: fetch(:user)
}

部署/ production.rb

server '111.111.111.111', user: 'user', roles: %w{web app db}, my_property: :my_value

set :ssh_options, { 
forward_agent: false,
}

那么,发生了什么?请帮忙

1 个答案:

答案 0 :(得分:0)

尝试在deploy / production.rb中提供更具体的设置,例如:

set :ssh_options, {
  user: 'user',
  keys:  [File.join(ENV["HOME"], ".ssh", "deploy_key")],
  forward_agent: false,
  paranoid: false,
  auth_methods: %w(publickey)
}