Add managed registry provisioning, pruning, and readiness tracking

This commit is contained in:
2026-06-08 20:44:16 +01:00
parent 5b977c1f41
commit 3a851db08f
52 changed files with 2706 additions and 116 deletions

View File

@@ -28,6 +28,8 @@ class ServerFactory extends Factory
'os' => 'ubuntu',
'plan' => '26',
'user' => 'keystone',
'is_control_node' => false,
'build_enabled' => false,
];
}

View File

@@ -0,0 +1,91 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
return new class extends Migration
{
public function up(): void
{
Schema::table('registries', function (Blueprint $table) {
$table->string('storage_path')->nullable()->after('url');
$table->unsignedInteger('retention_successful_artifacts')->default(3)->after('storage_path');
$table->string('health_status')->default('pending')->after('retention_successful_artifacts');
$table->text('health_message')->nullable()->after('health_status');
$table->json('readiness_checks')->nullable()->after('health_message');
$table->timestamp('health_checked_at')->nullable()->after('readiness_checks');
$table->timestamp('ready_at')->nullable()->after('health_checked_at');
$table->foreignId('control_server_id')->nullable()->after('ready_at')->constrained('servers')->nullOnDelete();
});
Schema::table('servers', function (Blueprint $table) {
$table->boolean('is_control_node')->default(false)->after('user');
$table->boolean('build_enabled')->default(false)->after('is_control_node');
});
Schema::table('operations', function (Blueprint $table) {
$table->json('metadata')->nullable()->after('status');
});
Schema::table('applications', function (Blueprint $table) {
$table->uuid('uuid')->nullable()->after('id');
});
Schema::table('environments', function (Blueprint $table) {
$table->uuid('uuid')->nullable()->after('id');
});
DB::table('applications')->whereNull('uuid')->orderBy('id')->each(function (object $application): void {
DB::table('applications')->where('id', $application->id)->update(['uuid' => (string) Str::uuid()]);
});
DB::table('environments')->whereNull('uuid')->orderBy('id')->each(function (object $environment): void {
DB::table('environments')->where('id', $environment->id)->update(['uuid' => (string) Str::uuid()]);
});
Schema::table('applications', function (Blueprint $table) {
$table->unique('uuid');
});
Schema::table('environments', function (Blueprint $table) {
$table->unique('uuid');
});
}
public function down(): void
{
Schema::table('environments', function (Blueprint $table) {
$table->dropUnique(['uuid']);
$table->dropColumn('uuid');
});
Schema::table('applications', function (Blueprint $table) {
$table->dropUnique(['uuid']);
$table->dropColumn('uuid');
});
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn(['is_control_node', 'build_enabled']);
});
Schema::table('operations', function (Blueprint $table) {
$table->dropColumn('metadata');
});
Schema::table('registries', function (Blueprint $table) {
$table->dropConstrainedForeignId('control_server_id');
$table->dropColumn([
'storage_path',
'retention_successful_artifacts',
'health_status',
'health_message',
'readiness_checks',
'health_checked_at',
'ready_at',
]);
});
}
};