A modern solution for running Laravel Horizon with a CRON-based supervisor.

Overview

laravel-horizon-cron-supervisor@2x

A modern solution for running Laravel Horizon with a cron-based supervisor

This Laravel package automatically checks every three minutes if your Laravel Horizon instance is still running. In that way, it is the perfect replacement for the normally recommended Supervisor Process Control System, for which you need your own server.

This package allows running Laravel Horizon on shared hosting instances and servers where you don't have to option to install Supervisor.

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.

Installation

Run the following command to install the package:

composer require ralphjsmit/laravel-horizon-cron-supervisor

The package works without any configuration. Note that you need to have the Laravel Scheduler configured correctly.

How does this work with new deployments?

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.

A typical deployment workflow could look something like this:

# Prepare deployment 

php artisan down
php artisan horizon:terminate

# Do deployment logic
# Horizon will not be restarted until you put the application out of maintenance mode

php artisan horizon
php artisan up

# Finish up deployment

Note that this workflow is greatly simplified and doesn't take into account anything specific to your server or running commands like your migrations.

About the package

This package was created by Ralph J. Smit. Checkout my website ralphjsmit.com for Laravel and development-related tutorials.

The package was inspired by this StackOverflow question and my need for this as well. Special thanks to ahoffman for his code on running and checking whether Horizon is active.

You might also like...
Simple solution for form request validation on lumen.

Form Request Validation for Lumen This small package contains a laravel-like solution for request form validation. Contents Form Request Validation fo

Jumpstart your web development journey with the HALT Stack Starter Kit, a one-command solution for creating dynamic, scalable, and clean web applications.

Welcome to the HALT Stack Starter Kit! This kit is designed to help you kickstart your web development projects using the HALT Stack, a powerful combi

This is a plugin written in the PHP programming language and running on the PocketMine platform that works stably on the API 3.25.0 platform. It helps to liven up your server with Tags!
This is a plugin written in the PHP programming language and running on the PocketMine platform that works stably on the API 3.25.0 platform. It helps to liven up your server with Tags!

General This is a plugin written in the PHP programming language and running on the PocketMine platform that works stably on the API 3.25.0 platform.

Gallium is a TALL stack starter kit offering a robust set of options enabling you to get up and running in a snap.

Very short description of the package This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention o

A new way of Running Tinker. Simplify the Web Artisan's workflow.
A new way of Running Tinker. Simplify the Web Artisan's workflow.

Tinkerun A new way of Running Tinker. Simplify the Web Artisan's workflow. inspired by Tinkerwell Download links Github Releases 🗒 If you are using V

Use ESM with importmap to manage modern JavaScript in Laravel without transpiling or bundling

Introduction Use ESM with importmap to manage modern JavaScript in Laravel without transpiling or bundling. Inspiration This package was inspired by t

A simple and modern approach to stream filtering in PHP

clue/stream-filter A simple and modern approach to stream filtering in PHP Table of contents Why? Support us Usage append() prepend() fun() remove() I

laravel - Potion is a pure PHP asset manager for Laravel 5 based off of Assetic.

laravel-potion Potion is a pure PHP asset manager for Laravel based off of Assetic. Description Laravel 5 comes with a great asset manager called Elix

List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Comments
  • Better Handling of same command.

    Better Handling of same command.

    i got inspired by your implementations, and i have made some modifcations for my use. so here you go

    Features/Fixes

    • Check if horizon is installed
    • Check if horizon is paused ( maybe in deploying ? )
    • start horizon even if paused
    • of course silent so you don't care if paued
    • ask if you want to resume horizon.
    • and specify php ( i needed this is my projects because of hosting issues )

    ps: got inspired from health check from spatie too (spatie/laravel-health/src/Checks/Checks/HorizonCheck.php)

    opened by Saifallak 1
Releases(1.1)
Easily add Laravel Telescope and Horizon to Filament admin panel.

Filament Debugger This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Installation You can inst

Stephen Jude 5 Nov 24, 2022
Smeify is a Stable Automated Solution for Airtime and Data businesses in Nigeria, this package helps you integrate smeify easily into your laravel application.

Smeify is a Stable Automated Solution for Airtime and Data businesses in Nigeria, this package helps you integrate smeify easily into your laravel application.

Ogundiran Adewale Charles 2 Jul 27, 2022
LaravelFly is a safe solution to speeds up new or old Laravel 5.5+ projects, with preloading and coroutine, while without data pollution or memory leak

Would you like php 7.4 Preloading? Would you like php coroutine? Today you can use them with Laravel because of Swoole. With LaravalFly, Laravel will

null 456 Dec 21, 2022
Hcaptcha & Google ReCaptcha Solution for Laravel Framework

Laravel Captcha is a wrapper around HCaptcha & Google Recaptcha. It provides very easy-to-use Facade, Validation Rule, and blade directives.

Rahul Dey 47 Oct 27, 2022
A flexible, seamless and easy to use multitenancy solution for Laravel

Main: Develop: Tenanted Laravel A flexible, seamless and easy to use multitenancy solution for Laravel This package is currently under development. Ch

Tenanted Laravel 12 May 29, 2023
Simple Laravel 5 package to dump all running queries on the page.

Abandoned: Use this package instead Laravel QueryDumper Introduction Simple Laravel 5 package to dump all running queries on the page. If it's SELECT

Sarfraz Ahmed 24 May 14, 2020
Durable workflow engine that allows users to write long running persistent distributed workflows in PHP powered by Laravel queues

Durable workflow engine that allows users to write long running persistent distributed workflows (orchestrations) in PHP powered by Laravel queues. Inspired by Temporal and Azure Durable Functions.

null 268 Dec 27, 2022
A simple drop-in solution for providing UUID support for the IDs of your Eloquent models.

Introduction A simple drop-in solution for providing UUID support for the IDs of your Eloquent models. Both v1 and v4 IDs are supported out of the box

GoldSpec Digital 501 Jan 4, 2023
This is a solution implementation for the coderbyte question, CLEAN GET REQUEST RESULT.

This is a solution implementation for the coderbyte question, CLEAN GET REQUEST RESULT. Two solutions are proposed, the first is a brute force approach while the other is an improved time complexity solution.

null 3 May 23, 2022
Open Source Invoicing Solution for Individuals & Businesses

Introduction Crater is an open-source web & mobile app that helps you track expenses, payments & create professional invoices & estimates. Web Applica

Crater Invoice 6.7k Jan 4, 2023