docker-compose-laravel icon indicating copy to clipboard operation
docker-compose-laravel copied to clipboard

How to run queue worker?

Open KevinYobeth opened this issue 2 years ago • 5 comments

As the title says, how to run queue worker in laravel on production environment?

KevinYobeth avatar Jun 12 '22 11:06 KevinYobeth

You can add a service for it using the php image

queue:
  image: php
  restart: unless-stopped
  command: bash -c 'php artisan queue:work;'
  container_name: queue
  depends_on:
      - redis
  volumes:
    - ./src:/var/www/html:delegated
  working_dir: /var/www/html
  networks:
    - laravel

thrashzone13 avatar Jun 13 '22 10:06 thrashzone13

Thankyou for the response, but it still won't work, my queue still stuck in the database.

image

Can you share me your full working docker-compose.yml file please @thrashzone13?

KevinYobeth avatar Jun 21 '22 13:06 KevinYobeth

You can run using docker-compose run --rm artisan queue:work

Will it run indefinitely or will it shutdown after I exit the console?

KevinYobeth avatar Jun 24 '22 05:06 KevinYobeth

That command is just to run it on your local machine. If you want it to run indefinitely you need to add supervisord service in docker and run it.

Will it run indefinitely or will it shutdown after I exit the console?

-- Best Regards, Kevin Yobeth On 24 Jun 2022 12.36 PM +0700, Sanket Gandhi @.***>, wrote:

You can run using docker-compose run --rm artisan queue:work — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

KevinYobeth avatar Oct 11 '22 07:10 KevinYobeth

If you want to run the queue locally docker-compose run --rm artisan queue:work but it will stop after you ctrl+c or exit the console.

If you want to run it indefinitely you'll need to take @sanketgandhi876 advice and set up a supervisord service for it.

aschmelyun avatar Nov 14 '22 06:11 aschmelyun