File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Http \Controllers ;
4+
5+ use Illuminate \Http \JsonResponse ;
6+ use Illuminate \Support \Facades \DB ;
7+
8+ class HealthController extends Controller
9+ {
10+ public function __invoke (): JsonResponse
11+ {
12+ try {
13+ DB ::connection ()->getPdo ();
14+ $ dbStatus = 'ok ' ;
15+ } catch (\Exception $ e ) {
16+ $ dbStatus = 'error ' ;
17+ }
18+
19+ $ status = $ dbStatus === 'ok ' ? 'healthy ' : 'unhealthy ' ;
20+ $ httpCode = $ status === 'healthy ' ? 200 : 503 ;
21+
22+ return response ()->json ([
23+ 'status ' => $ status ,
24+ 'timestamp ' => now ()->toISOString (),
25+ 'services ' => [
26+ 'database ' => $ dbStatus ,
27+ ],
28+ ], $ httpCode );
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ WORKDIR /var/www/html
1414# PHP version to be installed
1515# See: https://rpms.remirepo.net/wizard/
1616# WARNING: PHP 8.2 have only security only support until December 2026
17- ARG PHP_VERSION=8.2
17+ ARG PHP_VERSION=8.3
1818
1919# list of all PHP packages to be installed
2020ARG PHP_PACKAGES="php-cli composer php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-gd php-redis php-xml php-swoole php-zip php-sodium php-bcmath"
Original file line number Diff line number Diff line change 44use App \Http \Controllers \Api \v1 \GroupUserController ;
55use App \Http \Controllers \Api \v1 \IntrospectionController ;
66use App \Http \Controllers \Api \v1 \UserinfoController ;
7+ use App \Http \Controllers \HealthController ;
78use Illuminate \Support \Facades \Route ;
89
910/*
3435 // Introspect requires auth via client id + secret
3536 Route::post ('introspect ' , IntrospectionController::class)->name ('introspect ' );
3637});
38+
39+ // Health check endpoint - no authentication required
40+ Route::get ('health ' , HealthController::class)->name ('health ' );
You can’t perform that action at this time.
0 commit comments