feat(Production): Complete production deployment infrastructure

- 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.
This commit is contained in:
2025-10-25 19:18:37 +02:00
parent caa85db796
commit fc3d7e6357
83016 changed files with 378904 additions and 20919 deletions

View File

@@ -25,8 +25,17 @@ final readonly class ErrorReportingInitializer
#[Initializer]
public function initialize(Container $container): void
{
$enabled = (bool) ($_ENV['ERROR_REPORTING_ENABLED'] ?? true);
// Storage
$container->bind(ErrorReportStorageInterface::class, function (Container $container) {
$container->bind(ErrorReportStorageInterface::class, function (Container $container) use ($enabled) {
if (! $enabled) {
// Return storage even if disabled (might be used for queries)
return new DatabaseErrorReportStorage(
connection: $container->get(ConnectionInterface::class)
);
}
return new DatabaseErrorReportStorage(
connection: $container->get(ConnectionInterface::class)
);
@@ -40,8 +49,57 @@ final readonly class ErrorReportingInitializer
);
});
// Error Reporter
$container->bind(ErrorReporter::class, function (Container $container) {
// Error Reporter Interface - bind to concrete or Null implementation
$container->bind(ErrorReporterInterface::class, function (Container $container) use ($enabled) {
if (! $enabled) {
return new NullErrorReporter();
}
$processors = [];
$filters = [];
// Add built-in processors
if ($container->has(RequestContextProcessor::class)) {
$processors[] = $container->get(RequestContextProcessor::class);
}
if ($container->has(UserContextProcessor::class)) {
$processors[] = $container->get(UserContextProcessor::class);
}
// Add environment-based filters
if (($_ENV['ERROR_REPORTING_FILTER_LEVELS'] ?? null)) {
$allowedLevels = explode(',', $_ENV['ERROR_REPORTING_FILTER_LEVELS']);
$filters[] = function (ErrorReport $report) use ($allowedLevels) {
return in_array($report->level, $allowedLevels);
};
}
// Add environment filter for production
if (($_ENV['APP_ENV'] ?? 'production') === 'production') {
$filters[] = function (ErrorReport $report) {
// Don't report debug/info in production
return ! in_array($report->level, ['debug', 'info']);
};
}
return new ErrorReporter(
storage: $container->get(ErrorReportStorageInterface::class),
clock: $container->get(Clock::class),
logger: $container->has(Logger::class) ? $container->get(Logger::class) : null,
queue: $container->has(Queue::class) ? $container->get(Queue::class) : null,
asyncProcessing: (bool) ($_ENV['ERROR_REPORTING_ASYNC'] ?? true),
processors: $processors,
filters: $filters
);
});
// Error Reporter (concrete class) - delegate to interface
$container->bind(ErrorReporter::class, function (Container $container) use ($enabled) {
if (! $enabled) {
throw new \RuntimeException('ErrorReporter is disabled. Use ErrorReporterInterface instead.');
}
$processors = [];
$filters = [];