在单独的应用服务器和数据库服务器(均为Linode)上部署rails app

时间:2013-05-12 18:44:06

标签: ruby-on-rails ruby capistrano unicorn linode

我无法将基本的rails应用程序(适用于本地计算机,适用于heroku)部署到分布式体系结构(一个盒子上的Web服务器,另一个盒子上的数据库服务器)。

这是我的问题。似乎Capistrano无法更新数据库服务器上的缓存副本。

2013-05-12 11:32:57 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:morgs32/treebook.git master"
command finished in 1658ms
* executing multiple commands in parallel
-> "else" :: "if [ -d /home/morgan/apps/treebook/shared/cached-copy ]; then cd  /home/morgan/apps/treebook/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 73b5a632d417b3a6863d542b174b30077265bc7c && git clean -q -d -x -f; else git clone -q -b master git@github.com:morgs32/treebook.git /home/morgan/apps/treebook/shared/cached-copy && cd /home/morgan/apps/treebook/shared/cached-copy && git checkout -q -b deploy 73b5a632d417b3a6863d542b174b30077265bc7c; fi"
-> "else" :: "if [ -d /home/morgan/apps/treebook/shared/cached-copy ]; then cd /home/morgan/apps/treebook/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 73b5a632d417b3a6863d542b174b30077265bc7c && git clean -q -d -x -f; else git clone -q -b master git@github.com:morgs32/treebook.git /home/morgan/apps/treebook/shared/cached-copy && cd /home/morgan/apps/treebook/shared/cached-copy && git checkout -q -b deploy 73b5a632d417b3a6863d542b174b30077265bc7c; fi"
servers: ["*app server ip*", "*database ip*"]
[*app server ip*] executing command
[*database ip*] executing command
** [*database ip* :: out] sh: 1: git: not found
command finished in 3072ms
*** [deploy:update_code] rolling back
* executing multiple commands in parallel
-> "else" :: "rm -rf /home/morgan/apps/treebook/releases/20130512183302; true"
-> "else" :: "rm -rf /home/morgan/apps/treebook/releases/20130512183302; true"
servers: ["*app server ip*", "*database ip*"]
[*app server ip*] executing command
[*database ip*] executing command
command finished in 201ms
failed: "sh -c 'if [ -d /home/morgan/apps/treebook/shared/cached-copy ]; then cd /home/morgan/apps/treebook/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 73b5a632d417b3a6863d542b174b30077265bc7c && git clean -q -d -x -f; else git clone -q -b master git@github.com:morgs32/treebook.git /home/morgan/apps/treebook/shared/cached-copy && cd /home/morgan/apps/treebook/shared/cached-copy && git checkout -q -b deploy 73b5a632d417b3a6863d542b174b30077265bc7c; fi'" on *database ip*

当然,无论你在哪里看到 app server ip ,或数据库ip 我都有这些服务器的实际ips。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

如果服务器位于同一数据中心,您可以使用Linode Manager中列出的专用IP地址在两台服务器之间进行通信,而无需带宽成本。根据您的操作系统,您可能需要一个软件防火墙来打开端口以进行通信。

如果您尚未设置IP地址,请查看https://library.linode.com/remote-access#sph_adding-private-ip-addresses,其中包含有关如何添加IP地址的更多信息。