DEV Community

PostSrc
PostSrc

Posted on • Originally published at postsrc.com on

How to Terminate Horizon during Deployment in Laravel Forge

Laravel Horizon

Horizon is a beautiful dashboard for Laravel applications that make use of the Redis queue. In this short post, you'll learn how to terminate Horizon process on Laravel Forge deployment process.

Laravel Horizon dashboard

Deployment Scripts

Inside the deployment script, do add the command below and on each deployment, it will gracefully terminate the master Horizon process on the machine. Any of the jobs that horizon is processing will be completed then horizon will exit.

// existing deployment scripts

// command to terminate laravel horizon
php artisan horizon:terminate
Enter fullscreen mode Exit fullscreen mode

Do note that you'll have to set up horizon daemon by accessing the "daemons" page on the dashboard and defining the configuration. The command would be "php artisan horizon" and the directory is the full path of where the website is located in the machine.

Laravel Forge New Daemon

By having a daemon, the horizon instance will automatically be restarted by the process monitor such as the supervisor upon each successful deployment.

Active Daemons in Laravel Forge

Hope this tutorial is helpful and happy learning.

This post is originally published at PostSrc. If you like this kind of tutorial, I would really appreciate it if you give it a visit.

Top comments (0)