I'm trying to deploy a Rails app to a CentOS server running Passenger. The SVN repository and MySQL database are each hosted on separate machines. (In other words, there's a total of three separate hosts involved.)
Here is my deploy.rb
file (taken from the Passenger docs):
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
seems to succeed. At least there are no errors. But cap deploy
fails. There's a lot of output, but the upshot appears to be that Capistrano is trying to deploy my app to the "role" I specified for :db
-- trying to deploy the app to the DB host.
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