2012-12-11 39 views
3

我正在尝试基于capifony和Symfony2做Symfony 2项目部署Web应用程序。身份验证失败,首选

它使用过程来触发我的“帽子部署”任务,并显示我的输出在Web浏览器。当我在shell中运行我的“cap deploy”作为用户www-data(与Process所使用的相同)时,我的deployement可以正常工作,因此我的部署任务和身份验证密钥都没有任何问题。 虽然,当我从我的web应用程序调用我的任务时,capifony告诉我它无法在远程服务器上进行身份验证。

triggering start callbacks for `deploy' 

* executing `deploy:setdomain' 
* executing `deploy' 
* executing `deploy:update' 
** transaction: start 
* executing `deploy:update_code' 

triggering before callbacks for `deploy:update_code' 

[32m--> Updating code base with checkout strategy[0m 

executing locally: "git ls-remote [ myrepo ]" 

command finished in 2068ms 

* executing "git clone -q -o [ remote server ] [ my repo ] 
/var/www/spinfony/releases/20121211100449 && cd /var/www/spinfony/releases/20121211100449 && git checkout -q -b deploy be53233e51a4c542c3bc8603b424e57f988898a4 && (echo be53233e51a4c542c3bc8603b424e57f988898a4 > /var/www/spinfony/releases/20121211100449/REVISION)" 

servers: ["[ remote server ]"] 
Password: stty: standard input: Invalid argument 
stty: standard input: Invalid argument 
stty: standard input: Invalid argument 

*** [deploy:update_code] rolling back 

* executing "rm -rf /var/www/spinfony/releases/20121211100449; true" 

servers: ["[ remote server ]"] 
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: [ remote server ] (Net::SSH::AuthenticationFailed: [ user ]) 
connection failed for: [ remote server ] (Net::SSH::AuthenticationFailed: [ user ]) 

我试图找出为什么capifony似乎想到了密码,我不能提供,因为我不是一个shell中运行它,而当我从一个shell中运行它,它工作正常不问我什么。

再一次从同一个用户调用同一个文件。

回答

1

这是一个已知的 “臭虫”

你需要告诉Capistrano的关键至极使用

尝试添加以下内容到deploy.rb:

ssh_options[:keys] = %w(/what/ever/.ssh/id_rsa) 

来源:http://adam.goucher.ca/?p=1253

+0

它工作的很好! – user1892216

0

当您从Web应用程序调用您的任务时,您需要告诉它要使用哪个用户。

set :user, "www-data" 
set :domain, "webserverdomainname.com"