【问题标题】:Amazon AWS, cap deploy:check fails亚马逊 AWS,上限部署:检查失败
【发布时间】:2013-03-12 13:47:49
【问题描述】:

我正在尝试使用 capistrano 设置部署到 AWS EC2 实例。为了测试,我正在使用

cap testing deploy:check

但是 Capistrano 失败了:

    triggering load callbacks
  * 2013-03-12 15:41:27 executing `testing'
    triggering start callbacks for `deploy:check'
  * 2013-03-12 15:41:27 executing `multistage:ensure'
  * 2013-03-12 15:41:27 executing `deploy:check'
  * executing "test -d /......./releases"
    servers: ["ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com"]
    connection failed for: ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com
    (NoMethodError: undefined method `each' for "publickey":String)

我正在使用我的 .pem 文件进行连接,deploy.rb 脚本如下所示:

set :stages, %w(production testing)
set :default_stage, 'testing'
require 'capistrano/ext/multistage'

set :application, 'app_name'
set :user, 'the_user'
set :group, 'the_group'

set :scm, :git
set :repository,  "git@github.com:......./#{application}.git"
set :deploy_to, '/......./'
set :deploy_via, :remote_cache

# Authentication setup
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
ssh_options[:auth_methods] = 'publickey'
ssh_options[:keys] = ['~/........pem']

知道为什么会这样吗?

【问题讨论】:

    标签: ruby amazon-ec2 capistrano


    【解决方案1】:

    尝试将您的公钥放在服务器上。

    然后删除

    ssh_options[:auth_methods] = 'publickey'

    ssh_options[:keys] = ['~/........pem']

    它应该可以工作

    【讨论】:

      【解决方案2】:

      我最近升级了一个开发服务器并看到了相同的行为。错误消息看起来好像 Capistrano 期待一个可迭代的,并且 publicKey 的分配没有这样定义它。

      尽管听起来微不足道,但请尝试更改:

      ssh_options[:auth_methods] = 'publickey'
      ssh_options[:keys] = ['~/........pem']
      

      到:

      set :ssh_options, {:auth_methods => "publickey"}
      set :ssh_options, {:keys => ["~/......pem"]}
      

      您可能需要对身份验证设置中的其他项目执行相同操作。祝你好运。

      【讨论】:

        【解决方案3】:

        删除线

        ssh_options[:auth_methods] = 'publickey'
        

        【讨论】:

          猜你喜欢
          • 2016-09-29
          • 2014-04-10
          • 2012-03-30
          • 1970-01-01
          • 2017-01-10
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多