【问题标题】:EC2 Ubuntu Capistrano issue (NoMethodError: undefined method `each' for "publickey":String)EC2 Ubuntu Capistrano 问题(NoMethodError: undefined method `each' for "publickey":String)
【发布时间】:2013-02-24 11:35:34
【问题描述】:

我已经用尽了自己和我的资源,试图重新创造我上周必须奇迹般创造的东西。

我正在使用一个运行 Ubuntu 12.10 x64 的 EC2 微型实例来使用 Jenkins 和 Capistrano 为 CI 创建一个测试服务器。

我能够“弄清楚”我上周在做什么,并且有一个似乎正在工作的服务器,但发现自己无法重新创建连接到我的 EC2 实例以将代码从 github 推送到所述实例。

这是我在运行“cap deploy”时得到的结果:

jenkins@ip-10-170-102-174:/var/www/config$ cap deploy

* 2013-02-24 11:05:11 执行 deploy' * 2013-02-24 11:05:11 executingdeploy:update' ** 交易:开始 * 2013-02-24 11:05:11 为“publickey”执行deploy:update_code' executing locally: "git ls-remote git@github.com:example/example.git master" command finished in 1871ms * executing "git clone -q git@github.com:example/example.git /var/www/example/releases/20130224110513 && cd /var/www/example/releases/20130224110513 && git checkout -q -b deploy de26b44bba59e1aa04dc3cf9dbec9dc4d9e4bdf3 && (echo de26b44bba59e1aa04dc3cf9dbec9dc4d9e4bdf3 > /var/www/example/releases/20130224110513/REVISION)" servers: ["example.us-west-1.compute.amazonaws.com"] *** [deploy:update_code] rolling back * executing "rm -rf /var/www/example/releases/20130224110513; true" servers: ["example.us-west-1.compute.amazonaws.com"] ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: example.us-west-1.compute.amazonaws.com (NoMethodError: undefined methodeach':String) 连接失败:example.us-west-1.compute.amazonaws.com (NoMethodError: undefined method `each' for "publickey":String)

这是我的 deploy.rb 文件:

set :app_name, "example"
set :location, "example"
set :application, "example"
set :repository, "git@github.com:example/example.git"
set :user, "jenkins"
set :runner, "jenkins"
set :branch, "master"
set :port, 22
set :deploy_to, "/var/www/#{application}"
set :scm, "git"

ssh_options[:forward_agent] = true
ssh_options[:auth_methods] = "publickey"
ssh_options[:keys] = ["/var/www/jenkins"]
#set :default_stage, "dev"

role :app, "example.us-west-1.compute.amazonaws.com", :primary => true

我需要注意的是,我关注了其他几个论坛和教程,我生成的名为“jenkins”的密钥确实允许我连接到服务器,在 /var/lib/jenkins 中工作 - 这使得这更加令人困惑.

我正在使用用户 Jenkins,因为我可以在我的其他服务器上使用它/似乎它可以让 Jenkins 的使用变得简单。我对此很陌生,并且肯定在努力学习,我已经阅读了几篇文章,观看了几个视频,并且非常沮丧,坦率地说,很累。有人可以帮帮我吗?

【问题讨论】:

  • 嗯,没有答案,我也有同样的问题!

标签: ubuntu ssh amazon-ec2 jenkins capistrano


【解决方案1】:

上周我有一个设置在升级后开始表现出相同的行为。 (Looks like this has happened to a couple of us recently.)

错误似乎表明[:auth_methods] 没有以使其可迭代的方式分配。

尝试改变:

ssh_options[:auth_methods] = "publickey"
ssh_options[:keys] = ["/var/www/jenkins"]

到这里:

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

【讨论】:

  • 它最终成为了一个 ssh 身份验证问题(我在这篇文章发布几天后发现了它——真是一场噩梦)。谢谢!
  • 感谢这对 capistrano 2.15.4 的帮助
  • set :user, "ubuntu" 我遇到了同样的问题,只是尝试了一些用户名,然后就可以了
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-01-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-01
  • 2015-03-19
相关资源
最近更新 更多