我在尝试将以前工作的项目部署到开发服务器时遇到了一些麻烦。我没有设置系统,但是我确实拥有我需要的所有凭据(我认为)。
在尝试 cap staging deploy 之后,我得到了这么多,然后它产生了一个错误。请看下面:
triggering load callbacks
* 2012-11-20 14:52:20 executing `staging'
triggering start callbacks for `deploy'
* 2012-11-20 14:52:20 executing `multistage:ensure'
Identity added: /Users/XXX/.ssh/id_rsa (/Users/XXX/.ssh/id_rsa)
* 2012-11-20 14:52:20 executing `deploy'
* 2012-11-20 14:52:20 executing `deploy:update'
** transaction: start
* 2012-11-20 14:52:20 executing `deploy:update_code'
executing locally: "git ls-remote ssh://gitolite@repo1:2011/proto_projectname_rails HEAD"
command finished in 2864ms
* executing "git clone -q ssh://gitolite@repo1:2011/proto_projectname_rails /var/www/projectname/releases/20121120145223 && cd /var/www/projectname/releases/20121120145223 && git checkout -q -b deploy 0598169ed07015279bd78efa91f25ed3e5edcad8 && (echo 0598169ed07015279bd78efa91f25ed3e5edcad8 > /var/www/projectname/releases/20121120145223/REVISION)"
servers: ["repo2"]
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/projectname/releases/20121120145223; true"
servers: ["repo2"]
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: repo2 (Errno::ECONNREFUSED: Connection refused - connect(2))
connection failed for: repo2 (Errno::ECONNREFUSED: Connection refused - connect(2))
部署.rb
set :stages, %w(staging production)
set :default_stage, "production"
require 'capistrano/ext/multistage'
set :application, "projectname"
set :scm, :git
set :repository, "ssh://gitolite@repo1:2011/proto_projectname_rails"
老实说,我对为什么以前的工作版本不再起作用感到困惑。
任何帮助、建议或指导或此事都非常受欢迎。
谢谢
附带说明一下,是的,它一直是 2011 年的非标准端口,并且在我的 .ssh/config 中
编辑:
此过程涉及 2 台服务器。
在本地和第二台服务器上运行以下命令后,我确实得到了响应。
git ls-remote ssh://gitolite@repo1:2011/proto_projectname_rails
它返回;
0598169ed07015279bd78efa91f25ed3e5edcad8 HEAD
0598169ed07015279bd78efa91f25ed3e5edcad8 refs/heads/master
编辑:在 2 台服务器上运行。回购 1 和回购 2
cap deploy:check
退货
triggering load callbacks
* 2012-11-27 21:02:36 executing `production'
triggering start callbacks for `deploy:check'
* 2012-11-27 21:02:36 executing `multistage:ensure'
Identity added: /Users/x/.ssh/id_rsa (/Users/x/.ssh/id_rsa)
* 2012-11-27 21:02:36 executing `deploy:check'
* executing "test -d /var/www/projectname/releases"
servers: ["repo2"]
connection failed for: repo2 (Errno::ECONNREFUSED: Connection refused - connect(2))
解决了
事实证明,由于第二个服务器端口号,它被拒绝了。添加
set :port, 1893
赏金仍然对任何可以解释这一点的人开放。
为什么总是可以通过 SSH 连接到服务器,而无需随时编辑我的 ssh/config,并且其他机器能够使用完全相同的部署和暂存文件进行部署,但在我明确添加端口号之前我不能?