我正在尝试做一个基于capifony和Symfony2的Symfony 2项目部署web应用程序。
它使用Process来触发我的"cap deploy“任务,并在web浏览器中显示我的输出。
在shell中,如果我以用户www-data (与进程使用的相同)身份运行我的"cap deploy“,我的部署就能正常工作,所以我的部署任务和身份验证密钥都没有问题。然而,当我从我的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运行它时,它不需要询问我任何问题就能正常工作。
同样,从相同的用户调用相同的文件。
发布于 2012-12-12 18:45:00
这是一个已知的"bug“。
你需要告诉capistrano使用哪个密钥
尝试将以下内容添加到您的deploy.rb:
ssh_options[:keys] = %w(/what/ever/.ssh/id_rsa)来源:http://adam.goucher.ca/?p=1253
发布于 2012-12-13 04:37:32
当你从一个web app调用你的任务时,你需要告诉它使用哪个用户。
set :user, "www-data"
set :domain, "webserverdomainname.com"https://stackoverflow.com/questions/13818973
复制相似问题