Ruby on rails 3 RubyonRails开发服务器上的IP发生了变化,cmd:cap staging部署不';行不通

Ruby on rails 3 RubyonRails开发服务器上的IP发生了变化,cmd:cap staging部署不';行不通,ruby-on-rails-3,Ruby On Rails 3,目标:让“cap分期部署”再次发挥作用 问题:开发服务器的IP已更改 背景: 我在个人PC/Ubuntu10.04 LTS上开发,并将更新推送到开发/测试服务器,即Ubuntu10.04 LTS虚拟机。我使用的是Rails3和Ruby1.9.2。 我在开发服务器上有git存储库,在推送更新或运行:cap staging deploy时使用SSH密钥而不是密码 我可以成功地做到:git推送web\u表单2\u git\u回购开发 当我运行时:cap staging deploy。。。我得到以下结果

目标:让“cap分期部署”再次发挥作用

问题:开发服务器的IP已更改

背景: 我在个人PC/Ubuntu10.04 LTS上开发,并将更新推送到开发/测试服务器,即Ubuntu10.04 LTS虚拟机。我使用的是Rails3和Ruby1.9.2。 我在开发服务器上有git存储库,在推送更新或运行:cap staging deploy时使用SSH密钥而不是密码

我可以成功地做到:git推送web\u表单2\u git\u回购开发

当我运行时:cap staging deploy。。。我得到以下结果:

  * executing `staging'
    triggering start callbacks for `deploy'
  * executing `multistage:ensure'
  * executing `deploy'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "git ls-remote ssh://git@my-domain-name/home/git/web_forms2.git develop"
    command finished in 3381ms
  * executing "git clone -q ssh://git@my-domain-name/home/git/web_forms2.git /home/rails_192/apps/cals_web_forms/public/releases/20111220174923 && cd /home/rails_192/apps/cals_web_forms/public/releases/20111220174923 && git checkout -q -b deploy 5c2910f687480f136206e56ba73c268c7026df20 && (echo 5c2910f687480f136206e56ba73c268c7026df20 > /home/rails_192/apps/cals_web_forms/public/releases/20111220174923/REVISION)"
    servers: ["my-domain-name"]
    [my-domain-name] executing command
 ** [my-domain-name :: out] ssh: connect to host my-domain-name port 22: No route to host
 ** fatal: The remote end hung up unexpectedly
    command finished in 3271ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/rails_192/apps/cals_web_forms/public/releases/20111220174923; true"
    servers: ["my-domain-name"]
    [my-domain-name] executing command
    command finished in 39ms
failed: "env PATH=/home/...
我确实尝试将web_forms2存储库克隆到我的本地PC,但没有成功,我将粘贴以下结果:

命令:git clonessh://git@我的域名/home/git/web_forms2.git

结果:致命:无法创建工作树目录“web_forms2”。:权限被拒绝

以前有人见过这个吗


谢谢

您可以在Capistrano配置文件(
config/deploy.rb
)中设置服务器的IP:


请记住,如果您使用主机名而不是IP,@Sergei Tulentsev是正确的,您必须更新
/etc/hosts
文件以反映IP中的更改。

您是否忘记更改
/etc/hosts
中的IP(如果您使用了)?是的!!!这就解决了问题。我花了数小时更改文件权限,认为这就是问题所在。现在让事情回到以前的样子。非常感谢。谢谢你的意见。我做的第一件事是在部署脚本中更改我的IP,这并没有解决所有问题。我不知道当服务器的IP发生变化时,我需要修改/etc/hosts。谢谢
role :web, "71.19.150.118"   # replace this IP with the new IP or server address.