capistrano / capistrano/symfony

Capistrano roles ignored for symfony_command

Open
#124 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
353
Forks
61
PR merge metrics
No merged PRs in 30d

Description

| Library | Version |
|---|---|
| Capistrano | 3.12.1 |
| Capistrano_symfony | 2.0.0 |

I followed this piece from the docs:

```ruby
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:
```ruby
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...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the deployment with the two server definitions and compare symfony_console with the Capistrano execute call inside the on roles(:db) block. Trace how symfony_console selects its execution hosts; done means the Symfony command runs only on servers assigned the requested role.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, ruby
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.