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

@@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
use App\Framework\QrCode\ValueObjects\Module;
test('can create dark module', function () {
$module = Module::dark();
expect($module->isDark())->toBeTrue()
->and($module->isLight())->toBeFalse();
});
test('can create light module', function () {
$module = Module::light();
expect($module->isLight())->toBeTrue()
->and($module->isDark())->toBeFalse();
});
test('can create from boolean', function () {
$dark = Module::fromBool(true);
$light = Module::fromBool(false);
expect($dark->isDark())->toBeTrue()
->and($light->isLight())->toBeTrue();
});
test('can create from bit', function () {
$dark = Module::fromBit(1);
$light = Module::fromBit(0);
expect($dark->isDark())->toBeTrue()
->and($light->isLight())->toBeTrue();
});
test('can convert to bit', function () {
$dark = Module::dark();
$light = Module::light();
expect($dark->toBit())->toBe(1)
->and($light->toBit())->toBe(0);
});
test('can invert module', function () {
$dark = Module::dark();
$light = Module::light();
$invertedDark = $dark->invert();
$invertedLight = $light->invert();
expect($invertedDark->isLight())->toBeTrue()
->and($invertedLight->isDark())->toBeTrue();
});
test('invert returns new instance', function () {
$original = Module::dark();
$inverted = $original->invert();
// Original unchanged
expect($original->isDark())->toBeTrue()
->and($inverted->isLight())->toBeTrue();
});
test('can convert to string', function () {
$dark = Module::dark();
$light = Module::light();
expect($dark->toString())->toBe('█')
->and($light->toString())->toBe('░');
});
test('dark and light are opposites', function () {
$dark = Module::dark();
$light = Module::light();
expect($dark->isDark())->not->toBe($light->isDark())
->and($dark->isLight())->not->toBe($light->isLight());
});
test('module is immutable', function () {
$module = Module::dark();
// Attempting to invert doesn't change original
$module->invert();
expect($module->isDark())->toBeTrue();
});

View File

@@ -0,0 +1,153 @@
<?php
declare(strict_types=1);
use App\Framework\QrCode\ValueObjects\Module;
use App\Framework\QrCode\ValueObjects\ModulePosition;
use App\Framework\QrCode\ValueObjects\QrCodeMatrix;
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
test('can create empty matrix', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
expect($matrix->getSize())->toBe(21)
->and($matrix->getVersion()->getVersionNumber())->toBe(1);
});
test('empty matrix has all light modules', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$module = $matrix->getModuleAt(0, 0);
expect($module->isLight())->toBeTrue();
});
test('can set and get module', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$position = ModulePosition::at(5, 5);
$matrix = $matrix->setModule($position, Module::dark());
expect($matrix->getModule($position)->isDark())->toBeTrue();
});
test('setting module returns new instance', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix1 = QrCodeMatrix::create($version);
$position = ModulePosition::at(5, 5);
$matrix2 = $matrix1->setModule($position, Module::dark());
// Original matrix unchanged (immutability)
expect($matrix1->getModule($position)->isLight())->toBeTrue()
->and($matrix2->getModule($position)->isDark())->toBeTrue();
});
test('can set module using coordinates', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$matrix = $matrix->setModuleAt(10, 10, Module::dark());
expect($matrix->getModuleAt(10, 10)->isDark())->toBeTrue();
});
test('can use helper methods setDark and setLight', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$pos1 = ModulePosition::at(5, 5);
$pos2 = ModulePosition::at(10, 10);
$matrix = $matrix->setDark($pos1);
$matrix = $matrix->setLight($pos2);
expect($matrix->getModule($pos1)->isDark())->toBeTrue()
->and($matrix->getModule($pos2)->isLight())->toBeTrue();
});
test('can check if position is dark', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$position = ModulePosition::at(5, 5);
$matrix = $matrix->setDark($position);
expect($matrix->isDark($position))->toBeTrue();
});
test('throws exception for out of bounds position', function () {
$version = QrCodeVersion::fromNumber(1); // Size = 21
$matrix = QrCodeMatrix::create($version);
$position = ModulePosition::at(25, 25); // Out of bounds
$matrix->getModule($position);
})->throws(\App\Framework\Exception\FrameworkException::class);
test('can convert to array', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$array = $matrix->toArray();
expect($array)->toBeArray()
->and(count($array))->toBe(21)
->and(count($array[0]))->toBe(21);
});
test('can convert to binary string', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$matrix = $matrix->setModuleAt(0, 0, Module::dark());
$matrix = $matrix->setModuleAt(0, 1, Module::light());
$binary = $matrix->toBinaryString();
expect($binary)->toBeString()
->and($binary)->toContain('1')
->and($binary)->toContain('0')
->and($binary)->toContain("\n");
});
test('can convert to ASCII art', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
$matrix = $matrix->setModuleAt(0, 0, Module::dark());
$matrix = $matrix->setModuleAt(0, 1, Module::light());
$ascii = $matrix->toAsciiArt();
expect($ascii)->toBeString()
->and($ascii)->toContain('█')
->and($ascii)->toContain('░');
});
test('can count dark modules', function () {
$version = QrCodeVersion::fromNumber(1);
$matrix = QrCodeMatrix::create($version);
// Add some dark modules
$matrix = $matrix->setModuleAt(0, 0, Module::dark());
$matrix = $matrix->setModuleAt(1, 1, Module::dark());
$matrix = $matrix->setModuleAt(2, 2, Module::dark());
$count = $matrix->countDarkModules();
expect($count)->toBe(3);
});
test('matrix size scales with version', function () {
$matrix1 = QrCodeMatrix::create(QrCodeVersion::fromNumber(1));
$matrix2 = QrCodeMatrix::create(QrCodeVersion::fromNumber(2));
$matrix3 = QrCodeMatrix::create(QrCodeVersion::fromNumber(3));
expect($matrix1->getSize())->toBe(21)
->and($matrix2->getSize())->toBe(25)
->and($matrix3->getSize())->toBe(29);
});