【发布时间】:2014-08-21 20:10:17
【问题描述】:
我第一次尝试部署我的应用程序,一切似乎都很好,直到 Capistrano 到达我的 :db 变量并且由于名为 deployer 的用户的身份验证失败而中断。 Deployer 由我和我的团队成员共享。
我煞费苦心地阅读了 wikis 和 Capistrano 上有关准备我的应用程序和身份验证/授权的文档,但在 git 包装器的身份验证级别仍然失败。这是我收到的错误:
INFO[0d3fe580] Running /usr/bin/env mkdir -p /tmp/openhub/ on deployer
DEBUG[0d3fe580] Command: /usr/bin/env mkdir -p /tmp/openhub/
INFO[610db5a4] Running /usr/bin/env mkdir -p /tmp/openhub/ on testing-crawl-1
DEBUG[610db5a4] Command: /usr/bin/env mkdir -p /tmp/openhub/
cap aborted!
Exception while executing on host testing-crawl-1: Authentication failed for user @testing-crawl-1
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh.rb:219:in `start'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:179:in `with_ssh'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/var/lib/gems/1.9.1/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
(See full trace by running task with --trace)
这是我的推断。此处由这一行确定的 github 的身份验证似乎失败:
/var/lib/gems/1.9.1/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:
这是我尝试过的。
- 我试过Cap Authentication/Authorization tutorial
- 我已确认我从 (testing-utility-1) 部署的计算机具有相同的 ssh 密钥配对为 test-crawling-1 和 testing-web-1(我最终也要部署的服务器)
- 我已经阅读了很多关于失败的 wiki,包括这个 stackoverflow 答案git.rake
- 我在 deploy.rb 和 testing.rb 中尝试了一些配置选项,我将在下面展示
部署.rb:
role :app, %w{testing-web-1}
role :web, %w{testing-web-1}
role :db, %w{testing-crawl-1}, primary: true}
role :user, 'deployer'
role :slave, "testing-crawl-1"
role :memcache, 'testing-web-1', no_release: true
set :stage, :testing
set :rails_env, :testing
server 'testing-web-1', user: 'deployer', roles: %w{web app}, primary: true
set :ssh_options, {
# keys: %w(/home/rlisowski/.ssh/id_rsa),
forward_agent: true
#auth_methods: %w(password)
}
我尝试将 keys 参数更改为指向我的 /home/deployer/.ssh/id_rsa 我尝试将 auth_methods: 设置为 %w(public_key)
最后,我的 config/testing.rb
lock '3.2.1'
set :application, 'openhub'
set :repo_url, 'git@github.com:blackducksw/ohloh.git'
set :default_stage, 'testing'
set :use_sudo, false
set :deploy_to, "/var/local/#{fetch(:application)}"
set :pty, true
set :linked_files, %w{config/database.yml}
set :deploy_via, :remote_cache
我很茫然。我不确定为什么身份验证一直失败并且我没有线索可以采取行动。任何帮助,将不胜感激。谢谢。
【问题讨论】: