- 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>
76 lines
3.1 KiB
PHP
76 lines
3.1 KiB
PHP
<?php
|
|
|
|
use App\Services\Monitoring\HealthProbe;
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
|
|
/**
|
|
* Einbau des Monitorings in B2in (08.10.2026): /health auf jeder Domain, auch hinter der
|
|
* Basic Auth, Browserfehler in Web und Portal, jeder geplante Task mit Alarm.
|
|
*/
|
|
beforeEach(function () {
|
|
config()->set('monitoring.health.token', 'b2in-monitor-token');
|
|
config()->set('monitoring.health.disk_min_free_percent', 0);
|
|
app(HealthProbe::class)->recordHeartbeat();
|
|
});
|
|
|
|
afterEach(function () {
|
|
@unlink(HealthProbe::heartbeatPath());
|
|
});
|
|
|
|
it('answers the deep health check on every domain', function (string $host) {
|
|
$this->get("https://{$host}/health", ['Authorization' => 'Bearer b2in-monitor-token'])
|
|
->assertOk()
|
|
->assertJsonPath('status', 'ok');
|
|
|
|
$this->get("https://{$host}/health")->assertNotFound();
|
|
})->with(['b2in.test', 'portal.b2in.test', 'stileigentum.test']);
|
|
|
|
it('lets the monitor past the basic auth', function () {
|
|
config()->set('auth.basic', ['user' => 'kunde', 'password' => 'geheim']);
|
|
|
|
$request = Illuminate\Http\Request::create('https://irgendwo.example/health');
|
|
$passed = (new App\Http\Middleware\BasicAuthMiddleware)->handle($request, fn () => response('weiter'));
|
|
|
|
expect($passed->getContent())->toBe('weiter');
|
|
|
|
$other = Illuminate\Http\Request::create('https://irgendwo.example/admin');
|
|
expect((new App\Http\Middleware\BasicAuthMiddleware)->handle($other, fn () => response('weiter'))->getStatusCode())->toBe(401);
|
|
});
|
|
|
|
it('embeds browser error reporting in the website only with a dsn', function () {
|
|
$this->get('/')->assertSuccessful()->assertDontSee('pk-error-reporting', false);
|
|
|
|
config()->set('monitoring.browser.dsn', 'https://public@errors.example.com/2');
|
|
|
|
$this->get('/')->assertSuccessful()
|
|
->assertSee('name="pk-error-reporting"', false)
|
|
->assertSee('"area":"web"', false);
|
|
});
|
|
|
|
it('builds the error reporting script for the website and the portal', function () {
|
|
expect(file_get_contents(base_path('vite.web.config.js')))->toContain('"resources/js/error-reporting.js"')
|
|
->and(file_get_contents(base_path('vite.portal.config.js')))->toContain('"resources/js/error-reporting.js"')
|
|
->and(file_get_contents(resource_path('views/partials/head.blade.php')))
|
|
->toContain('<x-monitoring.browser-errors build="build/portal" area="portal" />');
|
|
});
|
|
|
|
it('alerts on every scheduled task and keeps the heartbeat running', function () {
|
|
$events = collect(app(Schedule::class)->events());
|
|
|
|
expect($events->map->command->implode("\n"))
|
|
->toContain('monitoring:heartbeat')
|
|
->toContain('queue:prune-failed')
|
|
->toContain('cabinet:reset-overrides');
|
|
|
|
foreach ($events as $event) {
|
|
$callbacks = (fn () => $this->afterCallbacks)->call($event);
|
|
|
|
expect($callbacks)->not->toBeEmpty("{$event->command} hat keinen Alarm bei Fehlschlag.");
|
|
}
|
|
});
|
|
|
|
it('shows the delivered version in artisan about', function () {
|
|
config()->set('app.version', 'v2.0.0');
|
|
|
|
$this->artisan('about', ['--only' => 'b2in'])->expectsOutputToContain('v2.0.0')->assertSuccessful();
|
|
});
|