Laravel Supervisor Config Generator
, (*1)
This package generates Supervisor config that used by Laravel to monitor queue worker and Laravel Horizon. Make sure Supervisor is installed properly., (*2)
Installation
Using Composer, just run this command below., (*3)
composer require matriphe/supervisor
Configuration
Laravel < 5.5
After installed, open config/app.php and add this line., (*4)
Matriphe\Supervisor\ServiceProvider::class
Laravel > 5.5
Nothing to do, this package is using package auto-discovery., (*5)
Lumen
Open bootstrap.app and add this line., (*6)
$app->register(Matriphe\Supervisor\ServiceProvider::class);
Usage
Generate Laravel Horizon Config
Using root access, run, (*7)
php artisan supervisor:horizon
By default, this will save the configuration file to /etc/supervisor/conf.d directory. To change this, use --path option on the command., (*8)
For more info, just use --help option to see what options available., (*9)
Generate Queue Worker Config
If you don't want to use Laravel Horizon to monitor your queue workers, use this commands. If you're using Laravel Horizon, just ignore this command., (*10)
Using root access, run, (*11)
php artisan supervisor:queue
By default, this command will also save the configuration file to /etc/supervisor/conf.d directory. To change this, use --path option on the command., (*12)
For more info, just use --help option to see what options available., (*13)
Outout
The output of the config file is like this., (*14)
Laravel Horizon
[program:appname-laravel-horizon-default]
command=/usr/bin/php /Volumes/data/Development/php/laravel/55/artisan horizon
process_name=%(process_name)s
priority=999
autostart=true
autorestart=unexpected
startretries=3
stopsignal=QUIT
stderr_logfile=/var/log/supervisor/appname-default.log
Queue Worker
[program:appname-queue-worker-default]
command=/usr/bin/php /Volumes/data/Development/php/laravel/55/artisan queue:work --queue=default --tries=3 --timeout=60
process_num=5
numprocs=5
process_name=%(process_num)s
priority=999
autostart=true
autorestart=unexpected
startretries=3
stopsignal=QUIT
stderr_logfile=/var/log/supervisor/appname-default.log
The file will be named /etc/supervisor/conf.d/appname-default.conf., (*15)
License
The MIT License (MIT). Please see License File for more information., (*16)