joseph-montanez / laravel-supervisor-config-generator

Generate Supervisor config for monitoring Laravel worker process

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Supervisor Config Generator

Build Status Total Download Latest Stable Version

This package generates Supervisor config that used by Laravel to monitor queue worker and Laravel Horizon. Make sure Supervisor is installed properly.

Installation

Using Composer, just run this command below.

composer require matriphe/supervisor

Configuration

Laravel < 5.5

After installed, open config/app.php and add this line.

Matriphe\Supervisor\ServiceProvider::class

Laravel > 5.5

Nothing to do, this package is using package auto-discovery.

Lumen

Open bootstrap.app and add this line.

$app->register(Matriphe\Supervisor\ServiceProvider::class);

Usage

Generate Laravel Horizon Config

Using root access, run

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.

For more info, just use --help option to see what options available.

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.

Using root access, run

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.

For more info, just use --help option to see what options available.

Outout

The output of the config file is like this.

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.

License

The MIT License (MIT). Please see License File for more information.

About

Generate Supervisor config for monitoring Laravel worker process

License:MIT License


Languages

Language:PHP 100.0%