按照本教程,尝试将rails应用程序部署到数字海洋:
但一直收到错误: 帽子流产! SSHKit :: Runner :: ExecuteError:在主机xxx.xx.xx.xx上执行时发生异常:远程主机关闭连接。在过去的四个小时里一直需要帮助
>> cap production deploy:initial --trace
1 ↵
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_rails_env
** Invoke rvm:hook (first_time)
** Execute rvm:hook
DEBUG [5976e045] Running /usr/bin/env [ -d ~/.rvm ] on xxx.xx.xx.xxx
DEBUG [5976e045] Command: [ -d ~/.rvm ]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xx.xx.xx: connection closed by remote host
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Net::SSH::Disconnect: connection closed by remote host
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:50:in `rescue in block (2 levels) in negotiate!'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:46:in `block (2 levels) in negotiate!'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `loop'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `block in negotiate!'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `loop'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `negotiate!'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:32:in `initialize'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `new'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `block in initialize'
/Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
/Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:125:in `timeout'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `initialize'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `new'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `start'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:187:in `with_ssh'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:137:in `block in _execute'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:62:in `test'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:21:in `block (3 levels) in <top (required)>'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
EOFError: end of file reached
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:47:in `readpartial'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:47:in `block (2 levels) in negotiate!'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `loop'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `block in negotiate!'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `loop'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `negotiate!'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:32:in `initialize'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `new'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `block in initialize'
/Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
/Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:125:in `timeout'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `initialize'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `new'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `start'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:187:in `with_ssh'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:137:in `block in _execute'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:62:in `test'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:21:in `block (3 levels) in <top (required)>'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/andela/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => rvm:hook
答案 0 :(得分:1)
我最近遇到了同样的问题,我认为教程中有一个错误。
这是我改变的。
set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa) }
我从.pub
删除了id_rsa
。现在我可以使用Digital ocean的教程进行部署。
答案 1 :(得分:0)
我猜你必须从服务器生成ssh-key并将密钥复制到你的GitHub。