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

@@ -24,7 +24,9 @@ final class DefaultContainer implements Container
private readonly LazyInstantiator $lazyInstantiator;
public readonly MethodInvoker $invoker;
public readonly ContainerIntrospector $introspector;
public readonly FrameworkMetricsCollector $metrics;
public function __construct(
@@ -44,7 +46,7 @@ final class DefaultContainer implements Container
$this->instances,
$this->bindings,
$this->reflectionProvider,
fn(): array => $this->resolving
fn (): array => $this->resolving
);
$this->metrics = new FrameworkMetricsCollector();
@@ -55,7 +57,11 @@ final class DefaultContainer implements Container
public function bind(string $abstract, callable|string|object $concrete): void
{
$this->bindings->bind($abstract, $concrete);
$this->clearCaches(ClassName::create($abstract));
// Only clear caches for valid class names, skip string keys like 'filesystem.storage.local'
if (class_exists($abstract) || interface_exists($abstract)) {
$this->clearCaches(ClassName::create($abstract));
}
}
public function singleton(string $abstract, callable|string|object $concrete): void
@@ -121,7 +127,9 @@ final class DefaultContainer implements Container
try {
$instance = $this->buildInstance($class);
if ($this->singletonDetector->isSingleton(ClassName::create($class))) {
// Only check singleton attribute for actual classes
if ((class_exists($class) || interface_exists($class)) &&
$this->singletonDetector->isSingleton(ClassName::create($class))) {
$this->instances->setSingleton($class, $instance);
} else {
$this->instances->setInstance($class, $instance);
@@ -131,6 +139,7 @@ final class DefaultContainer implements Container
} catch (Throwable $e) {
// Track resolution failures
$this->metrics->increment('container.resolve.failures');
throw $e;
} finally {
array_pop($this->resolving);
@@ -139,11 +148,20 @@ final class DefaultContainer implements Container
private function buildInstance(string $class): object
{
$className = ClassName::create($class);
if ($this->bindings->hasBinding($class)) {
return $this->resolveBinding($class, $this->bindings->getBinding($class));
}
// For string keys without bindings, throw immediately
if (!class_exists($class) && !interface_exists($class)) {
throw new \RuntimeException(
"Cannot resolve '{$class}': not a valid class and no binding exists. " .
"Available bindings: " . implode(', ', array_keys($this->bindings->getAllBindings()))
);
}
$className = ClassName::create($class);
// Enhanced diagnostics for missing bindings
try {
$reflection = $this->reflectionProvider->getClass($className);