We have the same setup (4 Rails apps, with a Rakefile that takes care
of deploying them all). What we do is use "sh" to execute the deploy
command, so that if they fail, it stops. Also, I keep track of which
apps were already deployed, and roll those back if a later one fails.
The following is one of our tasks for this. I define the Rails apps
(services in our lingo) as an array to begin with. The "target" stuff
is our mechanism for deploying to a slew of different clusters (e.g.
production data center, various staging setups, testing setups, etc.).
services = %w[account asset queue ria]
task :deploy_with_migrations do
if ENV['target'].nil?
puts "The deploy_with_migrations task requires a
target=<name>
parameter, exiting."
else
puts "Deploying and migrating all services to
#{ENV['target']}..."
current_service = nil
begin
services.each do |service|
current_service = service
sh "cd #{service}; cap #{ENV['target']}
deploy:migrations"
end
puts "done with deploy."
rescue Exception => e
puts "!!! Failed to deploy service:
#{current_service}!!!"
services.each do |rollback_service|
break if rollback_service ==
current_service
puts "Rolling back already deployed
service: #{rollback_service}..."
sh "cd #{rollback_service}; cap
#{ENV['target']} deploy:rollback"
end
puts "" # Put eye-catching error
message out
puts
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
puts "!!! Done with rollbacks and FAILED DEPLOY
recovery. !!!"
puts
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
end
end
end
On 7/31/07, Jamis Buck <[EMAIL PROTECTED]> wrote:
>
> Ernest,
>
> Sounds like a task that is more appropriate to rake than cap,
> actually. You'd just have a master Rakefile, and then a task like:
>
> task :deploy_all do
> system "cd project1 && cap deploy"
> system "cd project2 && cap deploy"
> ...
> end
>
> And then:
>
> rake deploy_all
>
> The above isn't particularly robust, though: if the deploy of project2
> fails, project1 remains deployed. Also, the deploys happen
> sequentially, rather than in parallel.
>
> - Jamis
>
> On 7/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I am working on a project that involves multiple Rails applications,
> > each one providing several XML-RPC services.
> > I have setup Capistrano deployment for each of them, no problem.
> > How should I proceed in my goal of having one recipe that invokes the
> > deployment of each of the applications?
> >
> > Any help is appreciated,
> >
> > Ernest
> >
> >
> > >
> >
>
> >
>
--
Chris Bailey
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---