【问题标题】:Capistrano deployment error in rails applicationRails 应用程序中的 Capistrano 部署错误
【发布时间】:2019-09-17 05:49:42
【问题描述】:

我在我的 Rails 应用程序中进行上限生产部署时遇到此错误 我的 net-ssh 版本是 5.0.2 谁能帮我解决这个问题。 我的服务器是彪马

#<Thread:0x00007fe400cfb5e8@/Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    26: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
    25: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:29:in `run'
    24: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
    23: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:9:in `block (3 levels) in <top (required)>'
    22: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:64:in `capture'
    21: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:145:in `create_command_and_execute'
    20: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:145:in `tap'
    19: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:145:in `block in create_command_and_execute'
    18: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/netssh.rb:129:in `execute_command'
    17: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/netssh.rb:176:in `with_ssh'
    16: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/connection_pool.rb:59:in `with'
    15: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/connection_pool.rb:59:in `call'
    14: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh.rb:246:in `start'
    13: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:71:in `authenticate'
    12: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:71:in `each'
    11: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:85:in `block in authenticate'
    10: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/methods/publickey.rb:19:in `authenticate'
     9: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:119:in `each_identity'
     8: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:119:in `each'
     7: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:122:in `block in each_identity'
     6: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/methods/publickey.rb:20:in `block in authenticate'
     5: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/methods/publickey.rb:62:in `authenticate_with'
     4: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:142:in `sign'
     3: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/key_factory.rb:44:in `load_private_key'
     2: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/key_factory.rb:53:in `load_data_private_key'
     1: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/key_factory.rb:113:in `classify_key'
/Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/ed25519_loader.rb:21:in `raiseUnlessLoaded': OpenSSH keys only supported if ED25519 is available (NotImplementedError)
net-ssh requires the following gems for ed25519 support:
 * ed25519 (>= 1.2, < 2.0)
 * bcrypt_pbkdf (>= 1.0, < 2.0)
cap aborted!
NotImplementedError: OpenSSH keys only supported if ED25519 is available
net-ssh requires the following gems for ed25519 support:
 * ed25519 (>= 1.2, < 2.0)
 * bcrypt_pbkdf (>= 1.0, < 2.0)
See https://github.com/net-ssh/net-ssh/issues/565 for more information
Gem::LoadError : "ed25519 is not part of the bundle. Add it to your Gemfile."

【问题讨论】:

  • 首先检查 cap deploy:check 并修复错误
  • 你用的是mac还是linux哪个系统?
  • 我用的是mac但我的服务器是ubuntu
  • 您正在从本地 mac 终端触发此命令。对吗?
  • 是的,我是从我的本地 mac 机器上触发它

标签: ruby-on-rails ruby capistrano


【解决方案1】:

对我来说,只需在终端上执行

ssh-add

这奏效了。

【讨论】:

  • 这在我的 MacBook Pro Big Sur 上完美运行。谢谢。
【解决方案2】:

至少在 Mac OS 上,如果您在系统启动后不 ssh-add [yourkey] 会收到此错误。

【讨论】:

【解决方案3】:

我的工作解决方案:

宝石文件

  gem 'net-ssh', '>= 6.0.2'
  gem 'ed25519', '>= 1.2', '< 2.0'
  gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'

【讨论】:

    【解决方案4】:

    虽然您可以通过添加其他答案建议的 gem 来解决此错误,但您不一定需要这样做。

    另一种方法是遵循 Puppet 的 Bolt 工具的已知问题中给出的建议,特别是 this one

    万一该链接消失,解决方案是以 PEM 格式而不是 OpenSSH 生成 SSH 密钥。您可以通过在ssh-keygen 命令中添加一个额外选项来做到这一点:

    ssh-keygen -t rsa -m PEM
    

    我已经能够成功地使用这种技术来避免添加额外的宝石。

    【讨论】:

      【解决方案5】:

      将这些宝石添加到您的 Gemfile,

      gem 'rbnacl', '< 5.0', :require => false                                                                                                                                                                
      gem 'rbnacl-libsodium', :require => false                                                                                                                                                               
      gem 'bcrypt_pbkdf', '< 2.0', :require => false
      

      然后运行bundle install 并重试。

      【讨论】:

      • Thanx @Daniel ,添加后我收到错误: : expected 64-byte String, got 3 (SSHKit::Runner::ExecuteError)
      • @pujagarg net-ssh 的版本是多少?如果版本低于 5.1.0,请尝试在终端中运行 ssh-add 或运行 bundle update net-ssh
      • Thanx @Daniel,我的 net-ssh 版本是 5.0.2,所以我做了 ssh-add,即使没有添加这些 gem,它也能正常工作。
      • @pujagarg 请把 net-ssh 更新到 5.1 以上。
      【解决方案6】:

      这解决了我同样的问题

      ssh-agent -s  && ssh-add ~/.ssh/id_rsa
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-24
        • 1970-01-01
        • 2011-07-12
        • 1970-01-01
        • 2016-10-08
        • 1970-01-01
        相关资源
        最近更新 更多