Git-Deploy per Tag, Betriebsüberwachung und Release-Seeder für den Livegang

- dev/betrieb/deploy.sh: Deploy nur per Tag, mit --seed (Seeder im Wartungsmodus)
  und --initial (Vorschau/Live einmalig an Ort und Stelle auf Git umstellen)
- dev/betrieb/vorschau-auffrischen.sh: Live-DB und Live-Medien in die Vorschau (Generalprobe)
- InteriorReleaseSeeder: alle Inhaltsschritte des Relaunchs in einem Lauf, idempotent;
  Displays, Playlists und Mediathek bleiben unberührt
- DisplayInteriorBrandingSeeder überschreibt keinen inzwischen gepflegten Claim mehr
- Monitoring: GlitchTip (Server + Browser), /health mit Token, Scheduler-Herzschlag,
  Alarme per Mail und ntfy, Version in about und /health
- public/build versioniert; .gitignore: macOS-Muster Icon traf resources/views/flux/icon/
- Runbook: dev/betrieb/README.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-10-09 08:56:23 +00:00
parent fcb10be120
commit b5ed756d67
98 changed files with 3947 additions and 82 deletions

View file

@ -0,0 +1,91 @@
<?php
use App\Services\Monitoring\HealthProbe;
use Illuminate\Support\Facades\DB;
/**
* Tiefer Health-Check und Scheduler-Herzschlag. Der Herzschlag liegt in
* einer Datei unter storage/ — vor und nach jedem Test entfernen.
*/
beforeEach(function () {
@unlink(HealthProbe::heartbeatPath());
config()->set('monitoring.health.token', 'geheimes-monitor-token');
config()->set('monitoring.health.disk_min_free_percent', 0);
config()->set('queue.default', 'database');
});
afterEach(function () {
@unlink(HealthProbe::heartbeatPath());
});
function healthHeaders(): array
{
return ['Authorization' => 'Bearer geheimes-monitor-token'];
}
test('the endpoint does not exist without a configured token or with a wrong one', function () {
app(HealthProbe::class)->recordHeartbeat();
$this->get('/health', healthHeaders())->assertOk();
$this->get('/health', ['Authorization' => 'Bearer falsch'])->assertNotFound();
$this->get('/health')->assertNotFound();
config()->set('monitoring.health.token', null);
$this->get('/health', healthHeaders())->assertNotFound();
});
test('a healthy system answers 200 with every check', function () {
config()->set('app.version', 'v1.1.0');
$this->artisan('monitoring:heartbeat')->assertSuccessful();
$this->get('/health?token=geheimes-monitor-token')
->assertOk()
->assertHeader('Cache-Control', 'no-store, private')
->assertJsonPath('status', 'ok')
->assertJsonPath('version', 'v1.1.0')
->assertJsonPath('checks.database.status', 'ok')
->assertJsonPath('checks.cache.status', 'ok')
->assertJsonPath('checks.queue.status', 'ok')
->assertJsonPath('checks.scheduler.status', 'ok')
->assertJsonStructure(['checks' => ['disk' => ['status', 'detail']]]);
});
test('a missing or stale heartbeat makes the endpoint fail', function () {
$this->get('/health', healthHeaders())
->assertStatus(503)
->assertJsonPath('checks.scheduler.status', 'critical');
app(HealthProbe::class)->recordHeartbeat();
$this->travel(4)->minutes();
$this->get('/health', healthHeaders())->assertOk()->assertJsonPath('checks.scheduler.status', 'warn');
$this->travel(7)->minutes();
$this->get('/health', healthHeaders())->assertStatus(503)->assertJsonPath('checks.scheduler.status', 'critical');
});
test('a queue backlog older than five minutes makes the endpoint fail', function () {
app(HealthProbe::class)->recordHeartbeat();
DB::table('jobs')->insert([
'queue' => 'default',
'payload' => '{}',
'attempts' => 0,
'reserved_at' => null,
'available_at' => now()->subMinutes(6)->getTimestamp(),
'created_at' => now()->subMinutes(6)->getTimestamp(),
]);
$this->get('/health', healthHeaders())
->assertStatus(503)
->assertJsonPath('checks.queue.status', 'critical');
});
test('the endpoint skips the session and the web middleware group', function () {
app(HealthProbe::class)->recordHeartbeat();
$this->get('/health', healthHeaders())
->assertOk()
->assertCookieMissing(config('session.cookie'));
});