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,102 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\Filesystem\ValueObjects\FilePath;
use App\Framework\Logging\DefaultLogger;
use App\Framework\Logging\LogLevel;
use App\Framework\Process\SystemProcess;
use App\Framework\Process\ValueObjects\Command;
use App\Framework\Process\ValueObjects\EnvironmentVariables;
echo "=== Process System Test ===\n\n";
// Setup logger
$logger = new DefaultLogger(LogLevel::DEBUG, []);
$process = new SystemProcess($logger);
// Test 1: Simple command
echo "Test 1: Simple echo command\n";
$result = $process->run(Command::fromArray(['echo', 'Hello Process!']));
echo "Success: " . ($result->isSuccess() ? 'YES' : 'NO') . "\n";
echo "Output: " . trim($result->stdout) . "\n";
echo "Exit Code: " . $result->exitCode->value . " ({$result->exitCode->getDescription()})\n";
echo "Runtime: " . $result->runtime->toHumanReadable() . "\n";
echo "\n";
// Test 2: Command with array
echo "Test 2: Multiple commands\n";
$result = $process->run(Command::fromString('echo "line1" && echo "line2"'));
echo "Success: " . ($result->isSuccess() ? 'YES' : 'NO') . "\n";
echo "Output:\n" . $result->stdout;
echo "\n";
// Test 3: Working Directory
echo "Test 3: Working directory\n";
$tempDir = FilePath::create(sys_get_temp_dir());
$result = $process->run(
command: Command::fromString('pwd'),
workingDirectory: $tempDir
);
echo "Success: " . ($result->isSuccess() ? 'YES' : 'NO') . "\n";
echo "Current Directory: " . trim($result->stdout) . "\n";
echo "\n";
// Test 4: Environment Variables
echo "Test 4: Environment variables\n";
$env = EnvironmentVariables::fromArray(['MY_VAR' => 'test_value']);
$result = $process->run(
command: Command::fromString('echo $MY_VAR'),
env: $env
);
echo "Success: " . ($result->isSuccess() ? 'YES' : 'NO') . "\n";
echo "MY_VAR value: " . trim($result->stdout) . "\n";
echo "\n";
// Test 5: Failed command
echo "Test 5: Failed command (exit 1)\n";
$result = $process->run(Command::fromString('exit 1'));
echo "Success: " . ($result->isSuccess() ? 'YES' : 'NO') . "\n";
echo "Is Failed: " . ($result->isFailed() ? 'YES' : 'NO') . "\n";
echo "Exit Code: " . $result->exitCode->value . " ({$result->exitCode->getDescription()})\n";
echo "\n";
// Test 6: Command existence
echo "Test 6: Command existence check\n";
$exists = $process->commandExists('echo');
echo "'echo' exists: " . ($exists ? 'YES' : 'NO') . "\n";
$exists = $process->commandExists('nonexistent_cmd_xyz');
echo "'nonexistent_cmd_xyz' exists: " . ($exists ? 'YES' : 'NO') . "\n";
echo "\n";
// Test 7: Async process
echo "Test 7: Async process execution\n";
$running = $process->start(Command::fromArray(['sleep', '0.2']));
echo "Process started, PID: " . $running->getPid() . "\n";
echo "Is running: " . ($running->isRunning() ? 'YES' : 'NO') . "\n";
$result = $running->wait();
echo "Process completed\n";
echo "Success: " . ($result->isSuccess() ? 'YES' : 'NO') . "\n";
echo "Runtime: " . $result->runtime->toHumanReadable() . "\n";
echo "\n";
// Test 8: ProcessResult toArray()
echo "Test 8: ProcessResult to array\n";
$result = $process->run(Command::fromString('echo "test"'));
$array = $result->toArray();
echo "Array keys: " . implode(', ', array_keys($array)) . "\n";
echo "Success in array: " . ($array['success'] ? 'YES' : 'NO') . "\n";
echo "\n";
// Test 9: Value Objects
echo "Test 9: Value Objects immutability\n";
$env1 = EnvironmentVariables::fromArray(['A' => '1']);
$env2 = $env1->with('B', '2');
echo "env1 has 'B': " . ($env1->has('B') ? 'YES' : 'NO') . "\n";
echo "env2 has 'B': " . ($env2->has('B') ? 'YES' : 'NO') . "\n";
echo "Immutability preserved: " . (! $env1->has('B') && $env2->has('B') ? 'YES' : 'NO') . "\n";
echo "\n";
echo "=== All Tests Complete ===\n";