Laravel queue and Supervisor

Database queue

  1. Assuming you are all set for notfication email.
  2. Change in env: QUEUE_CONNECTION=sync>QUEUE_CONNECTION=database
  3. php artisan queue:table
  4. php artisan migrate
  5. php artisan queue:work
done!

Setup supervisor on linux hosting

  • sudo apt-get install supervisor
  • Do you want to continue?[Y/n] y
  • cd etc/supervisor/conf.d
  • sudo vim queue-worker.conf
  • [program:queue-worker]
    process_name=%(program_name)s_%(process_num)02d
    command=php /var/www/html/artisan queue:work
    autostart=true
    autorestart=true
    user=root
    numprocs=8< redirect_stderr=true stdout_logfile=/var/www/html/worker.log
    :wq
  • cd
  • sudo supervisorctl reread
  • sudo supervisorctl update
  • cd /var/www/html
  • sudo supervisorctl reload
  • sudo service supervisor restart
Source: https://www.youtube.com/watch?v=r9HKfJFDEFE&t=549s

Labels: ,

© copyright-2020 Rejaul