tylerwoonton / laravel-dashboard-health-check-tile by tylerwoonton

A tile bringing support for ukfast/laravel-health-check to spatie/laravel-dashboard.
66
5
2
Package Data
Maintainer Username: tylerwoonton
Maintainer Contact: tylerwoonton11@gmail.com (Tyler Woonton)
Package Create Date: 2020-05-05
Package Last Update: 2020-09-09
Language: PHP
License: MIT
Last Refreshed: 2024-11-17 03:06:39
Package Statistics
Total Downloads: 66
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 5
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Health Check Tile for Laravel Dashboard

Packagist Version GitHub license GitHub Workflow Status

Buy us a tree

The purpose of this package is to integrate the ukfast/laravel-health-check package into a tile for spatie/laravel-dashboard.

Example Screenshot

Installation

This package requires the ukfast/laravel-health-check package to be running on the endpoint provided so we can assert that your services are working. Please follow the instructions in that repo to install the package.

You can install the package via composer:

composer require tylerwoonton/laravel-dashboard-health-check-tile

Configuration

In the dashboard config file, you must add this configuration in the tiles key.

The sites array should contain an array of sites with their respective URLs and any custom headers or Guzzle options that need to be executed when hitting the URL.

The timeout option is the Guzzle request timeout in seconds. This is, by default, 3 seconds per request.

The show_failures option determines whether the services failing are displayed on the tile. If you only want to see concise, overall statuses it's fine to disable this.

The refresh_interval option determines how many seconds will pass before the dashboard tile is re-rendered.

// config/dashboard.php

return [
    // ...
    'tiles' => [
        'health_check' => [
            'sites' => [
                'Example App' => [
                    "url" => 'https://example.app/health', 
                    "headers" => [], // optional
                    "options" => [] // optional
                ]
            ],
            'timeout' => 3,
            'show_failures' => true,
            'refresh_interval' => 60
        ],
    ],
];

In app\Console\Kernel.php you should schedule the \TylerWoonton\HealthCheckTile\Commands\FetchHealthCheckDataCommand to run. You can let it run every minute if you want. You could also run it less frequently if fast updates on the dashboard aren't that important for this tile.

// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    // ...
    $schedule->command(\TylerWoonton\HealthCheckTile\Commands\FetchHealthCheckDataCommand::class)->everyMinute();
}

Usage

In your dashboard view you use the livewire:health-check-tile component.

<x-dashboard>
    <livewire:health-check-tile position="a1" />
</x-dashboard>

Customising the view

If you want to customise the view used to render this tile, run this command:

php artisan vendor:publish --provider="TylerWoonton\HealthCheckTile\HealthCheckTileServiceProvider" --tag="dashboard-health-check-tile-views"

Testing

composer test

Contributing

We welcome contributions to this package. All new changes should be well-tested and follow PSR-12 standards.

Please refer to our CONTRIBUTING file for more information.

Treeware

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.