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

@@ -34,19 +34,19 @@ describe('JobId Value Object', function () {
});
it('rejects empty JobId', function () {
expect(fn() => JobId::fromString(''))
expect(fn () => JobId::fromString(''))
->toThrow(\InvalidArgumentException::class, 'JobId cannot be empty');
});
it('validates JobId format correctly', function () {
// Valid formats should work
expect(fn() => JobId::fromString('job_12345'))->not->toThrow();
expect(fn() => JobId::fromString('01FXYZ0123456789ABCDEF1234'))->not->toThrow(); // ULID format
expect(fn() => JobId::fromString('simple-id'))->not->toThrow();
expect(fn () => JobId::fromString('job_12345'))->not->toThrow();
expect(fn () => JobId::fromString('01FXYZ0123456789ABCDEF1234'))->not->toThrow(); // ULID format
expect(fn () => JobId::fromString('simple-id'))->not->toThrow();
// Any non-empty string is currently accepted
expect(fn() => JobId::fromString('a'))->not->toThrow();
expect(fn() => JobId::fromString('very-long-job-identifier-12345'))->not->toThrow();
expect(fn () => JobId::fromString('a'))->not->toThrow();
expect(fn () => JobId::fromString('very-long-job-identifier-12345'))->not->toThrow();
});
it('is readonly and immutable', function () {
@@ -207,7 +207,7 @@ describe('JobId Value Object', function () {
$nonUlidJobId = JobId::fromString('not-a-ulid-format');
// This should throw an exception since it's not a valid ULID
expect(fn() => $nonUlidJobId->toUlid())
expect(fn () => $nonUlidJobId->toUlid())
->toThrow();
});
@@ -215,7 +215,7 @@ describe('JobId Value Object', function () {
$nonUlidJobId = JobId::fromString('simple-job-id');
// This should throw an exception since it's not a valid ULID
expect(fn() => $nonUlidJobId->getTimestamp())
expect(fn () => $nonUlidJobId->getTimestamp())
->toThrow();
});
});
@@ -301,7 +301,7 @@ describe('JobId in Queue Context', function () {
$completedJobs[$jobId->toString()] = [
'started_at' => $processingJobs[$jobId->toString()],
'completed_at' => time(),
'status' => 'success'
'status' => 'success',
];
unset($processingJobs[$jobId->toString()]);
@@ -342,4 +342,4 @@ describe('JobId in Queue Context', function () {
expect($normalTime > $urgentTime)->toBeTrue();
});
});
});

View File

@@ -2,29 +2,32 @@
declare(strict_types=1);
use App\Framework\Core\ValueObjects\Duration;
use App\Framework\Queue\ValueObjects\JobMetadata;
use App\Framework\Queue\ValueObjects\JobPayload;
use App\Framework\Queue\ValueObjects\QueuePriority;
use App\Framework\Queue\ValueObjects\JobMetadata;
use App\Framework\Core\ValueObjects\Duration;
use App\Framework\Retry\Strategies\ExponentialBackoffStrategy;
use App\Framework\Retry\Strategies\FixedDelayStrategy;
describe('JobPayload Value Object', function () {
beforeEach(function () {
$this->simpleJob = new class {
public function handle(): string {
$this->simpleJob = new class () {
public function handle(): string
{
return 'executed';
}
};
$this->complexJob = new class {
$this->complexJob = new class () {
public function __construct(
public string $id = 'test-123',
public array $data = ['key' => 'value']
) {}
) {
}
public function process(): array {
public function process(): array
{
return $this->data;
}
};
@@ -354,19 +357,22 @@ describe('JobPayload Value Object', function () {
});
it('handles complex job objects with dependencies', function () {
$complexJob = new class {
$complexJob = new class () {
public array $config;
public \DateTime $created;
public function __construct() {
public function __construct()
{
$this->config = ['timeout' => 30, 'retries' => 3];
$this->created = new \DateTime();
}
public function getData(): array {
public function getData(): array
{
return [
'config' => $this->config,
'created' => $this->created->format('Y-m-d H:i:s')
'created' => $this->created->format('Y-m-d H:i:s'),
];
}
};
@@ -391,26 +397,30 @@ describe('JobPayload Value Object', function () {
describe('JobPayload Integration Scenarios', function () {
beforeEach(function () {
$this->emailJob = new class {
$this->emailJob = new class () {
public function __construct(
public string $to = 'test@example.com',
public string $subject = 'Test Email',
public string $body = 'Hello World'
) {}
) {
}
public function send(): bool {
public function send(): bool
{
// Simulate email sending
return true;
}
};
$this->reportJob = new class {
$this->reportJob = new class () {
public function __construct(
public array $criteria = ['period' => 'monthly'],
public string $format = 'pdf'
) {}
) {
}
public function generate(): string {
public function generate(): string
{
return "Report generated with format: {$this->format}";
}
};
@@ -442,7 +452,7 @@ describe('JobPayload Integration Scenarios', function () {
$metadata = JobMetadata::create([
'user_id' => 123,
'report_type' => 'financial',
'department' => 'accounting'
'department' => 'accounting',
]);
$customReport = $monthlyReport->withMetadata($metadata);
@@ -481,4 +491,4 @@ describe('JobPayload Integration Scenarios', function () {
expect($rateLimitedPayload->retryStrategy->getMaxAttempts())->toBe(5);
expect($rateLimitedPayload->retryStrategy)->toBeInstanceOf(ExponentialBackoffStrategy::class);
});
});
});

View File

@@ -2,10 +2,10 @@
declare(strict_types=1);
use App\Framework\Queue\ValueObjects\LockKey;
use App\Framework\Queue\ValueObjects\JobId;
use App\Framework\Queue\ValueObjects\WorkerId;
use App\Framework\Queue\ValueObjects\LockKey;
use App\Framework\Queue\ValueObjects\QueueName;
use App\Framework\Queue\ValueObjects\WorkerId;
describe('LockKey Value Object', function () {
it('can create lock keys from strings', function () {
@@ -18,18 +18,18 @@ describe('LockKey Value Object', function () {
it('validates lock key constraints', function () {
// Empty key
expect(fn() => LockKey::fromString(''))
expect(fn () => LockKey::fromString(''))
->toThrow(\InvalidArgumentException::class, 'Lock key cannot be empty');
// Too long
expect(fn() => LockKey::fromString(str_repeat('a', 256)))
expect(fn () => LockKey::fromString(str_repeat('a', 256)))
->toThrow(\InvalidArgumentException::class, 'Lock key cannot exceed 255 characters');
// Invalid characters
expect(fn() => LockKey::fromString('invalid@key!'))
expect(fn () => LockKey::fromString('invalid@key!'))
->toThrow(\InvalidArgumentException::class, 'Lock key contains invalid characters');
expect(fn() => LockKey::fromString('key with spaces'))
expect(fn () => LockKey::fromString('key with spaces'))
->toThrow(\InvalidArgumentException::class, 'Lock key contains invalid characters');
});
@@ -40,7 +40,7 @@ describe('LockKey Value Object', function () {
'key.with.dots',
'key123',
'UPPERCASE-key',
'mixed-Key_123.test'
'mixed-Key_123.test',
];
foreach ($validKeys as $key) {
@@ -152,4 +152,4 @@ describe('LockKey Value Object', function () {
expect($rowLock->matches('database.users.*'))->toBeTrue();
expect($rowLock->matches('*.row-123'))->toBeTrue();
});
});
});

View File

@@ -34,7 +34,7 @@ describe('WorkerId Value Object', function () {
});
it('validates worker ID is not empty', function () {
expect(fn() => WorkerId::fromString(''))
expect(fn () => WorkerId::fromString(''))
->toThrow(\InvalidArgumentException::class, 'WorkerId cannot be empty');
});
@@ -64,4 +64,4 @@ describe('WorkerId Value Object', function () {
expect($workerId->jsonSerialize())->toBe($id);
expect(json_encode($workerId))->toBe('"' . $id . '"');
});
});
});