Admin Menü neu geordnet.

Introduced a two-tier media pipeline with dynamic disks, asset tracking, admin controls, and alerting around
  upload/archival workflows.
  - Added storage metadata + asset tables and models so every photo/variant knows where it lives
 (database/migrations/2025_10_20_090000_create_media_storage_targets_table.php, database/  migrations/2025_10_20_090200_create_event_media_assets_table.php, app/Models/MediaStorageTarget.php:1, app/
    Models/EventMediaAsset.php:1, app/Models/EventStorageAssignment.php:1, app/Models/Event.php:27).
  - Rewired guest and tenant uploads to pick the event’s hot disk, persist EventMediaAsset records, compute
    checksums, and clean up on delete (app/Http/Controllers/Api/EventPublicController.php:243, app/Http/
Controllers/Api/Tenant/PhotoController.php:25, app/Models/Photo.php:25).
  - Implemented storage services, archival job scaffolding, monitoring config, and queue-failure notifications for upload issues (app/Services/Storage/EventStorageManager.php:16, app/Services/Storage/
    StorageHealthService.php:9, app/Jobs/ArchiveEventMediaAssets.php:16, app/Providers/AppServiceProvider.php:39, app/Notifications/UploadPipelineFailed.php:8, config/storage-monitor.php:1).
  - Seeded default hot/cold targets and exposed super-admin tooling via a Filament resource and capacity widget (database/seeders/MediaStorageTargetSeeder.php:13, database/seeders/DatabaseSeeder.php:17, app/Filament/Resources/MediaStorageTargetResource.php:1, app/Filament/Widgets/StorageCapacityWidget.php:12, app/Providers/Filament/SuperAdminPanelProvider.php:47).
- Dropped cron skeletons and artisan placeholders to schedule storage monitoring, archival dispatch, and upload queue health checks (cron/storage_monitor.sh, cron/archive_dispatcher.sh, cron/upload_queue_health.sh, routes/console.php:9).
This commit is contained in:
Codex Agent
2025-10-17 22:26:13 +02:00
parent 48a2974152
commit 5817270c35
44 changed files with 1336 additions and 72 deletions

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('media_storage_targets', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->string('name');
$table->string('driver')->default('local');
$table->json('config')->nullable();
$table->boolean('is_hot')->default(false);
$table->boolean('is_default')->default(false);
$table->boolean('is_active')->default(true);
$table->unsignedInteger('priority')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('media_storage_targets');
}
};

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('event_storage_assignments', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained()->cascadeOnDelete();
$table->foreignId('media_storage_target_id')->constrained()->cascadeOnDelete();
$table->string('role')->default('hot'); // hot, archive
$table->string('status')->default('active'); // active, pending, archived, restoring
$table->timestamp('assigned_at')->nullable();
$table->timestamp('released_at')->nullable();
$table->json('meta')->nullable();
$table->timestamps();
$table->index(['event_id', 'role', 'status']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('event_storage_assignments');
}
};

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('event_media_assets', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained()->cascadeOnDelete();
$table->foreignId('media_storage_target_id')->constrained()->cascadeOnDelete();
$table->foreignId('photo_id')->nullable()->constrained('photos')->nullOnDelete();
$table->string('variant')->default('original'); // original, thumbnail, etc.
$table->string('disk');
$table->string('path');
$table->unsignedBigInteger('size_bytes')->nullable();
$table->string('checksum')->nullable();
$table->string('mime_type')->nullable();
$table->string('status')->default('pending'); // pending, hot, archived, restoring, failed
$table->timestamp('processed_at')->nullable();
$table->timestamp('archived_at')->nullable();
$table->timestamp('restored_at')->nullable();
$table->text('error_message')->nullable();
$table->json('meta')->nullable();
$table->timestamps();
$table->index(['event_id', 'variant', 'status']);
$table->index(['media_storage_target_id', 'status']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('event_media_assets');
}
};

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('photos', function (Blueprint $table) {
$table->foreignId('media_asset_id')
->nullable()
->after('file_path')
->constrained('event_media_assets')
->nullOnDelete();
});
}
public function down(): void
{
Schema::table('photos', function (Blueprint $table) {
$table->dropConstrainedForeignId('media_asset_id');
});
}
};

View File

@@ -13,6 +13,7 @@ class DatabaseSeeder extends Seeder
{
// Seed basic system data
$this->call([
MediaStorageTargetSeeder::class,
LegalPagesSeeder::class,
PackageSeeder::class,
]);

View File

@@ -0,0 +1,56 @@
<?php
namespace Database\Seeders;
use App\Models\MediaStorageTarget;
use Illuminate\Database\Seeder;
use Illuminate\Support\Arr;
class MediaStorageTargetSeeder extends Seeder
{
public function run(): void
{
$targets = [
[
'key' => 'local-ssd',
'name' => 'Local SSD (Hot Storage)',
'driver' => 'local',
'config' => [
'root' => storage_path('app/public'),
'visibility' => 'public',
'url' => rtrim(config('app.url', env('APP_URL', 'http://localhost')), '/').'/storage',
'monitor_path' => storage_path('app/public'),
],
'is_hot' => true,
'is_default' => true,
'priority' => 100,
],
[
'key' => 'hetzner-archive',
'name' => 'Hetzner Storage Box (Archive)',
'driver' => 'sftp',
'config' => [
'host' => env('HETZNER_STORAGE_HOST', 'storagebox.example.com'),
'username' => env('HETZNER_STORAGE_USERNAME', 'u000000'),
'password' => env('HETZNER_STORAGE_PASSWORD'),
'port' => (int) env('HETZNER_STORAGE_PORT', 22),
'root' => env('HETZNER_STORAGE_ROOT', '/fotospiel'),
'timeout' => 30,
'monitor_path' => env('HETZNER_STORAGE_MONITOR_PATH', '/mnt/hetzner'),
],
'is_hot' => false,
'is_default' => false,
'priority' => 50,
],
];
foreach ($targets as $payload) {
$config = Arr::pull($payload, 'config');
MediaStorageTarget::updateOrCreate(
['key' => $payload['key']],
array_merge($payload, ['config' => $config])
);
}
}
}

View File

@@ -14,37 +14,7 @@ class PackageSeeder extends Seeder
public function run(): void
{
$packages = [
[
'slug' => 'free-package',
'name' => 'Free / Test',
'name_translations' => [
'de' => 'Free / Test',
'en' => 'Free / Test',
],
'type' => PackageType::ENDCUSTOMER,
'price' => 0.00,
'max_photos' => 120,
'max_guests' => 25,
'gallery_days' => 7,
'max_tasks' => 8,
'watermark_allowed' => true,
'branding_allowed' => false,
'features' => ['basic_uploads', 'limited_sharing'],
'description' => <<<TEXT
Perfekt zum Ausprobieren: Teile erste Eindrücke mit {{max_guests}} Gästen und sammle {{max_photos}} Bilder in einer Test-Galerie, die {{gallery_duration}} online bleibt. Ideal für kleine Runden oder interne Demos.
TEXT,
'description_translations' => [
'de' => 'Perfekt zum Ausprobieren: Teile erste Eindrücke mit {{max_guests}} Gästen und sammle {{max_photos}} Bilder in einer Test-Galerie, die {{gallery_duration}} online bleibt. Ideal für kleine Runden oder interne Demos.',
'en' => 'Perfect for trying it out: share first impressions with {{max_guests}} guests and collect {{max_photos}} photos in a test gallery that stays online for {{gallery_duration}}. Ideal for small groups or internal demos.',
],
'description_table' => [
['title' => 'Fotos', 'value' => '{{max_photos}}'],
['title' => 'Gäste', 'value' => '{{max_guests}}'],
['title' => 'Aufgaben', 'value' => '{{max_tasks}} Fotoaufgaben'],
['title' => 'Galerie', 'value' => '{{gallery_duration}}'],
['title' => 'Branding', 'value' => 'Fotospiel Standard Branding'],
],
],
[
'slug' => 'starter',
'name' => 'Starter',
@@ -53,7 +23,7 @@ TEXT,
'en' => 'Starter',
],
'type' => PackageType::ENDCUSTOMER,
'price' => 59.00,
'price' => 29.00,
'max_photos' => 300,
'max_guests' => 50,
'gallery_days' => 14,
@@ -84,7 +54,7 @@ TEXT,
'en' => 'Standard',
],
'type' => PackageType::ENDCUSTOMER,
'price' => 129.00,
'price' => 59.00,
'max_photos' => 1000,
'max_guests' => 150,
'gallery_days' => 30,
@@ -115,7 +85,7 @@ TEXT,
'en' => 'Premium',
],
'type' => PackageType::ENDCUSTOMER,
'price' => 249.00,
'price' => 129.00,
'max_photos' => 3000,
'max_guests' => 500,
'gallery_days' => 180,
@@ -146,7 +116,7 @@ TEXT,
'en' => 'Reseller S',
],
'type' => PackageType::RESELLER,
'price' => 299.00,
'price' => 149.00,
'max_photos' => 1000,
'max_guests' => null,
'gallery_days' => 30,
@@ -177,7 +147,7 @@ TEXT,
'en' => 'Reseller M',
],
'type' => PackageType::RESELLER,
'price' => 599.00,
'price' => 349.00,
'max_photos' => 1500,
'max_guests' => null,
'gallery_days' => 60,
@@ -208,7 +178,7 @@ TEXT,
'en' => 'Reseller L',
],
'type' => PackageType::RESELLER,
'price' => 1199.00,
'price' => 699.00,
'max_photos' => 3000,
'max_guests' => null,
'gallery_days' => 90,
@@ -239,7 +209,7 @@ TEXT,
'en' => 'Enterprise / Unlimited',
],
'type' => PackageType::RESELLER,
'price' => 0.00,
'price' => 1999.00,
'max_photos' => null,
'max_guests' => null,
'gallery_days' => null,