0

我正在尝试将我的设置升级到 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

在升级之前,我能够很好地进行身份验证。有任何想法吗?

4

1 回答 1

3

事实证明,它与 Vagrant IP 地址和端口配置有关。

一个简单的改变

# Old
role :all, "192.168.33.101", primary: true

# New
server "vagrant@localhost:2222", roles: %w[web app db], primary: true

这解决了问题,至少对我来说。

于 2013-10-16T18:16:16.127 回答