1
我正在尝试将Rails应用程序部署到运行Passenger的CentOS服务器。 SVN存储库和MySQL数据库分别托管在不同的机器上。 (换句话说,有一个总参与三个独立的主机。)如何为Capistrano指定单独的应用程序和数据库服务器?
这里是我的deploy.rb
文件(从Passenger docs拍摄):
set :application, 'myapp'
set :repository, 'svn+ssh://[email protected]_host.com/var/svn/myapp/trunk'
# Changed this to true because I do in fact use sudo.
set :use_sudo, true
set :deploy_to, "/opt/deployed_rails_apps/#{application}"
role :app, '[email protected]_host.com'
role :web, '[email protected]_host.com'
# Originally this had a "primary => true" option, but cap deploy:setup failed
# when that option was present.
role :db, '[email protected]_host.com'
namespace :deploy do
task :start, :roles => :app do
run "touch #{current_release}/tmp/restart.txt"
end
task :stop, :roles => :app do
# Do nothing.
end
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_release}/tmp/restart.txt"
end
end
cap deploy:setup
似乎成功。至少没有错误。但cap deploy
失败。有很多输出,但结果似乎是Capistrano试图将我的应用部署到我为:db
指定的“角色” - 尝试将应用部署到主机的DB。
servers: ["app_host.com", "db_host.com"]
...
** [db_host :: out] Permission denied, please try again.
** [db_host :: out] [email protected]_host.com's password:
...
failed: "sh -c 'svn checkout -q -r184 svn+ssh://[email protected]_host.com/var/svn/myapp/trunk /opt/deployed_rails_apps/myapp/releases/20090720190553 && (echo 184 > /opt/deployed_rails_apps/myapp/releases/20090720190553/REVISION)'" on [email protected]_host.com
谢谢。那么为什么包含在这么多例子中的“db”角色呢?在什么情况下,我想要在数据库框中添加应用程序代码? – Ethan 2009-07-20 20:08:10