Skip to content

Capistrano roles ignored for symfony_command #124

@ChristianVermeulen

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions