how to invoke deploy multiple times?

10 views
Skip to first unread message

Chris Ramakers

unread,
Apr 28, 2015, 4:53:08 AM4/28/15
to capis...@googlegroups.com

We're working on a system that allows us to deploy multiple projects at once with capistrano. We have 3 systems in place (front, billing, app) that all have a separate codebase and are deployed on different servers in multiple stages.

Using the capistrano_multiconfig to create one capistrano repo with multiple configurations works like a charm. I can run each command separately and they all deploy fine to the right server in the right stage.

Now I would like to add a custom task that deploys all the configured projects at once with a single command. I've pasted the command code below.

set :projects, ['front', 'billing', 'app']

namespace :deploy do
    desc 'Deploy all'
    task :all do 
        set :env, ask('To what environment do you want to deploy?', 'staging');
        run_locally do
            fetch(:projects).each { |project| 
                info "Now deploying #{project} to #{fetch(:env)}" 
                invoke "#{project}:#{fetch(:env)}"
                invoke "deploy"
            }
        end
    end
end

The issue is that the code above only deploys the first project, the info command executes for all iterations of the .each loop but the invocation of the deploy command only runs for the first project, after that the following two invoke calls just do nothing.

Anyone have an idea?

Lee Hambley

unread,
Apr 28, 2015, 4:53:36 AM4/28/15
to Capistrano
I don't know how capistrano_multiconfig works, but probably the problem is related to http://chrisroos.co.uk/blog/2007-12-06-ruby-rake-invoke-vs-execute

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/b0fff078-e6c3-4828-873d-3d72cccd9ac0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages