capistrano / symfony

Capistrano tasks for deploying the Symfony standard edition
MIT License
353 stars 65 forks source link

Capistrano roles ignored for symfony_command #124

Open ChristianVermeulen opened 4 years ago

ChristianVermeulen commented 4 years ago
Library Version
Capistrano 3.12.1
Capistrano_symfony 2.0.0

I followed this piece from the docs:

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

I have 2 servers set up:

server "xxx",
  user: "emc",
  roles: %w{web db},
  primary: true,
  ssh_options: {
    user: "www-data", # overrides user setting above
    keys: %w(config/azure_ssh),
    forward_agent: false,
    auth_methods: %w(publickey)
  }

server "xxx2",
  user: "emc",
  roles: %w{web},
  ssh_options: {
    user: "www-data", # overrides user setting above
    keys: %w(config/azure_ssh),
    forward_agent: false,
    auth_methods: %w(publickey),
    port: 23
  }

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...

zalejus commented 1 year ago

Hi, I met the same issue and for me the only solution was to install capistrano symfony version 1.0.0.