An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(ssl): get caCert correctly
peaklabs-dev6a52f518515f
diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.phpindex f97d732c9d..50fd1ab00b 100644--- a/app/Actions/Database/StartMariadb.php+++ b/app/Actions/Database/StartMariadb.php@@ -57,12 +57,11 @@ class StartMariadb} else {$this->commands[] = "echo 'Setting up SSL for this database.'";$this->commands[] = "mkdir -p $this->configuration_dir/ssl";+$server = $this->database->destination->server;- $caCert = SslCertificate::where('server_id', $server->id)->firstOrFail();+ $caCert = SslCertificate::where('server_id', $server->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();+ $this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();if (! $this->ssl_certificate) {$this->commands[] = "echo 'No SSL certificate found, generating new SSL certificate for this database.'";diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.phpindex cbdda33813..bec1c7fb1d 100644--- a/app/Actions/Database/StartMysql.php+++ b/app/Actions/Database/StartMysql.php@@ -57,12 +57,11 @@ class StartMysql} else {$this->commands[] = "echo 'Setting up SSL for this database.'";$this->commands[] = "mkdir -p $this->configuration_dir/ssl";+$server = $this->database->destination->server;- $caCert = SslCertificate::where('server_id', $server->id)->firstOrFail();+ $caCert = SslCertificate::where('server_id', $server->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();+ $this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();if (! $this->ssl_certificate) {$this->commands[] = "echo 'No SSL certificate found, generating new SSL certificate for this database.'";diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.phpindex b582136a3c..75f43a5ee0 100644--- a/app/Actions/Database/StartPostgresql.php+++ b/app/Actions/Database/StartPostgresql.php@@ -62,9 +62,9 @@ class StartPostgresql} else {$this->commands[] = "echo 'Setting up SSL for this database.'";$this->commands[] = "mkdir -p $this->configuration_dir/ssl";- $server = $this->database->destination->server;- $caCert = SslCertificate::where('server_id', $server->id)->firstOrFail();+ $server = $this->database->destination->server;+ $caCert = SslCertificate::where('server_id', $server->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/Jobs/RegenerateSslCertJob.php b/app/Jobs/RegenerateSslCertJob.phpindex 0155ee798a..3e4bf90706 100644--- a/app/Jobs/RegenerateSslCertJob.php+++ b/app/Jobs/RegenerateSslCertJob.php@@ -47,10 +47,7 @@ class RegenerateSslCertJob implements ShouldQueueforeach ($certificates as $certificate) {try {- $caCert = SslCertificate::where('server_id', $certificate->server_id)- ->where('resource_type', null)- ->where('resource_id', null)- ->first();+ $caCert = SslCertificate::where('server_id', $certificate->server_id)->where('is_ca_certificate', true)->first();SSLHelper::generateSslCertificate(commonName: $certificate->common_name,