1- Installation
for linux
- $sudo apt-get install supervisor
for macos
- $sudo apt-get install supervisor
2- Configuration
you can refer to the supervisor docs http://supervisord.org/configuration.html
the application will look for a file named supervisord.conf within the following locations, in the specified order. It will use the first file it finds.
- $CWD/supervisord.conf
- $CWD/etc/supervisord.conf
- /etc/supervisord.conf
- /etc/supervisor/supervisord.conf (since Supervisor 3.3.0)
- ../etc/supervisord.conf (Relative to the executable)
- ../supervisord.conf (Relative to the executable)
3- Setup for Laravel
you can refer to the link https://laravel.com/docs/5.1/queues#supervisor-configuration
nano /etc/supervisor/supervisord.conf
Give it execute permissions:
chmod +x queue.conf.
[program:laravel-worker] autostart=true autorestart=true stderr_logfile=/var/log/laraqueue.err.log stdout_logfile=/var/log/laraqueue.out.log command=php /Applications/MAMP/htdocs/Genesis/artisan queue:work --tries=1 --ti$ numprocs=3 redirect_stderr=true process_name=%(program_name)s_%(process_num)02d [supervisord] nodaemon=true [supervisorctl]
In this example, the numprocs directive will instruct Supervisor to run 8 queue:work processes and monitor all of them, automatically restarting them if they fail. Of course, you should change the queue:work sqs portion of the command directive to reflect your chosen queue connection.
4- run supervisor
then run
sudo supervisord -c /etc/supervisor/supervisord.conf
Comments
Post a Comment