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).
57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
<?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])
|
|
);
|
|
}
|
|
}
|
|
}
|