Amazon AWS, cap deploy:check fails

早过忘川 提交于 2019-12-12 02:22:49

问题


I'm trying to setup deployment to an AWS EC2 instance, using capistrano. In order to test, I'm using

cap testing deploy:check

but Capistrano fails with:

    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)

I'm using my .pem file to connect, and the deploy.rb script looks as follows:

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']

Any idea why this is happening?


回答1:


Try putting your public key on the server.

And remove

ssh_options[:auth_methods] = 'publickey'

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

It should work




回答2:


I recently upgraded a development server and saw the same behavior. The error message looks as though Capistrano is expecting an iterable and the assignment for publicKey isn't defining it as such.

As trivial as it may sound, try changing:

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

to:

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

You may need to do the same for the other items in your authentication setup. Good luck.




回答3:


Remove the line

ssh_options[:auth_methods] = 'publickey'


来源:https://stackoverflow.com/questions/15363003/amazon-aws-cap-deploycheck-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!