From a539bfd765ef0aa6c97919aa47df314659c9c377 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 7 Feb 2025 18:45:12 +0100 Subject: [PATCH] fix(ssl): server id --- app/Actions/Database/StartMariadb.php | 2 +- app/Actions/Database/StartMysql.php | 2 +- app/Actions/Database/StartPostgresql.php | 2 +- app/Actions/Server/InstallDocker.php | 4 ++-- app/Livewire/Server/Advanced.php | 2 +- database/seeders/CaSslCertSeeder.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php index 50fd1ab00..b10ae3fde 100644 --- a/app/Actions/Database/StartMariadb.php +++ b/app/Actions/Database/StartMariadb.php @@ -59,7 +59,7 @@ public function handle(StandaloneMariadb $database) $this->commands[] = "mkdir -p $this->configuration_dir/ssl"; $server = $this->database->destination->server; - $caCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first(); + $caCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first(); $this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first(); diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php index bec1c7fb1..bda01dc1d 100644 --- a/app/Actions/Database/StartMysql.php +++ b/app/Actions/Database/StartMysql.php @@ -59,7 +59,7 @@ public function handle(StandaloneMysql $database) $this->commands[] = "mkdir -p $this->configuration_dir/ssl"; $server = $this->database->destination->server; - $caCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first(); + $caCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first(); $this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first(); diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php index 75f43a5ee..8f4bcb0d9 100644 --- a/app/Actions/Database/StartPostgresql.php +++ b/app/Actions/Database/StartPostgresql.php @@ -64,7 +64,7 @@ public function handle(StandalonePostgresql $database) $this->commands[] = "mkdir -p $this->configuration_dir/ssl"; $server = $this->database->destination->server; - $caCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first(); + $caCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first(); $this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first(); diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index 122371cf6..bbb3ea066 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -20,10 +20,10 @@ public function handle(Server $server) throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: documentation.'); } - if (! SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->exists()) { + if (! SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->exists()) { $serverCert = SslHelper::generateSslCertificate( commonName: 'Coolify CA Certificate', - serverId: $server->server_id, + serverId: $server->id, isCaCertificate: true, validityDays: 15 * 365 ); diff --git a/app/Livewire/Server/Advanced.php b/app/Livewire/Server/Advanced.php index 73a4391e6..497ec697e 100644 --- a/app/Livewire/Server/Advanced.php +++ b/app/Livewire/Server/Advanced.php @@ -49,7 +49,7 @@ public function mount(string $server_uuid) public function loadCaCertificate() { - $this->caCertificate = SslCertificate::where('server_id', $this->server->server_id)->where('is_ca_certificate', true)->first(); + $this->caCertificate = SslCertificate::where('server_id', $this->server->id)->where('is_ca_certificate', true)->first(); if ($this->caCertificate) { $this->certificateContent = $this->caCertificate->ssl_certificate; diff --git a/database/seeders/CaSslCertSeeder.php b/database/seeders/CaSslCertSeeder.php index 4a9d59eb2..b869ff96a 100644 --- a/database/seeders/CaSslCertSeeder.php +++ b/database/seeders/CaSslCertSeeder.php @@ -13,7 +13,7 @@ public function run() { Server::chunk(200, function ($servers) { foreach ($servers as $server) { - $existingCaCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first(); + $existingCaCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first(); if (! $existingCaCert) { $caCert = SslHelper::generateSslCertificate(