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,183 @@
<?php
declare(strict_types=1);
namespace App\Framework\Filesystem\Traits;
use App\Framework\Filesystem\Exceptions\FileNotFoundException;
use App\Framework\Filesystem\Exceptions\FileReadException;
use App\Framework\Filesystem\Exceptions\FileWriteException;
use Generator;
/**
* Trait für Stream-basierte In-Memory Storage-Operationen
*
* Implementiert Stream-Funktionalität für In-Memory Storage
* ohne echte File-Handles. Nutzt php://temp für Stream-Kompatibilität
* und schreibt Daten in das interne $files Array.
*/
trait InMemoryStreamableStorageTrait
{
/**
* Array mit Datei-Inhalten
* @var array<string, string>
*/
abstract protected function getFilesArray(): array;
/**
* Setzt Datei-Inhalt im Array
*/
abstract protected function setFileContent(string $path, string $content): void;
/**
* Prüft ob Datei existiert
*/
abstract public function exists(string $path): bool;
/**
* Erstellt Verzeichnis falls nötig
*/
abstract public function createDirectory(string $path, int $permissions = 0755, bool $recursive = true): void;
/**
* Öffnet einen Read-Stream für eine In-Memory Datei
*
* @return resource
*/
public function readStream(string $path)
{
if (!$this->exists($path)) {
throw new FileNotFoundException($path);
}
$files = $this->getFilesArray();
$content = $files[$path];
$stream = fopen('php://temp', 'r+');
if ($stream === false) {
throw new FileReadException($path);
}
fwrite($stream, $content);
rewind($stream);
return $stream;
}
/**
* Öffnet einen Write-Stream für eine In-Memory Datei
*
* Der Stream muss manuell mit putStream() oder durch StreamWriter.close()
* persistiert werden, sonst gehen die Daten verloren.
*
* @return resource
*/
public function writeStream(string $path)
{
$dir = dirname($path);
if ($dir !== '.' && $dir !== '/') {
$this->createDirectory($dir);
}
$stream = fopen('php://temp', 'r+');
if ($stream === false) {
throw new FileWriteException($path);
}
// Speichere Pfad als Stream-Metadaten für spätere Verwendung
stream_context_set_params($stream, ['inmemory_path' => $path]);
return $stream;
}
/**
* Öffnet einen Append-Stream für eine In-Memory Datei
*
* @return resource
*/
public function appendStream(string $path)
{
if (!$this->exists($path)) {
throw new FileNotFoundException($path);
}
$files = $this->getFilesArray();
$existingContent = $files[$path];
$stream = fopen('php://temp', 'r+');
if ($stream === false) {
throw new FileWriteException($path);
}
// Schreibe existierenden Inhalt
fwrite($stream, $existingContent);
// Cursor ans Ende bewegen für Append
fseek($stream, 0, SEEK_END);
// Speichere Pfad als Stream-Metadaten
stream_context_set_params($stream, ['inmemory_path' => $path]);
return $stream;
}
/**
* Schreibt Stream-Inhalt in In-Memory Datei
*
* @param resource $stream
*/
public function putStream(string $path, $stream): void
{
$dir = dirname($path);
if ($dir !== '.' && $dir !== '/') {
$this->createDirectory($dir);
}
// Stream an Anfang bewegen
rewind($stream);
// Gesamten Stream-Inhalt lesen
$content = stream_get_contents($stream);
if ($content === false) {
throw new FileWriteException($path);
}
// In In-Memory Array speichern
$this->setFileContent($path, $content);
}
/**
* Kopiert Datei Stream-basiert (In-Memory)
*/
public function copyStream(string $source, string $destination): void
{
if (!$this->exists($source)) {
throw new FileNotFoundException($source);
}
$sourceStream = $this->readStream($source);
$this->putStream($destination, $sourceStream);
fclose($sourceStream);
}
/**
* Liest Datei Zeile für Zeile (Generator für Memory-Effizienz)
*
* @return Generator<string>
*/
public function readLines(string $path): Generator
{
if (!$this->exists($path)) {
throw new FileNotFoundException($path);
}
$files = $this->getFilesArray();
$content = $files[$path];
// Split by newline and yield
$lines = explode("\n", $content);
foreach ($lines as $line) {
yield rtrim($line, "\r");
}
}
}

View File

@@ -7,6 +7,7 @@ namespace App\Framework\Filesystem\Traits;
use App\Framework\Filesystem\Exceptions\FileNotFoundException;
use App\Framework\Filesystem\Exceptions\FileReadException;
use App\Framework\Filesystem\Exceptions\FileWriteException;
use Generator;
/**
* Trait für Stream-basierte Storage-Operationen
@@ -83,7 +84,7 @@ trait StreamableStorageTrait
@fclose($sourceStream);
}
public function readLines(string $path): \Generator
public function readLines(string $path): Generator
{
$stream = $this->readStream($path);