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
.
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
.
I had some trouble getting this to work on OSX Sierra
First, I had to create the supervisor.d folder
Then I kept having errors when trying to use supervisorctl. The solution was to use -c with supervisorctl too (not only supervisord)
Lastly I noticed that the default configuration file when using brew install supervisor is supervisord.ini (not .conf) and in it it auto-includes .ini files (not .conf)
all is working now. I made myself these two bash aliases to make it easier
update: the next day I started having some very weird problems with Horizon and Supervisor. Horizon would start but it would show nothing under supervisors and wouldn't process my queues. But if I started it manually it worked.
After trying a few things I gave up on using brew to manage (start/stop/restart) and wrote this little function which seems to work every time now