Skip to content

Commit

Permalink
feat: implement healthcheck endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
keenthekeen committed Jun 3, 2024
1 parent 3c4f1f7 commit 4852830
Show file tree
Hide file tree
Showing 6 changed files with 725 additions and 558 deletions.
23 changes: 22 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Spatie\Health\Checks\Checks\CacheCheck;
use Spatie\Health\Checks\Checks\DatabaseCheck;
use Spatie\Health\Checks\Checks\DebugModeCheck;
use Spatie\Health\Checks\Checks\EnvironmentCheck;
use Spatie\Health\Checks\Checks\PingCheck;
use Spatie\Health\Checks\Checks\ScheduleCheck;
use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck;
use Spatie\Health\Facades\Health;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -23,6 +31,19 @@ public function register()
*/
public function boot()
{
//
// https://spatie.be/docs/laravel-health/v1/basic-usage/registering-your-first-check
Health::checks([
CacheCheck::new(),
DatabaseCheck::new(),
DebugModeCheck::new(),
EnvironmentCheck::new(),
PingCheck::new()->url('https://www.googleapis.com/oauth2/v3/certs')
->name('Google')->timeout(10)->retryTimes(2),
PingCheck::new()->url(config('vesta-client.url', 'https://docchula.com'))
->name('Vesta')->timeout(10)->retryTimes(2),
ScheduleCheck::new()->heartbeatMaxAgeInMinutes(60),
// Disk space check only works on Linux
UsedDiskSpaceCheck::new()->failWhenUsedSpaceIsAbovePercentage(95),
]);
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"phpoffice/phpspreadsheet": "^2.0",
"phpoffice/phpword": "^1.2",
"sentry/sentry-laravel": "^4.4",
"spatie/laravel-health": "^1.29",
"spatie/simple-excel": "^3.5",
"tightenco/ziggy": "^2.0"
},
Expand Down
Loading

0 comments on commit 4852830

Please sign in to comment.