fix(seeding): stop writing CA certificates to servers on startup

Remove the CA certificate seeder from production seeding. Add a regression
test verifying no CA certificate is created or remote task queued.
This commit is contained in:
Andras Bacsai
2026-10-12 10:35:20 +02:00
parent 068f02e274
commit 9893a5f503
2 changed files with 35 additions and 1 deletions
-1
View File
@@ -219,6 +219,5 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$this->call(PopulateSshKeysDirectorySeeder::class);
$this->call(SentinelSeeder::class);
$this->call(RootUserSeeder::class);
$this->call(CaSslCertSeeder::class);
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
use App\Jobs\CoolifyTask;
use App\Models\PrivateKey;
use App\Models\Server;
use App\Models\User;
use Database\Seeders\ProductionSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Storage;
uses(RefreshDatabase::class);
it('does not contact every server on start to write the CA certificate', function () {
DB::table('instance_settings')->insert(['id' => 0]);
$user = User::factory()->create();
$team = $user->teams()->first();
$server = Server::factory()->create([
'team_id' => $team->id,
'private_key_id' => PrivateKey::factory()->create(['team_id' => $team->id])->id,
]);
config()->set('constants.coolify.self_hosted', false);
Process::fake();
Queue::fake();
Storage::fake('ssh-keys');
Storage::fake('ssh-mux');
app(ProductionSeeder::class)->run();
expect($server->sslCertificates()->where('is_ca_certificate', true)->exists())->toBeFalse();
Queue::assertNotPushed(CoolifyTask::class);
});