我正在尝试将我的设置升级到v3,并且遇到了一个我无法调试的问题。我使用vagrant为我的小应用程序测试暂存环境。这是我的config/deploy/staging.rb
文件的样子:
set :user, "vagrant"
set :stage, :staging
set :ssh_options, {
keys: %w(~/.vagrant.d/insecure_private_key),
forward_agent: true
}
role :all, "192.168.33.101", primary: true
set :domain_name, "domain.local"
这是我的deploy:setup
测试命令:
namespace :deploy do
desc 'Setup the application (NO-OP Hook)'
task :setup do
on roles(:app) do
execute :echo, :uptime
end
end
end
尝试做任何事情时,即使只是获得uptime
,这也是我得到的错误:
$ cap staging deploy:setup --trace
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy:setup (first_time)
** Execute deploy:setup
INFO [5cf8fd6d] Running /usr/bin/env echo uptime on 192.168.33.101
cap aborted!
Net::SSH::AuthenticationFailed
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh.rb:215:in `start'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:156:in `ssh'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:109:in `block in _execute'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:106:in `tap'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:106:in `_execute'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:54:in `execute'
/Users/mbridges/code/github.com/mattdbridges/cornerstone/config/deploy.rb:24:in `block (3 levels) in <top (required)>'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `run'
/Users/mbridges/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/sshkit-1.0.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:setup
我可以在升级之前进行身份验证。有什么想法吗?
答案 0 :(得分:3)
事实证明,它与Vagrant IP地址和端口配置有关。
一个简单的改变
# Old
role :all, "192.168.33.101", primary: true
# New
server "vagrant@localhost:2222", roles: %w[web app db], primary: true
这解决了这个问题,至少对我而言。