2016-07-31 64 views
0

我正在設置Capistrano 3與一個新的服務器,所以我可以部署一個Rails應用程序,我目前卡住了。每當我運行任何cap production任務,出現這種情況:Capistrano:網絡不可達錯誤,但可以ssh到服務器

$ cap production deploy:setup 
cap aborted! 
Errno::ENETUNREACH: Network is unreachable - connect(2) for [IPv6addresshere]:22 

我花了幾個小時試圖弄清楚了這一點,我不知道發生了什麼事情。因爲我擁有授權的密鑰設置,所以我可以像使用同一用戶的Capistrano無需密碼一樣使用ssh。另外,從遠程服務器,我可以ssh [email protected]罰款,因爲我配置了部署密鑰。

有什麼建議嗎?

這裏是跟蹤:

/home/awatt/.rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:64:in `connect' 
/home/awatt/.rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:64:in `connect_internal' 
/home/awatt/.rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:139:in `connect' 
/home/awatt/.rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:636:in `block in tcp' 
/home/awatt/.rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:231:in `each' 
/home/awatt/.rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:231:in `foreach' 
/home/awatt/.rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:626:in `tcp' 
/home/awatt/.gem/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:70:in `initialize' 
/home/awatt/.gem/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `new' 
/home/awatt/.gem/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `start' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/connection_pool.rb:59:in `call' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/connection_pool.rb:59:in `with' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/netssh.rb:155:in `with_ssh' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/netssh.rb:108:in `execute_command' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:141:in `tap' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:55:in `test' 
/home/awatt/.gem/ruby/2.3.0/gems/capistrano-rbenv-2.0.4/lib/capistrano/tasks/rbenv.rake:10:in `block (3 levels) in <top (required)>' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:29:in `instance_exec' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:29:in `run' 
/home/awatt/.gem/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute' 
Tasks: TOP => rbenv:validate 
+1

你是否也在通過IPv6測試sshing? – Doon

+0

試試'ssh_options [:forward_agent] = true' –

+0

@Doon好點。我剛剛嘗試通過IPv6 ssh'ing,它不會工作。我如何強制Capistrano使用IPv4?奇怪的是,如果我將'ssh_options [:user]'從'deploy'(一個新的ish部署用戶)更改爲另一個用戶名,我不會收到這個錯誤 - 但我確實需要使用deploy用戶。同樣,普通的'ssh deploy @ myserver'在我的機器上工作。 @SeanHuber謝謝,我已經這麼做了。 – Alex

回答

0

我發現,我已經正確配置我的deploy.rb文件,但忽略了更新deploy/production.rb,其中有配置爲[email protected]用戶。因此,在主配置文件中運行部署步驟後,它會根據生產設置嘗試相同的步驟,並且無法獲得SSH連接。畢竟這是一件簡單的事情!感謝那些評論。

相關問題