Skip to content

Instantly share code, notes, and snippets.

@danharper
Last active September 2, 2020 17:13
Show Gist options
  • Star 43 You must be signed in to star a gist
  • Fork 26 You must be signed in to fork a gist
  • Save danharper/9136507 to your computer and use it in GitHub Desktop.
Save danharper/9136507 to your computer and use it in GitHub Desktop.
Laravel Queue Supervisor

Install Supervisor with sudo apt-get install supervisor. Ensure it's started with sudo service supervisor restart.

In /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread. And start using those changes with: sudo supervisorctl update.

[program:laravel_queue]
command=/usr/local/bin/run_queue.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/laraqueue.err.log
stdout_logfile=/var/log/laraqueue.out.log
#!/bin/bash
php /path/to/AppName/artisan --env=production --timeout=240 queue:listen
@roadev
Copy link

roadev commented Jan 19, 2016

It was very helpful for me!
Thanks!!!

@azimidev
Copy link

azimidev commented Aug 4, 2016

@danharper very helpful, thanks

@noder123
Copy link

noder123 commented Jan 24, 2017

Thanks for sharing! However, queue:work would be more efficient as it'll bootstrap the framework at start unlike queue:listen.

@codex-corp
Copy link

Thanks,

In /etc/supervisord/conf.d/ create a to In /etc/supervisor/conf.d/

@eichgi
Copy link

eichgi commented Jul 12, 2018

¿Does someone know how many number of processes (numprocs) this initializes when this parameter is not specified?

@jineshsubedi
Copy link

can we use supervisor for other commands like manual commands not queue:work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment