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

@@ -5,11 +5,14 @@ declare(strict_types=1);
namespace Tests\Unit\Framework\Logging;
use App\Framework\Logging\DefaultLogger;
use App\Framework\Logging\HasChannel;
use App\Framework\Logging\LogChannel;
use App\Framework\Logging\LogHandler;
use App\Framework\Logging\Logger;
use App\Framework\Logging\LogLevel;
use App\Framework\Logging\LogRecord;
use App\Framework\Logging\ProcessorManager;
use App\Framework\Logging\ValueObjects\LogContext;
use PHPUnit\Framework\TestCase;
final class ChannelSystemTest extends TestCase
@@ -49,11 +52,11 @@ final class ChannelSystemTest extends TestCase
public function test_channel_system_basic_functionality(): void
{
// Teste alle Channel-Logger
$this->logger->security->warning('Security alert', ['ip' => '192.168.1.1']);
$this->logger->cache->debug('Cache miss', ['key' => 'user_123']);
$this->logger->database->error('Query failed', ['table' => 'users']);
$this->logger->framework->info('Route registered', ['path' => '/api/test']);
$this->logger->error->critical('System failure', ['component' => 'auth']);
$this->logger->channel(LogChannel::SECURITY)->warning('Security alert', LogContext::withData(['ip' => '192.168.1.1']));
$this->logger->channel(LogChannel::CACHE)->debug('Cache miss', LogContext::withData(['key' => 'user_123']));
$this->logger->channel(LogChannel::DATABASE)->error('Query failed', LogContext::withData(['table' => 'users']));
$this->logger->channel(LogChannel::FRAMEWORK)->info('Route registered', LogContext::withData(['path' => '/api/test']));
$this->logger->channel(LogChannel::ERROR)->critical('System failure', LogContext::withData(['component' => 'auth']));
expect($this->capturedRecords)->toHaveCount(5);
@@ -85,7 +88,7 @@ final class ChannelSystemTest extends TestCase
$this->logger->info('Standard log');
// Channel-Logging
$this->logger->security->info('Channel log');
$this->logger->channel(LogChannel::SECURITY)->info('Channel log');
expect($this->capturedRecords)->toHaveCount(2);
@@ -100,14 +103,14 @@ final class ChannelSystemTest extends TestCase
public function test_all_log_levels_work_with_channels(): void
{
$this->logger->security->debug('Debug message');
$this->logger->security->info('Info message');
$this->logger->security->notice('Notice message');
$this->logger->security->warning('Warning message');
$this->logger->security->error('Error message');
$this->logger->security->critical('Critical message');
$this->logger->security->alert('Alert message');
$this->logger->security->emergency('Emergency message');
$this->logger->channel(LogChannel::SECURITY)->debug('Debug message');
$this->logger->channel(LogChannel::SECURITY)->info('Info message');
$this->logger->channel(LogChannel::SECURITY)->notice('Notice message');
$this->logger->channel(LogChannel::SECURITY)->warning('Warning message');
$this->logger->channel(LogChannel::SECURITY)->error('Error message');
$this->logger->channel(LogChannel::SECURITY)->critical('Critical message');
$this->logger->channel(LogChannel::SECURITY)->alert('Alert message');
$this->logger->channel(LogChannel::SECURITY)->emergency('Emergency message');
expect($this->capturedRecords)->toHaveCount(8);
@@ -130,25 +133,29 @@ final class ChannelSystemTest extends TestCase
public function test_context_data_passed_correctly(): void
{
$context = [
$context = LogContext::withData([
'user_id' => 123,
'action' => 'login',
'metadata' => ['ip' => '127.0.0.1', 'browser' => 'Chrome'],
];
]);
$this->logger->security->warning('Authentication event', $context);
$this->logger->channel(LogChannel::SECURITY)->warning('Authentication event', $context);
expect($this->capturedRecords)->toHaveCount(1);
expect($this->capturedRecords[0]->getContext())->toBe($context);
expect($this->capturedRecords[0]->getContext())->toMatchArray([
'user_id' => 123,
'action' => 'login',
'metadata' => ['ip' => '127.0.0.1', 'browser' => 'Chrome'],
]);
expect($this->capturedRecords[0]->getChannel())->toBe('security');
}
public function test_channel_isolation(): void
{
// Jeder Channel sollte unabhängig funktionieren
$this->logger->security->error('Security error');
$this->logger->cache->error('Cache error');
$this->logger->database->error('Database error');
$this->logger->channel(LogChannel::SECURITY)->error('Security error');
$this->logger->channel(LogChannel::CACHE)->error('Cache error');
$this->logger->channel(LogChannel::DATABASE)->error('Database error');
expect($this->capturedRecords)->toHaveCount(3);
@@ -169,11 +176,11 @@ final class ChannelSystemTest extends TestCase
public function test_channel_enum_integration(): void
{
// Teste dass die Channels den Enum-Werten entsprechen
expect($this->logger->security->getChannel())->toBe(LogChannel::SECURITY);
expect($this->logger->cache->getChannel())->toBe(LogChannel::CACHE);
expect($this->logger->database->getChannel())->toBe(LogChannel::DATABASE);
expect($this->logger->framework->getChannel())->toBe(LogChannel::FRAMEWORK);
expect($this->logger->error->getChannel())->toBe(LogChannel::ERROR);
expect($this->logger->channel(LogChannel::SECURITY)->channel)->toBe(LogChannel::SECURITY);
expect($this->logger->channel(LogChannel::CACHE)->channel)->toBe(LogChannel::CACHE);
expect($this->logger->channel(LogChannel::DATABASE)->channel)->toBe(LogChannel::DATABASE);
expect($this->logger->channel(LogChannel::FRAMEWORK)->channel)->toBe(LogChannel::FRAMEWORK);
expect($this->logger->channel(LogChannel::ERROR)->channel)->toBe(LogChannel::ERROR);
// Teste dass die Channel-Namen korrekt sind
expect(LogChannel::SECURITY->value)->toBe('security');
@@ -188,26 +195,26 @@ final class ChannelSystemTest extends TestCase
// Simuliere eine realistische Anwendungssequenz
// 1. Framework startet
$this->logger->framework->info('Application starting');
$this->logger->channel(LogChannel::FRAMEWORK)->info('Application starting');
// 2. User versucht Login
$this->logger->security->info('Login attempt', ['email' => 'user@test.com']);
$this->logger->channel(LogChannel::SECURITY)->info('Login attempt', LogContext::withData(['email' => 'user@test.com']));
// 3. Cache Miss
$this->logger->cache->debug('User cache miss', ['email' => 'user@test.com']);
$this->logger->channel(LogChannel::CACHE)->debug('User cache miss', LogContext::withData(['email' => 'user@test.com']));
// 4. Database Query
$this->logger->database->debug('User lookup query', ['table' => 'users']);
$this->logger->channel(LogChannel::DATABASE)->debug('User lookup query', LogContext::withData(['table' => 'users']));
// 5. Successful authentication
$this->logger->security->info('Login successful', ['user_id' => 42]);
$this->logger->channel(LogChannel::SECURITY)->info('Login successful', LogContext::withData(['user_id' => 42]));
// 6. Cache Store
$this->logger->cache->info('User cached', ['user_id' => 42, 'ttl' => 3600]);
$this->logger->channel(LogChannel::CACHE)->info('User cached', LogContext::withData(['user_id' => 42, 'ttl' => 3600]));
// 7. Später: Ein Fehler
$this->logger->database->error('Connection timeout', ['host' => 'db.example.com']);
$this->logger->error->critical('Service degraded', ['affected' => ['users', 'orders']]);
$this->logger->channel(LogChannel::DATABASE)->error('Connection timeout', LogContext::withData(['host' => 'db.example.com']));
$this->logger->channel(LogChannel::ERROR)->critical('Service degraded', LogContext::withData(['affected' => ['users', 'orders']]));
expect($this->capturedRecords)->toHaveCount(8);