chore(v5): archive V5 implementation and remove runtime integration

Move V5 source, migrations, UI, scripts, and tests into documentation, then remove V5 routes, models, jobs, configuration, dependencies, and application hooks.
This commit is contained in:
Andras Bacsai committed 2026-08-15 19:13:30 +02:00
1 parent 1440d35750
commit 76030a30d4
237 files changed
+288 -7079

No files matched your search

@@ -1,54 +0,0 @@
<?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('v5_clusters', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->foreignId('team_id')->constrained('teams')->cascadeOnDelete();
$table->foreignId('created_by_user_id')->constrained('users')->cascadeOnDelete();
$table->string('name');
$table->text('description')->nullable();
$table->string('wireguard_interface')->default('wg0');
$table->string('wireguard_management_pool')->default('100.64.0.0/16');
$table->unsignedInteger('wireguard_listen_port')->default(51820);
$table->string('container_network_pool')->default('10.210.0.0/16');
$table->unsignedTinyInteger('container_network_prefix')->default(24);
$table->json('namespaces')->nullable();
$table->boolean('default_deny_containers')->default(true);
$table->string('coold_version')->default('nightly');
$table->string('corrosion_version')->default('v1.0.0');
$table->unsignedInteger('corrosion_gossip_port')->default(8787);
$table->unsignedInteger('corrosion_api_port')->default(8080);
$table->boolean('builder_enabled')->default(true);
$table->unsignedInteger('builder_capacity')->default(2);
$table->string('builder_cpu_quota')->default('200%');
$table->string('builder_memory_max')->default('2G');
$table->unsignedInteger('builder_timeout_secs')->default(1800);
$table->string('last_cli_action')->nullable();
$table->string('last_cli_status')->nullable();
$table->text('last_cli_summary')->nullable();
$table->timestamp('last_cli_ran_at')->nullable();
$table->timestamps();
$table->unique(['team_id', 'name']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('v5_clusters');
}
};
@@ -1,63 +0,0 @@
<?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('v5_servers', function (Blueprint $table) {
$table->id();
$table->string('uuid')->nullable()->unique();
$table->foreignId('team_id')->constrained('teams')->cascadeOnDelete();
$table->foreignId('cluster_id')->nullable()->constrained('v5_clusters')->nullOnDelete();
$table->foreignId('created_by_user_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('private_key_id')->nullable()->constrained('private_keys')->nullOnDelete();
$table->string('name');
$table->string('host');
$table->string('ssh_user');
$table->unsignedInteger('ssh_port')->default(22);
$table->string('status')->default('installed');
$table->string('ingress_type')->nullable();
$table->string('ingress_status')->nullable();
$table->json('capabilities')->nullable();
$table->boolean('builder_enabled')->default(false);
$table->unsignedInteger('builder_capacity')->default(0);
$table->string('builder_cpu_quota')->default('200%');
$table->string('node_address')->nullable();
$table->unsignedInteger('wireguard_listen_port_override')->nullable();
$table->string('wireguard_endpoint_override')->nullable();
$table->string('wireguard_management_ip')->nullable();
$table->string('wireguard_public_key')->nullable();
$table->json('container_subnets')->nullable();
$table->integer('canvas_x')->nullable();
$table->integer('canvas_y')->nullable();
$table->timestamp('last_bootstrapped_at')->nullable();
$table->string('last_bootstrap_action')->nullable();
$table->string('last_bootstrap_status')->nullable();
$table->text('last_bootstrap_output')->nullable();
$table->timestamp('last_bootstrap_ran_at')->nullable();
$table->string('last_status_check')->nullable();
$table->text('last_status_output')->nullable();
$table->timestamp('last_status_checked_at')->nullable();
$table->timestamps();
$table->unique(['team_id', 'host', 'ssh_port']);
$table->index(['team_id', 'cluster_id']);
$table->index(['team_id', 'status']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('v5_servers');
}
};
@@ -1,58 +0,0 @@
<?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('v5_applications', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->foreignId('team_id')->constrained('teams')->cascadeOnDelete();
$table->foreignId('project_id')->constrained('projects')->cascadeOnDelete();
$table->foreignId('environment_id')->constrained('environments')->cascadeOnDelete();
$table->foreignId('server_id')->nullable()->constrained('v5_servers')->nullOnDelete();
$table->foreignId('created_by_user_id')->constrained('users')->cascadeOnDelete();
$table->string('name');
$table->string('image');
$table->string('container_name')->unique();
$table->string('status')->default('creating');
$table->text('status_message')->nullable();
$table->string('runtime_container_id')->nullable();
$table->string('mesh_namespace')->default('default');
$table->boolean('ingress_enabled')->default(false);
$table->unsignedSmallInteger('internal_port')->nullable();
$table->integer('canvas_x')->default(0);
$table->integer('canvas_y')->default(0);
$table->timestamps();
$table->index(['team_id', 'status']);
$table->index(['team_id', 'project_id', 'environment_id']);
$table->index(['team_id', 'server_id']);
});
Schema::create('v5_application_domains', function (Blueprint $table) {
$table->id();
$table->foreignId('application_id')->constrained('v5_applications')->cascadeOnDelete();
$table->string('domain');
$table->timestamps();
$table->unique(['application_id', 'domain']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('v5_application_domains');
Schema::dropIfExists('v5_applications');
}
};
@@ -1,59 +0,0 @@
<?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('v5_resource_connections', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->foreignId('team_id')->constrained('teams')->cascadeOnDelete();
$table->foreignId('project_id')->constrained('projects')->cascadeOnDelete();
$table->foreignId('environment_id')->constrained('environments')->cascadeOnDelete();
$table->morphs('resource_one');
$table->morphs('resource_two');
$table->string('resource_pair_key');
$table->foreignId('created_by_user_id')->constrained('users')->cascadeOnDelete();
$table->timestamps();
$table->unique(['team_id', 'resource_pair_key']);
$table->index(['team_id', 'project_id', 'environment_id']);
});
Schema::create('v5_resource_connection_rules', function (Blueprint $table) {
$table->id();
$table->foreignId('connection_id')->constrained('v5_resource_connections')->cascadeOnDelete();
$table->morphs('source_resource');
$table->morphs('target_resource');
$table->string('protocol')->default('tcp');
$table->unsignedSmallInteger('port');
$table->timestamps();
$table->unique([
'connection_id',
'source_resource_type',
'source_resource_id',
'target_resource_type',
'target_resource_id',
'protocol',
'port',
], 'v5_resource_connection_rules_unique_direction_port');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('v5_resource_connection_rules');
Schema::dropIfExists('v5_resource_connections');
}
};
@@ -1,39 +0,0 @@
<?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('v5_container_statuses', function (Blueprint $table) {
$table->id();
$table->foreignId('team_id')->constrained('teams')->cascadeOnDelete();
$table->foreignId('server_id')->constrained('v5_servers')->cascadeOnDelete();
$table->string('container_id');
$table->string('container_name')->nullable();
$table->string('image')->nullable();
$table->string('status')->default('unknown');
$table->text('status_message')->nullable();
$table->timestamp('last_seen_at')->nullable();
$table->timestamps();
$table->unique(['server_id', 'container_id']);
$table->index(['team_id', 'server_id']);
$table->index(['team_id', 'status']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('v5_container_statuses');
}
};
@@ -1,48 +0,0 @@
<?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::table('v5_servers', function (Blueprint $table) {
$table->index('wireguard_management_ip');
$table->index('node_address');
$table->index('host');
});
Schema::table('v5_applications', function (Blueprint $table) {
$table->index('runtime_container_id');
});
Schema::table('v5_container_statuses', function (Blueprint $table) {
$table->index('last_seen_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->dropIndex(['wireguard_management_ip']);
$table->dropIndex(['node_address']);
$table->dropIndex(['host']);
});
Schema::table('v5_applications', function (Blueprint $table) {
$table->dropIndex(['runtime_container_id']);
});
Schema::table('v5_container_statuses', function (Blueprint $table) {
$table->dropIndex(['last_seen_at']);
});
}
};
@@ -1,39 +0,0 @@
<?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
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::table('v5_servers')
->whereNull('uuid')
->pluck('id')
->each(function (int $id): void {
DB::table('v5_servers')
->where('id', $id)
->update(['uuid' => Str::lower(Str::random(24))]);
});
Schema::table('v5_servers', function (Blueprint $table) {
$table->string('uuid')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->string('uuid')->nullable()->change();
});
}
};
@@ -1,44 +0,0 @@
<?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::table('v5_servers', function (Blueprint $table) {
$table->timestamp('status_observed_at')->nullable()->after('status');
});
Schema::table('v5_applications', function (Blueprint $table) {
$table->timestamp('status_observed_at')->nullable()->after('status_message');
});
Schema::table('v5_container_statuses', function (Blueprint $table) {
$table->timestamp('status_observed_at')->nullable()->after('status_message');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->dropColumn('status_observed_at');
});
Schema::table('v5_applications', function (Blueprint $table) {
$table->dropColumn('status_observed_at');
});
Schema::table('v5_container_statuses', function (Blueprint $table) {
$table->dropColumn('status_observed_at');
});
}
};
@@ -1,28 +0,0 @@
<?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::table('v5_servers', function (Blueprint $table) {
$table->string('coold_version')->nullable()->after('wireguard_public_key');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->dropColumn('coold_version');
});
}
};
@@ -1,74 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Rewrites v5 polymorphic rows that stored the Application FQCN (written
* before the 'v5.application' morph alias existed) so a future class rename
* cannot orphan them. New rows pick up the alias via getMorphClass().
*/
return new class extends Migration
{
private const FQCN = 'App\Models\V5\Application';
private const ALIAS = 'v5.application';
public function up(): void
{
$this->rewriteMorphTypes(self::FQCN, self::ALIAS);
$this->rewritePairKeys(self::FQCN, self::ALIAS);
}
public function down(): void
{
$this->rewriteMorphTypes(self::ALIAS, self::FQCN);
$this->rewritePairKeys(self::ALIAS, self::FQCN);
}
private function rewriteMorphTypes(string $from, string $to): void
{
if (Schema::hasTable('v5_resource_connections')) {
foreach (['resource_one_type', 'resource_two_type'] as $column) {
DB::table('v5_resource_connections')
->where($column, $from)
->update([$column => $to]);
}
}
if (Schema::hasTable('v5_resource_connection_rules')) {
foreach (['source_resource_type', 'target_resource_type'] as $column) {
DB::table('v5_resource_connection_rules')
->where($column, $from)
->update([$column => $to]);
}
}
}
private function rewritePairKeys(string $from, string $to): void
{
if (! Schema::hasTable('v5_resource_connections')) {
return;
}
// Backslash escaping in LIKE patterns differs between Postgres and
// SQLite, so match the FQCN in PHP instead of in SQL.
DB::table('v5_resource_connections')
->select(['id', 'resource_pair_key'])
->orderBy('id')
->chunkById(100, function ($connections) use ($from, $to): void {
foreach ($connections as $connection) {
if (! str_contains((string) $connection->resource_pair_key, $from)) {
continue;
}
DB::table('v5_resource_connections')
->where('id', $connection->id)
->update([
'resource_pair_key' => str_replace($from, $to, $connection->resource_pair_key),
]);
}
});
}
};
@@ -1,74 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Replaces the unindexable v5_servers.capabilities JSON array of magic strings
* with indexed has_coold / is_ingress booleans. The Server model keeps
* exposing a computed `capabilities` array so serialized payloads stay
* identical.
*/
return new class extends Migration
{
public function up(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->boolean('has_coold')->default(false)->index();
$table->boolean('is_ingress')->default(false)->index();
});
DB::table('v5_servers')
->select(['id', 'capabilities'])
->orderBy('id')
->chunkById(100, function ($servers): void {
foreach ($servers as $server) {
$capabilities = json_decode($server->capabilities ?? '[]', true);
if (! is_array($capabilities) || $capabilities === []) {
continue;
}
DB::table('v5_servers')->where('id', $server->id)->update([
'has_coold' => in_array('coold', $capabilities, true),
'is_ingress' => in_array('ingress', $capabilities, true),
]);
}
});
Schema::table('v5_servers', function (Blueprint $table) {
$table->dropColumn('capabilities');
});
}
public function down(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->json('capabilities')->nullable();
});
DB::table('v5_servers')
->select(['id', 'has_coold', 'is_ingress'])
->orderBy('id')
->chunkById(100, function ($servers): void {
foreach ($servers as $server) {
$capabilities = array_values(array_filter([
$server->has_coold ? 'coold' : null,
$server->is_ingress ? 'ingress' : null,
]));
DB::table('v5_servers')->where('id', $server->id)->update([
'capabilities' => json_encode($capabilities),
]);
}
});
Schema::table('v5_servers', function (Blueprint $table) {
$table->dropIndex(['has_coold']);
$table->dropIndex(['is_ingress']);
$table->dropColumn(['has_coold', 'is_ingress']);
});
}
};
@@ -1,22 +0,0 @@
<?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('v5_servers', function (Blueprint $table) {
$table->string('agent_token_jti')->nullable()->after('coold_version');
});
}
public function down(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->dropColumn('agent_token_jti');
});
}
};
@@ -1,25 +0,0 @@
<?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::create('v5_revoked_agent_tokens', function (Blueprint $table) {
$table->id();
$table->string('jti')->unique();
$table->foreignId('server_id')->nullable();
$table->timestamp('revoked_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('v5_revoked_agent_tokens');
}
};
@@ -1,22 +0,0 @@
<?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('v5_servers', function (Blueprint $table) {
$table->timestamp('agent_token_expires_at')->nullable()->after('agent_token_jti');
});
}
public function down(): void
{
Schema::table('v5_servers', function (Blueprint $table) {
$table->dropColumn('agent_token_expires_at');
});
}
};
@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* The uuid columns were added by editing the original v5 create migrations,
* so databases that ran those migrations before the edit (including the
* checked-in testing schema dump) are missing them. Guarded so freshly
* migrated databases are untouched.
*/
return new class extends Migration
{
private const TABLES = ['v5_applications', 'v5_clusters', 'v5_resource_connections'];
public function up(): void
{
foreach (self::TABLES as $tableName) {
if (! Schema::hasTable($tableName) || Schema::hasColumn($tableName, 'uuid')) {
continue;
}
Schema::table($tableName, function (Blueprint $table) {
$table->string('uuid')->nullable()->unique();
});
}
}
public function down(): void
{
// Intentionally left empty: the uuid columns belong to the create
// migrations; dropping them here could destroy live identifiers.
}
};
-149
View File
@@ -1311,146 +1311,6 @@ CREATE TABLE IF NOT EXISTS "users" (
"email_change_code_expires_at" TEXT
);
CREATE TABLE IF NOT EXISTS "v5_clusters" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"team_id" INTEGER NOT NULL,
"created_by_user_id" INTEGER NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"wireguard_interface" TEXT DEFAULT 'wg0' NOT NULL,
"wireguard_management_pool" TEXT DEFAULT '100.64.0.0/16' NOT NULL,
"wireguard_listen_port" INTEGER DEFAULT '51820' NOT NULL,
"container_network_pool" TEXT DEFAULT '10.210.0.0/16' NOT NULL,
"container_network_prefix" INTEGER DEFAULT '24' NOT NULL,
"namespaces" JSON,
"default_deny_containers" INTEGER DEFAULT true NOT NULL,
"coold_version" TEXT DEFAULT 'nightly' NOT NULL,
"corrosion_version" TEXT DEFAULT 'v1.0.0' NOT NULL,
"corrosion_gossip_port" INTEGER DEFAULT '8787' NOT NULL,
"corrosion_api_port" INTEGER DEFAULT '8080' NOT NULL,
"builder_enabled" INTEGER DEFAULT true NOT NULL,
"builder_capacity" INTEGER DEFAULT '2' NOT NULL,
"builder_cpu_quota" TEXT DEFAULT '200%' NOT NULL,
"builder_memory_max" TEXT DEFAULT '2G' NOT NULL,
"builder_timeout_secs" INTEGER NOT NULL DEFAULT '1800',
"last_cli_action" TEXT,
"last_cli_status" TEXT,
"last_cli_summary" TEXT,
"last_cli_ran_at" TEXT,
"created_at" TEXT,
"updated_at" TEXT
);
CREATE TABLE IF NOT EXISTS "v5_servers" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"uuid" TEXT,
"team_id" INTEGER NOT NULL,
"cluster_id" INTEGER,
"created_by_user_id" INTEGER NOT NULL,
"private_key_id" INTEGER,
"name" TEXT NOT NULL,
"host" TEXT NOT NULL,
"ssh_user" TEXT NOT NULL,
"ssh_port" INTEGER DEFAULT '22' NOT NULL,
"status" TEXT DEFAULT 'installed' NOT NULL,
"ingress_type" TEXT,
"ingress_status" TEXT,
"capabilities" TEXT,
"builder_enabled" INTEGER DEFAULT false NOT NULL,
"builder_capacity" INTEGER DEFAULT '0' NOT NULL,
"builder_cpu_quota" TEXT DEFAULT '200%' NOT NULL,
"node_address" TEXT,
"wireguard_listen_port_override" INTEGER,
"wireguard_endpoint_override" TEXT,
"wireguard_management_ip" TEXT,
"wireguard_public_key" TEXT,
"container_subnets" JSON,
"canvas_x" INTEGER,
"canvas_y" INTEGER,
"last_bootstrapped_at" TEXT,
"last_bootstrap_action" TEXT,
"last_bootstrap_status" TEXT,
"last_bootstrap_output" TEXT,
"last_bootstrap_ran_at" TEXT,
"last_status_check" TEXT,
"last_status_output" TEXT,
"last_status_checked_at" TEXT,
"created_at" TEXT,
"updated_at" TEXT
);
CREATE TABLE IF NOT EXISTS "v5_container_statuses" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"team_id" INTEGER NOT NULL,
"server_id" INTEGER NOT NULL,
"container_id" TEXT NOT NULL,
"container_name" TEXT,
"image" TEXT,
"status" TEXT DEFAULT 'unknown' NOT NULL,
"status_message" TEXT,
"last_seen_at" TEXT,
"created_at" TEXT,
"updated_at" TEXT
);
CREATE TABLE IF NOT EXISTS "v5_applications" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"team_id" INTEGER NOT NULL,
"project_id" INTEGER NOT NULL,
"environment_id" INTEGER NOT NULL,
"server_id" INTEGER,
"created_by_user_id" INTEGER NOT NULL,
"name" TEXT NOT NULL,
"image" TEXT NOT NULL,
"container_name" TEXT NOT NULL,
"status" TEXT DEFAULT 'creating' NOT NULL,
"status_message" TEXT,
"runtime_container_id" TEXT,
"mesh_namespace" TEXT DEFAULT 'default' NOT NULL,
"ingress_enabled" INTEGER DEFAULT false NOT NULL,
"internal_port" INTEGER,
"canvas_x" INTEGER DEFAULT '0' NOT NULL,
"canvas_y" INTEGER DEFAULT '0' NOT NULL,
"created_at" TEXT,
"updated_at" TEXT
);
CREATE TABLE IF NOT EXISTS "v5_application_domains" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"application_id" INTEGER NOT NULL,
"domain" TEXT NOT NULL,
"created_at" TEXT,
"updated_at" TEXT
);
CREATE TABLE IF NOT EXISTS "v5_resource_connections" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"team_id" INTEGER NOT NULL,
"project_id" INTEGER NOT NULL,
"environment_id" INTEGER NOT NULL,
"resource_one_type" TEXT NOT NULL,
"resource_one_id" INTEGER NOT NULL,
"resource_two_type" TEXT NOT NULL,
"resource_two_id" INTEGER NOT NULL,
"resource_pair_key" TEXT NOT NULL,
"created_by_user_id" INTEGER NOT NULL,
"created_at" TEXT,
"updated_at" TEXT
);
CREATE TABLE IF NOT EXISTS "v5_resource_connection_rules" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"connection_id" INTEGER NOT NULL,
"source_resource_type" TEXT NOT NULL,
"source_resource_id" INTEGER NOT NULL,
"target_resource_type" TEXT NOT NULL,
"target_resource_id" INTEGER NOT NULL,
"protocol" TEXT DEFAULT 'tcp' NOT NULL,
"port" INTEGER NOT NULL,
"created_at" TEXT,
"updated_at" TEXT
);
CREATE TABLE IF NOT EXISTS "webhook_notification_settings" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"team_id" INTEGER NOT NULL,
@@ -1559,11 +1419,6 @@ CREATE INDEX IF NOT EXISTS "user_changelog_reads_release_tag_index" ON "user_cha
CREATE INDEX IF NOT EXISTS "user_changelog_reads_user_id_index" ON "user_changelog_reads" (user_id);
CREATE UNIQUE INDEX IF NOT EXISTS "user_changelog_reads_user_id_release_tag_unique" ON "user_changelog_reads" (user_id, release_tag);
CREATE UNIQUE INDEX IF NOT EXISTS "users_email_unique" ON "users" (email);
CREATE UNIQUE INDEX IF NOT EXISTS "v5_applications_container_name_unique" ON "v5_applications" (container_name);
CREATE UNIQUE INDEX IF NOT EXISTS "v5_application_domains_application_id_domain_unique" ON "v5_application_domains" (application_id, domain);
CREATE UNIQUE INDEX IF NOT EXISTS "v5_resource_connections_team_id_resource_pair_key_unique" ON "v5_resource_connections" (team_id, resource_pair_key);
CREATE UNIQUE INDEX IF NOT EXISTS "v5_resource_connection_rules_unique_direction_port" ON "v5_resource_connection_rules" (connection_id, source_resource_type, source_resource_id, target_resource_type, target_resource_id, protocol, port);
CREATE UNIQUE INDEX IF NOT EXISTS "v5_servers_uuid_unique" ON "v5_servers" (uuid);
CREATE UNIQUE INDEX IF NOT EXISTS "webhook_notification_settings_team_id_unique" ON "webhook_notification_settings" (team_id);
-- Migration records
@@ -1881,8 +1736,4 @@ INSERT INTO "migrations" ("id", "migration", "batch") VALUES (312, '2025_12_15_1
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (313, '2025_12_17_000001_add_is_wire_navigate_enabled_to_instance_settings_table', 313);
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (314, '2025_12_17_000002_add_restart_tracking_to_standalone_databases', 314);
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (315, '2026_06_03_000000_add_oauth_fields_to_gitlab_apps_table', 315);
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (316, '2026_06_16_130649_v5_create_clusters_table', 316);
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (317, '2026_06_16_130650_v5_create_servers_table', 317);
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (318, '2026_06_19_140000_v5_create_applications_table', 318);
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (319, '2026_06_19_142000_v5_create_resource_connections_table', 319);
INSERT INTO "migrations" ("id", "migration", "batch") VALUES (320, '2026_06_19_182231_create_container_statuses_table', 320);
-74
View File
@@ -1,74 +0,0 @@
<?php
namespace Database\Seeders;
use App\Actions\V5\Server\SyncDevLimaServers;
use App\Models\PrivateKey;
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Seeder;
class V5DevLimaSeeder extends Seeder
{
private const CLUSTER_NAME = 'Development-Lima';
/**
* Run the database seeds.
*/
public function run(): void
{
$team = Team::query()->find(0) ?? Team::query()->orderBy('id')->first();
$user = User::query()->find(0) ?? User::query()->orderBy('id')->first();
if (! $team instanceof Team || ! $user instanceof User) {
return;
}
$privateKey = PrivateKey::query()
->where('team_id', $team->id)
->where('is_git_related', false)
->orderBy('id')
->first();
$sshUser = (string) config('coold.dev_ssh_user', 'coolify');
$servers = collect($this->servers())
->map(fn (array $server): array => [
...$server,
'ssh_user' => $sshUser,
])
->all();
SyncDevLimaServers::run(
team: $team,
user: $user,
privateKey: $privateKey,
clusterName: self::CLUSTER_NAME,
servers: $servers,
);
}
/**
* @return array<int, array{name: string, host: string, ssh_port: int, wireguard_management_ip: string, wireguard_listen_port_override: int, wireguard_endpoint_override: string}>
*/
private function servers(): array
{
return [
[
'name' => 'coold-dev',
'host' => 'coold-dev.local',
'ssh_port' => 22,
'wireguard_management_ip' => '100.64.0.1',
'wireguard_listen_port_override' => 51821,
'wireguard_endpoint_override' => 'coold-dev.local:51821',
],
[
'name' => 'coold-dev-2',
'host' => 'coold-dev-2.local',
'ssh_port' => 22,
'wireguard_management_ip' => '100.64.0.2',
'wireguard_listen_port_override' => 51822,
'wireguard_endpoint_override' => 'coold-dev-2.local:51822',
],
];
}
}