initial commit

This commit is contained in:
TheOnlyMace
2026-05-17 13:26:14 +02:00
commit 75299b723d
176 changed files with 20327 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Console\Commands;
use App\Services\Hosting\Metrics\MetricsCollectorService;
use Illuminate\Console\Command;
class CollectVmMetricsCommand extends Command
{
protected $signature = 'hosting:collect-metrics';
protected $description = 'Sammelt VM-Metriken von Proxmox';
public function handle(MetricsCollectorService $collector): int
{
$count = $collector->collectAll();
$this->info("Metriken für {$count} VM(s) erfasst.");
return self::SUCCESS;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Console\Commands;
use App\Services\Hosting\Snapshots\SnapshotService;
use Illuminate\Console\Command;
class PruneSnapshotsCommand extends Command
{
protected $signature = 'hosting:prune-snapshots';
protected $description = 'Entfernt abgelaufene VM-Snapshots';
public function handle(SnapshotService $snapshots): int
{
$count = $snapshots->pruneExpired();
$this->info("{$count} Snapshot(s) bereinigt.");
return self::SUCCESS;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Console\Commands;
use App\Models\CustomerIsoUpload;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class PurgeExpiredIsoUploadsCommand extends Command
{
protected $signature = 'hosting:purge-iso-uploads';
protected $description = 'Remove expired customer ISO uploads from Proxmox storage';
public function handle(): int
{
$expired = CustomerIsoUpload::query()
->where('expires_at', '<=', now())
->get();
foreach ($expired as $upload) {
try {
// Proxmox delete via storage API when upload service is wired
Log::info('ISO upload expired', ['volid' => $upload->volid, 'user_id' => $upload->user_id]);
} catch (\Throwable $e) {
Log::warning('ISO purge failed', ['id' => $upload->id, 'error' => $e->getMessage()]);
}
$upload->delete();
}
$this->info("Purged {$expired->count()} expired ISO upload(s).");
return self::SUCCESS;
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Console\Commands;
use App\Models\Customer;
use App\Services\Hosting\Traefik\TraefikGenerator;
use Illuminate\Console\Command;
class RebuildTraefikRoutesCommand extends Command
{
protected $signature = 'hosting:traefik-rebuild {--reload : Reload Traefik after rebuild}';
protected $description = 'Rebuild all customer Traefik routes from database';
public function handle(TraefikGenerator $traefik): int
{
$customers = Customer::query()
->where('status', 'active')
->whereNotNull('ip_address')
->get();
$traefik->rebuildAllRoutes($customers);
if ($this->option('reload')) {
$traefik->reload();
}
$this->info("Rebuilt routes for {$customers->count()} active customers.");
return self::SUCCESS;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Console\Commands;
use App\Services\Hosting\Provisioning\VmidReservationService;
use Illuminate\Console\Command;
class ReleaseVmidReservationsCommand extends Command
{
protected $signature = 'hosting:release-vmids';
protected $description = 'Release VMIDs after retention period (default 48h)';
public function handle(VmidReservationService $service): int
{
$count = $service->releaseDue();
$this->info("Released {$count} VMID reservation(s).");
return self::SUCCESS;
}
}