Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony messenger stop workers #125

Open
davidrojo opened this issue Jul 25, 2022 · 1 comment
Open

Symfony messenger stop workers #125

davidrojo opened this issue Jul 25, 2022 · 1 comment

Comments

@davidrojo
Copy link

Hi,

I am trying to include a tastk to restart symfony messenger once deployed the new code (https://symfony.com/doc/current/messenger.html#deploying-to-production)

But as this comment says (https://stackoverflow.com/questions/63508798/symfony-messenger-workers-do-not-stop-when-running-under-supervisor), the command must be executed in the "old" release path, not in the new release path

How can I execute the command in the previous release path?

I've created this task, but it is being executed in the new path:

namespace :deploy do
  desc 'Restart messenger'
  task :migrate do
    on roles(:app) do
      symfony_console('messenger:stop-workers')
    end
  end
end

before "symfony:cache:warmup", "deploy:migrate"
@ChristianVermeulen
Copy link

For anyone having the same issue, we do it manually like this and it seems to do the trick:

namespace :deploy do
  task :consumers do
    on roles(:db) do
        puts "#{release_path}"
        execute("cd #{release_path} && bin/console messenger:stop-workers")
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants