A little bit of Laravel Horizon
Laravel Horizon provides a beautiful dashboard and code-driven configuration for your Laravel powered Redis queues. Horizon allows you to easily monitor key metrics of your queue system such as job throughput, runtime, and job failures.
Install Laravel Horizon and Publishing Configuration
To install Laravel Horizon you can make use of the composer package manager by running the command below.
composer require laravel/horizon
Now that it's installed you need to publish the assets provided by Horizon. This step is necessary and you can't skip.
php artisan horizon:install
Laravel Horizon Configuration
Below is the horizon configuration that comes by default. We do recommend that you change domain and path if necessary as this will help to better secure your application from users that may attempt to access it.
<?php use Illuminate\Support\Str; return [ 'domain' => env('HORIZON_DOMAIN', null), 'path' => env('HORIZON_PATH', 'horizon'), 'use' => 'default', 'prefix' => env( 'HORIZON_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:' ), 'middleware' => ['web'], 'waits' => [ 'redis:default' => 60, ], 'trim' => [ 'recent' => 60, 'pending' => 60, 'completed' => 60, 'recent_failed' => 10080, 'failed' => 10080, 'monitored' => 10080, ], 'metrics' => [ 'trim_snapshots' => [ 'job' => 24, 'queue' => 24, ], ], 'fast_termination' => false, 'memory_limit' => 64, 'defaults' => [ 'supervisor-1' => [ 'connection' => 'redis', 'queue' => ['default'], 'balance' => 'auto', 'maxProcesses' => 1, 'memory' => 128, 'tries' => 1, 'nice' => 0, ], ], 'environments' => [ 'production' => [ 'supervisor-1' => [ 'maxProcesses' => 10, 'balanceMaxShift' => 1, 'balanceCooldown' => 3, ], ], 'local' => [ 'supervisor-1' => [ 'maxProcesses' => 3, ], ], ], ];
Laravel Horizon Pause and Continue Process
You can "pause" and "continue" process in Laravel horizon by running the command below.
php artisan horizon:pause php artisan horizon:continue
php artisan horizon:pause-supervisor supervisor-1 php artisan horizon:continue-supervisor supervisor-1
php artisan horizon:terminate
Upgrading Laravel Horizon
You can upgrade Laravel Horizon normally using composer update and once you have done so do run the "horizon:publish" command as it's necessary to update the published assets.
php artisan horizon:publish