1

我正在尝试将 Rails 应用程序部署到运行Passenger 的CentOS 服务器。SVN 存储库和 MySQL 数据库分别托管在不同的机器上。(换句话说,总共涉及三个独立的主机。)

这是我的deploy.rb文件(取自乘客文档):

set :application, 'myapp'
set :repository,  'svn+ssh://user@svn_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, 'user@app_host.com'
role :web, 'user@app_host.com'

# Originally this had a "primary => true" option, but cap deploy:setup failed
# when that option was present.
role :db,  'user@db_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——尝试将应用程序部署到数据库主机。

    servers: ["app_host.com", "db_host.com"]

...

 ** [db_host :: out] Permission denied, please try again.
 ** [db_host :: out] user@svn_host.com's password:

...

failed: "sh -c 'svn checkout -q  -r184 svn+ssh://user@svn_host.com/var/svn/myapp/trunk /opt/deployed_rails_apps/myapp/releases/20090720190553 && (echo 184 > /opt/deployed_rails_apps/myapp/releases/20090720190553/REVISION)'" on user@db_host.com
4

1 回答 1

4

如果您不需要数据库盒上的 Rails 代码,这很容易解决 - 不要定义:db角色。

cap deploy默认情况下,将代码放在您定义的所有角色的所有框上。

于 2009-07-20T19:49:59.280 回答