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
refactor(database): streamline SSL configuration handling across database types
Andras Bacsai950acffe0b37
diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.phpindex b0c4f5d3ed..06dffdc223 100644--- a/app/Livewire/Project/Database/Mariadb/General.php+++ b/app/Livewire/Project/Database/Mariadb/General.php@@ -143,7 +143,6 @@ class General extends Componentpublic function instantSaveSSL(){try {- $this->database->enable_ssl = $this->database->enable_ssl;$this->database->save();$this->dispatch('success', 'SSL configuration updated.');} catch (Exception $e) {diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.phpindex 28be1c69d3..282547283f 100644--- a/app/Livewire/Project/Database/Mongodb/General.php+++ b/app/Livewire/Project/Database/Mongodb/General.php@@ -143,11 +143,14 @@ class General extends Component}}+ public function updatedDatabaseSslMode()+ {+ $this->instantSaveSSL();+ }+public function instantSaveSSL(){try {- $this->database->enable_ssl = $this->database->enable_ssl;- $this->database->ssl_mode = $this->database->ssl_mode;$this->database->save();$this->dispatch('success', 'SSL configuration updated.');} catch (Exception $e) {diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.phpindex 3e164d8859..c9424b5066 100644--- a/app/Livewire/Project/Database/Mysql/General.php+++ b/app/Livewire/Project/Database/Mysql/General.php@@ -142,11 +142,14 @@ class General extends Component}}+ public function updatedDatabaseSslMode()+ {+ $this->instantSaveSSL();+ }+public function instantSaveSSL(){try {- $this->database->enable_ssl = $this->database->enable_ssl;- $this->database->ssl_mode = $this->database->ssl_mode;$this->database->save();$this->dispatch('success', 'SSL configuration updated.');} catch (Exception $e) {diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.phpindex 881c74d534..3057f53169 100644--- a/app/Livewire/Project/Database/Postgresql/General.php+++ b/app/Livewire/Project/Database/Postgresql/General.php@@ -106,11 +106,14 @@ class General extends Component}}+ public function updatedDatabaseSslMode()+ {+ $this->instantSaveSSL();+ }+public function instantSaveSSL(){try {- $this->database->enable_ssl = $this->database->enable_ssl;- $this->database->ssl_mode = $this->database->ssl_mode;$this->database->save();$this->dispatch('success', 'SSL configuration updated.');} catch (Exception $e) {diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.phpindex a3916277d3..16519e2877 100644--- a/app/Livewire/Project/Database/Redis/General.php+++ b/app/Livewire/Project/Database/Redis/General.php@@ -151,7 +151,6 @@ class General extends Componentpublic function instantSaveSSL(){try {- $this->database->enable_ssl = $this->database->enable_ssl;$this->database->save();$this->dispatch('success', 'SSL configuration updated.');} catch (Exception $e) {diff --git a/app/View/Components/Forms/Select.php b/app/View/Components/Forms/Select.phpindex 86ae866c8f..b75cedaaec 100644--- a/app/View/Components/Forms/Select.php+++ b/app/View/Components/Forms/Select.php@@ -18,7 +18,7 @@ class Select extends Componentpublic ?string $label = null,public ?string $helper = null,public bool $required = false,- public string $defaultClass = 'select'+ public string $defaultClass = 'select w-full') {//}diff --git a/resources/views/components/forms/copy-button.blade.php b/resources/views/components/forms/copy-button.blade.phpindex 2e5f64c1a5..5ed41fe1ab 100644--- a/resources/views/components/forms/copy-button.blade.php+++ b/resources/views/components/forms/copy-button.blade.php@@ -2,9 +2,13 @@<div class="relative" x-data="{ copied: false }"><input type="text" value="{{ $text }}" readonly class="input">- <button @click="copied = true; navigator.clipboard.writeText('{{ $text }}'); setTimeout(() => copied = false, 1000)" class="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-gray-400 hover:text-gray-300 transition-colors" title="Copy to clipboard">+ <button+ @click.prevent="copied = true; navigator.clipboard.writeText('{{ $text }}'); setTimeout(() => copied = false, 1000)"+ class="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-gray-400 hover:text-gray-300 transition-colors"+ title="Copy to clipboard"><svg x-show="!copied" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"+ d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg><svg x-show="copied" class="w-5 h-5 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />diff --git a/resources/views/components/server/sidebar.blade.php b/resources/views/components/server/sidebar.blade.phpindex ecc5785aad..922995a1e0 100644--- a/resources/views/components/server/sidebar.blade.php+++ b/resources/views/components/server/sidebar.blade.php@@ -1,6 +1,11 @@<div class="flex flex-col items-start gap-2 min-w-fit"><a wire:navigate class="menu-item {{ $activeMenu === 'general' ? 'menu-item-active' : '' }}"href="{{ route('server.show', ['server_uuid' => $server->uuid]) }}">General</a>+ @if ($server->isFunctional())+ <a wire:navigate class="menu-item {{ $activeMenu === 'advanced' ? 'menu-item-active' : '' }}"+ href="{{ route('server.advanced', ['server_uuid' => $server->uuid]) }}">Advanced+ </a>+ @endif<a wire:navigate class="menu-item {{ $activeMenu === 'private-key' ? 'menu-item-active' : '' }}"href="{{ route('server.private-key', ['server_uuid' => $server->uuid]) }}">Private Key</a>@@ -16,9 +21,6 @@<a wire:navigate class="menu-item {{ $activeMenu === 'destinations' ? 'menu-item-active' : '' }}"href="{{ route('server.destinations', ['server_uuid' => $server->uuid]) }}">Destinations</a>- <a wire:navigate class="menu-item {{ $activeMenu === 'advanced' ? 'menu-item-active' : '' }}"- href="{{ route('server.advanced', ['server_uuid' => $server->uuid]) }}">Advanced- </a><a wire:navigate class="menu-item {{ $activeMenu === 'log-drains' ? 'menu-item-active' : '' }}"href="{{ route('server.log-drains', ['server_uuid' => $server->uuid]) }}">LogDrains</a>diff --git a/resources/views/livewire/project/database/dragonfly/general.blade.php b/resources/views/livewire/project/database/dragonfly/general.blade.phpindex 44765ae13f..b08162cb63 100644--- a/resources/views/livewire/project/database/dragonfly/general.blade.php+++ b/resources/views/livewire/project/database/dragonfly/general.blade.php@@ -53,34 +53,31 @@<div class="flex items-center justify-between py-2"><div class="flex items-center justify-between w-full"><h3>SSL Configuration</h3>- @if($database->enable_ssl && $certificateValidUntil)- <x-modal-confirmation- title="Regenerate SSL Certificates"- buttonTitle="Regenerate SSL Certificates"- :actions="[+ @if ($database->enable_ssl && $certificateValidUntil)+ <x-modal-confirmation title="Regenerate SSL Certificates"+ buttonTitle="Regenerate SSL Certificates" :actions="['The SSL certificate of this database will be regenerated.',- 'You must restart the database after regenerating the certificate to start using the new certificate.'+ 'You must restart the database after regenerating the certificate to start using the new certificate.',]"- submitAction="regenerateSslCertificate"- :confirmWithText="false"- :confirmWithPassword="false"- />+ submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" />@endif</div></div>- @if($database->enable_ssl && $certificateValidUntil)- <span class="text-sm">Valid until:- @if(now()->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>- @elseif(now()->addDays(30)->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span>- @else- <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>- @endif+ @if ($database->enable_ssl && $certificateValidUntil)+ <span class="text-sm">Valid until:+ @if (now()->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>+ @elseif(now()->addDays(30)->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring+ soon</span>+ @else+ <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>+ @endif</span>@endif<div class="flex flex-col gap-2">- <x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl" instantSave="instantSaveSSL" />+ <x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"+ instantSave="instantSaveSSL" /></div></div><div>diff --git a/resources/views/livewire/project/database/mongodb/general.blade.php b/resources/views/livewire/project/database/mongodb/general.blade.phpindex b060bca547..4e353306a4 100644--- a/resources/views/livewire/project/database/mongodb/general.blade.php+++ b/resources/views/livewire/project/database/mongodb/general.blade.php@@ -60,43 +60,44 @@<div class="flex items-center justify-between py-2"><div class="flex items-center justify-between w-full"><h3>SSL Configuration</h3>- @if($database->enable_ssl)- <x-modal-confirmation- title="Regenerate SSL Certificates"- buttonTitle="Regenerate SSL Certificates"- :actions="['The SSL certificate of this database will be regenerated.','You must restart the database after regenerating the certificate to start using the new certificate.']"- submitAction="regenerateSslCertificate"- :confirmWithText="false"- :confirmWithPassword="false"- />+ @if ($database->enable_ssl)+ <x-modal-confirmation title="Regenerate SSL Certificates"+ buttonTitle="Regenerate SSL Certificates" :actions="[+ 'The SSL certificate of this database will be regenerated.',+ 'You must restart the database after regenerating the certificate to start using the new certificate.',+ ]"+ submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" />@endif</div></div>- @if($database->enable_ssl && $certificateValidUntil)- <span class="text-sm">Valid until:- @if(now()->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>- @elseif(now()->addDays(30)->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span>- @else- <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>- @endif+ @if ($database->enable_ssl && $certificateValidUntil)+ <span class="text-sm">Valid until:+ @if (now()->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>+ @elseif(now()->addDays(30)->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring+ soon</span>+ @else+ <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>+ @endif</span>@endif</div><div class="flex flex-col gap-2"><div class="flex flex-col gap-2">- <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"- wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />- @if($database->enable_ssl)- <x-forms.select id="database.ssl_mode" label="SSL Mode"- wire:model.live="database.ssl_mode" instantSave="instantSaveSSL"- helper="Choose the SSL verification mode for MongoDB connections">- <option value="allow">allow</option>- <option value="prefer">prefer</option>- <option value="require">require</option>- <option value="verify-full">verify-full</option>- </x-forms.select>+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl"+ instantSave="instantSaveSSL" />+ @if ($database->enable_ssl)+ <div class="mx-2">+ <x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode"+ instantSave="instantSaveSSL"+ helper="Choose the SSL verification mode for MongoDB connections">+ <option value="allow" title="Allow insecure connections">allow (insecure)</option>+ <option value="prefer" title="Prefer secure connections">prefer (secure)</option>+ <option value="require" title="Require secure connections">require (secure)</option>+ <option value="verify-full" title="Verify full certificate">verify-full (secure)</option>+ </x-forms.select>+ </div>@endif</div></div>diff --git a/resources/views/livewire/project/database/mysql/general.blade.php b/resources/views/livewire/project/database/mysql/general.blade.phpindex 7bef884415..2a02dd9cd6 100644--- a/resources/views/livewire/project/database/mysql/general.blade.php+++ b/resources/views/livewire/project/database/mysql/general.blade.php@@ -70,41 +70,45 @@<div class="flex items-center justify-between py-2"><div class="flex items-center justify-between w-full"><h3>SSL Configuration</h3>- @if($database->enable_ssl && $certificateValidUntil)- <x-modal-confirmation- title="Regenerate SSL Certificates"- buttonTitle="Regenerate SSL Certificates"- :actions="['The SSL certificate of this database will be regenerated.','You must restart the database after regenerating the certificate to start using the new certificate.']"- submitAction="regenerateSslCertificate"- :confirmWithText="false"- :confirmWithPassword="false"- />+ @if ($database->enable_ssl && $certificateValidUntil)+ <x-modal-confirmation title="Regenerate SSL Certificates"+ buttonTitle="Regenerate SSL Certificates" :actions="[+ 'The SSL certificate of this database will be regenerated.',+ 'You must restart the database after regenerating the certificate to start using the new certificate.',+ ]"+ submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" />@endif</div></div>- @if($database->enable_ssl && $certificateValidUntil)- <span class="text-sm">Valid until:- @if(now()->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>- @elseif(now()->addDays(30)->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span>- @else- <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>- @endif+ @if ($database->enable_ssl && $certificateValidUntil)+ <span class="text-sm">Valid until:+ @if (now()->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>+ @elseif(now()->addDays(30)->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring+ soon</span>+ @else+ <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>+ @endif</span>@endif</div><div class="flex flex-col gap-2"><div class="flex flex-col gap-2">- <x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />- @if($database->enable_ssl)- <x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode" instantSave="instantSaveSSL"- helper="Choose the SSL verification mode for MySQL connections">- <option value="PREFERRED">PREFERRED</option>- <option value="REQUIRED">REQUIRED</option>- <option value="VERIFY_CA">VERIFY_CA</option>- <option value="VERIFY_IDENTITY">VERIFY_IDENTITY</option>- </x-forms.select>+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl"+ instantSave="instantSaveSSL" />+ @if ($database->enable_ssl)+ <div class="mx-2">+ <x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode"+ instantSave="instantSaveSSL"+ helper="Choose the SSL verification mode for MySQL connections">+ <option value="PREFERRED" title="Prefer secure connections">Prefer (secure)</option>+ <option value="REQUIRED" title="Require secure connections">Require (secure)</option>+ <option value="VERIFY_CA" title="Verify CA certificate">Verify CA (secure)</option>+ <option value="VERIFY_IDENTITY" title="Verify full certificate">Verify Full (secure)+ </option>+ </x-forms.select>+ </div>@endif</div></div>diff --git a/resources/views/livewire/project/database/postgresql/general.blade.php b/resources/views/livewire/project/database/postgresql/general.blade.phpindex e396b59c40..b90836ce88 100644--- a/resources/views/livewire/project/database/postgresql/general.blade.php+++ b/resources/views/livewire/project/database/postgresql/general.blade.php@@ -77,42 +77,45 @@<div class="flex items-center justify-between py-2"><div class="flex items-center justify-between w-full"><h3>SSL Configuration</h3>- @if($database->enable_ssl && $certificateValidUntil)- <x-modal-confirmation- title="Regenerate SSL Certificates"- buttonTitle="Regenerate SSL Certificates"- :actions="['The SSL certificate of this database will be regenerated.','You must restart the database after regenerating the certificate to start using the new certificate.']"- submitAction="regenerateSslCertificate"- :confirmWithText="false"- :confirmWithPassword="false"- />+ @if ($database->enable_ssl && $certificateValidUntil)+ <x-modal-confirmation title="Regenerate SSL Certificates"+ buttonTitle="Regenerate SSL Certificates" :actions="[+ 'The SSL certificate of this database will be regenerated.',+ 'You must restart the database after regenerating the certificate to start using the new certificate.',+ ]"+ submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" />@endif</div></div>- @if($database->enable_ssl && $certificateValidUntil)- <span class="text-sm">Valid until:- @if(now()->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>- @elseif(now()->addDays(30)->gt($certificateValidUntil))- <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span>- @else- <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>- @endif+ @if ($database->enable_ssl && $certificateValidUntil)+ <span class="text-sm">Valid until:+ @if (now()->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>+ @elseif(now()->addDays(30)->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring+ soon</span>+ @else+ <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>+ @endif</span>@endif</div><div class="flex flex-col gap-2"><div class="flex flex-col gap-2">- <x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />- @if($database->enable_ssl)- <x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode" instantSave="instantSaveSSL"- helper="Choose the SSL verification mode for PostgreSQL connections">- <option value="allow">allow</option>- <option value="prefer">prefer</option>- <option value="require">require</option>- <option value="verify-ca">verify-ca</option>- <option value="verify-full">verify-full</option>- </x-forms.select>+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl"+ instantSave="instantSaveSSL" />+ @if ($database->enable_ssl)+ <div class="mx-2">+ <x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode"+ instantSave="instantSaveSSL"+ helper="Choose the SSL verification mode for PostgreSQL connections">+ <option value="allow" title="Allow insecure connections">allow (insecure)</option>+ <option value="prefer" title="Prefer secure connections">prefer (secure)</option>+ <option value="require" title="Require secure connections">require (secure)</option>+ <option value="verify-ca" title="Verify CA certificate">verify-ca (secure)</option>+ <option value="verify-full" title="Verify full certificate">verify-full (secure)</option>+ </x-forms.select>+ </div>@endif</div></div>@@ -159,7 +162,8 @@<h3>Initialization scripts</h3><x-modal-input buttonTitle="+ Add" title="New Init Script"><form class="flex flex-col w-full gap-2 rounded" wire:submit='save_new_init_script'>- <x-forms.input placeholder="create_test_db.sql" id="new_filename" label="Filename" required />+ <x-forms.input placeholder="create_test_db.sql" id="new_filename" label="Filename"+ required /><x-forms.textarea rows="20" placeholder="CREATE DATABASE test;" id="new_content"label="Content" required /><x-forms.button type="submit">