Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save josephdicdican/8ee1b0a0878c4297310f12101661eb45 to your computer and use it in GitHub Desktop.
Save josephdicdican/8ee1b0a0878c4297310f12101661eb45 to your computer and use it in GitHub Desktop.
Laravel Queue Supervisor - reference
[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

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix 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.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.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.

But optionally you can directly set your command to your .conf, which in this example is the laravel_queue.conf. See example below :

command=php /path/to/AppName/artisan --env=production --timeout=240 queue:listen

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.

Now run your supervisor queues by run_queue.sh.

#!/bin/bash
php /path/to/AppName/artisan --env=production --timeout=240 queue:listen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment