The problem is that Capistrano 2 defines a default task called deploy:migrate
that is specified to run only for the role :db
. If you don't have that role in your application (which most do not), then when deploy:migrate
runs it will error out on the missing role, and that kind of error normally terminates the deployment scenario.
This can happen for other tasks, if you have a complex setup where some tasks are only run for specific servers. This behavior is not documented at all at Capistrano's site, which is a shame.
Starting with Capistrano 2.7 there is a way to circumvent the "is only run for servers matching role" error, by specifying a task property that tells Capistrano to skip tasks if no servers matches any of its specified roles:
For example:
namespace :deploy do
task :stuff, :roles => :somerole, :on_no_matching_servers => :continue do
# stuff
end
end
Now this works well for custom tasks, but how to set this for the default task migrate
? you have to override the task with your own setting and add the :on_no_matching_servers
option. I've added this to the global.rb
file:
namespace :deploy do
task :migrate, :on_no_matching_servers => :continue do end
end