Skip to content

Commit 1c24f52

Browse files
authored
Create README.md
1 parent 5908070 commit 1c24f52

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# A modern solution for running Laravel Horizon with a cron-based supervisor
2+
3+
This Laravel package automatically checks every three minutes if your [Laravel Horizon](https://laravel.com/docs/8.x/horizon) instance is still running. In that way, it is the perfect replacement for the normally recommended [Supervisor Process Control System](http://supervisord.org), for which you need your own server.
4+
5+
This package allows running Laravel Horizon on shared hosting instances and servers where you don't have to option to install Supervisor.
6+
7+
Under the hood, the package automatically schedules a simple Artisan command to run every three minutes that checks whether Horizon is still running. If not, it'll restart the Horizon queues.
8+
9+
## Installation
10+
11+
Run the following command to install the package:
12+
13+
```shell
14+
composer require ralphjsmit/laravel-horizon-cron-supervisor
15+
```
16+
17+
The package works without any configuration. **Note that you need to have the Laravel Scheduler configured correctly.**
18+
19+
## How does this work with new deployments?
20+
21+
When you deploy a new version of your app, you usually shut down your queues and Horizon instances in order let them use the files. The Laravel Scheduler doesn't run any commands when your application is in **maintenance mode** (`php artisan down`). Thus as long as your application is in maintenance mode, you don't need to worry about this package restarting your queues when you don't want that.
22+
23+
A typical deployment workflow could look something like this:
24+
```shell
25+
# Prepare deployment
26+
27+
php artisan down
28+
php artisan horizon:terminate
29+
30+
# Do deployment logic
31+
# Horizon will not be restarted until you put the application out of maintenance mode
32+
33+
php artisan horizon
34+
php artisan up
35+
36+
# Finish up deployment
37+
```
38+
39+
Note that this workflow is greatly simplified and doesn't take into account anything specific to your server or running commands like your migrations.
40+
41+
## About the package
42+
43+
This package was created by [Ralph J. Smit](https://ralphjsmit.com/). Checkout my website [ralphjsmit.com](https://ralphjsmit.com/) for [Laravel and development-related tutorials](https://ralphjsmit.com/).
44+
45+
Special thanks to [ahoffman](https://stackoverflow.com/users/952994/ahofmann) for his code on running and checking whether Horizon is active.

0 commit comments

Comments
 (0)