Capistrano Rails部署-身份验证错误

时间:2020-07-01 03:16:18

标签: ruby-on-rails ruby capistrano ubuntu-18.04 digital-ocean

我正在尝试将Rails应用程序部署到Digital Ocean Ruby on Rails小滴上。我以为一切都准备就绪,我只需要配置该应用程序即可。但这实际上就像是标准的Linux服务器。

我正在使用this guide来设置Droplet,但是必须进行一些调整才能使它们运行。运行cap production deploy时,出现以下错误消息:

#<Thread:0x0000555b2f0ec948@/home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    12: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
    11: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:31:in `run'
    10: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
     9: from /home/michael/.rvm/gems/ruby-2.6.5/gems/capistrano-passenger-0.2.0/lib/capistrano/tasks/passenger.cap:42:in `block (3 levels) in <top (required)>'
     8: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:61:in `test'
     7: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
     6: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:148:in `tap'
     5: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
     4: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/netssh.rb:130:in `execute_command'
     3: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/netssh.rb:177:in `with_ssh'
     2: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/connection_pool.rb:63:in `with'
     1: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/backends/connection_pool.rb:63:in `call'
/home/michael/.rvm/gems/ruby-2.6.5/gems/net-ssh-6.1.0/lib/net/ssh.rb:268:in `start': Authentication failed for user michael@178.128.223.202 (Net::SSH::AuthenticationFailed)
    1: from /home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/michael/.rvm/gems/ruby-2.6.5/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as michael@178.128.223.202: Authentication failed for user michael@178.128.223.202 (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as michael@178.128.223.202: Authentication failed for user michael@178.128.223.202


Caused by:
Net::SSH::AuthenticationFailed: Authentication failed for user michael@178.128.223.202

Tasks: TOP => rvm:hook => passenger:rvm:hook => passenger:test_which_passenger
(See full trace by running task with --trace)

这是我的deploy.rb文件:

# config valid for current version and patch releases of Capistrano
lock "~> 3.14.1"

set :application, "MyApp"
set :repo_url, "git@github.com:MyAccount/MyApp.git"

# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, "/home/michael/my-app/#{fetch :application}"

# Default value for linked_dirs is []
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system", "public/uploads", "vendor/bundle", ".bundle"

# Default value for keep_releases is 5
set :keep_releases, 5

还有deploy / production.rb文件:

server "123.456.789.123", user: "me", roles: %w{app db web}

  set :ssh_options, {
    config: false,
    keys: %w[/home/myhome/.ssh/id_ed25519],
    forward_agent: true,
    auth_methods: %w[publickey],
    user: 'me'
  }

这里的任何帮助都会很好。到目前为止,我看到的所有其他答案都没有为我解决问题(而且没有Tasks: TOP => rvm:hook => passenger:rvm:hook => passenger:test_which_passenger

0 个答案:

没有答案
相关问题