Files
ABSDEV/Modules/CloudDevOps/Services/HealthCheckRunner.php
T
Mark Gregory bc9427ac33 Deployment environments
* Development, staging, and production environment types
* Protected-environment support
* Deployment targets
* Local, SSH, Docker, and Kubernetes driver foundation
* Deployment pipelines
* Configurable pipeline steps
* Manual and approval-based releases
* Deployment release history
* Individual deployment-step tracking
* HTTP health checks
* Response-time tracking
* Rollback records
* Secret-reference metadata
* Encrypted target configuration
* Encrypted environment variables
* Administration dashboard
* Authenticated API endpoints
* Health-check command
* Release-history pruning command
* Permissions
* Sidebar integration
* Module registration
* Feature test
2026-07-24 13:57:56 +01:00

6 lines
712 B
PHP

<?php
namespace Modules\CloudDevOps\Services;
use Illuminate\Support\Facades\Http;
use Modules\CloudDevOps\Models\DeploymentHealthCheck;
final class HealthCheckRunner { public function run(DeploymentHealthCheck $check): DeploymentHealthCheck { $started = microtime(true); try { $response = Http::timeout(10)->get((string) $check->endpoint); $status = $response->status() === $check->expected_status ? 'healthy' : 'unhealthy'; $message = 'HTTP '.$response->status(); } catch (\Throwable $e) { $status = 'unhealthy'; $message = $e->getMessage(); } $check->update(['status'=>$status,'response_time_ms'=>(int)((microtime(true)-$started)*1000),'checked_at'=>now(),'message'=>$message]); return $check->refresh(); } }