If you want to execute a command on a host with a given role you can use the Capistrano on DSL, additionally using within from Capistrano will change the directory
namespace :deploy do
task :migrate do
on roles(:db) do
symfony_console('doctrine:migrations:migrate', '--no-interaction')
end
end
end
Yet the symfony_console is still ran on both servers. I noticed another task which did neatly run on just one server, it was not using the symfony command. So I changed my symfony_command to a capistrano execute and now the role is actually taken into account.
For some reason, when using the symfony_command, the roles from capistrano are ignored...
I followed this piece from the docs:
I have 2 servers set up:
Yet the
symfony_console
is still ran on both servers. I noticed another task which did neatly run on just one server, it was not using the symfony command. So I changed my symfony_command to a capistranoexecute
and now the role is actually taken into account.For some reason, when using the symfony_command, the roles from capistrano are ignored...