Rails 4 + Capistrano 3:部署:检查不工作

时间:2014-07-18 19:42:58

标签: ruby-on-rails capistrano

我可以成功SSH到我的服务器。但是,当我deploy:check时,它给了我这个:

Nets-Mac-Pro:mysite emai$ be cap staging deploy:check
INFO[e67f845c] Running /usr/bin/env mkdir -p /tmp/mysite-staging/ on mysite-staging.nettheory.com
DEBUG[e67f845c] Command: /usr/bin/env mkdir -p /tmp/mysite-staging/
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
Enter passphrase for /Users/emai/.ssh/id_rsa: 
Enter passphrase for /Users/emai/.ssh/id_rsa:         
Enter passphrase for /Users/emai/.ssh/id_rsa:
SSHKit::Runner::ExecuteError: Exception while executing on host mysite-staging.nettheory.com: Could not parse PKey: no start line
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/key_factory.rb:77:in `read'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/key_factory.rb:77:in `load_data_private_key'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/key_factory.rb:42:in `load_private_key'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:142:in `sign'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/methods/publickey.rb:62:in `authenticate_with'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/methods/publickey.rb:20:in `block in authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:122:in `block in each_identity'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:119:in `each'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:119:in `each_identity'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/methods/publickey.rb:19:in `authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/session.rb:79:in `block in authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/session.rb:66:in `each'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/session.rb:66:in `authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh.rb:206:in `start'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:179:in `with_ssh'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
ArgumentError: Could not parse PKey: no start line
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/key_factory.rb:77:in `read'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/key_factory.rb:77:in `load_data_private_key'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/key_factory.rb:42:in `load_private_key'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:142:in `sign'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/methods/publickey.rb:62:in `authenticate_with'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/methods/publickey.rb:20:in `block in authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:122:in `block in each_identity'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:119:in `each'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/key_manager.rb:119:in `each_identity'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/methods/publickey.rb:19:in `authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/session.rb:79:in `block in authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/session.rb:66:in `each'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh/authentication/session.rb:66:in `authenticate'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh.rb:206:in `start'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:179:in `with_ssh'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host mysite-staging.nettheory.com: Could not parse PKey: no start line>
Nets-Mac-Pro:mysite emai$ 

无论我打字什么都行不通,一切都在公开场合。我该如何解决这个问题?

这是我的deploy / staging.rb:

set :rails_env, 'staging'   
set :stage, :staging


role :app, %w{mysite-staging.nettheory.com}
role :web, %w{mysite-staging.nettheory.com}
role :db,  %w{mysite-staging.nettheory.com}
server 'mysite-staging.nettheory.com', user: 'nt_deployer', roles: %w{web app db}, primary: true

set :use_sudo, false
set :deploy_via, :copy

当我没有设置ssh_options时会发生以上情况。这是我设置时发生的事情:

set :ssh_options, {
    user: 'nt_deployer', # overrides user setting above
    keys: %w('/Users/emai/Downloads/ilook_ec2_07182014.pem'),
    forward_agent: true,
    auth_methods: %w(publickey)
    # password: 'please use keys'
  }


Nets-Mac-Pro:mysite emai$ be cap staging deploy:check
INFO[de1d1563] Running /usr/bin/env mkdir -p /tmp/mysite-staging/ on mysite-staging.nettheory.com
DEBUG[de1d1563] Command: /usr/bin/env mkdir -p /tmp/mysite-staging/
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host mysite-staging.nettheory.com: Authentication failed for user nt_deployer@mysite-staging.nettheory.com
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh.rb:219:in `start'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:179:in `with_ssh'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Net::SSH::AuthenticationFailed: Authentication failed for user nt_deployer@mysite-staging.nettheory.com
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/net-ssh-2.9.1/lib/net/ssh.rb:219:in `start'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:179:in `with_ssh'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/emai/.rvm/gems/ruby-2.0.0-p247@mysite/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'

0 个答案:

没有答案