- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Health;
|
|
|
|
use App\Framework\DI\Container;
|
|
use App\Framework\DI\Initializer;
|
|
use App\Framework\Discovery\UnifiedDiscoveryService;
|
|
|
|
final readonly class HealthCheckManagerInitializer
|
|
{
|
|
public function __construct(
|
|
private UnifiedDiscoveryService $discoveryService,
|
|
private Container $container
|
|
) {
|
|
}
|
|
|
|
#[Initializer]
|
|
public function __invoke(): HealthCheckManager
|
|
{
|
|
$manager = new HealthCheckManager();
|
|
|
|
// Automatically discover all classes implementing HealthCheckInterface
|
|
$healthCheckClasses = $this->discoveryService->findImplementations(
|
|
HealthCheckInterface::class
|
|
);
|
|
|
|
// Register each health check via dependency injection
|
|
foreach ($healthCheckClasses as $className) {
|
|
try {
|
|
// Use container to instantiate (handles dependencies automatically)
|
|
$healthCheck = $this->container->get($className);
|
|
|
|
if ($healthCheck instanceof HealthCheckInterface) {
|
|
$manager->registerHealthCheck($healthCheck);
|
|
}
|
|
} catch (\Throwable $e) {
|
|
// Log error but continue with other health checks
|
|
error_log("Failed to register health check {$className}: " . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
return $manager;
|
|
}
|
|
}
|