Skip to content

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.

refactor(database): enhance SSL configuration handling for various databases

Andras Bacsaid7ded7f8e5d7
diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.php
index 51f8b5a662..ed5c9fd262 100644
--- a/app/Livewire/Project/Database/Dragonfly/General.php
+++ b/app/Livewire/Project/Database/Dragonfly/General.php
@@ -60,10 +60,12 @@ class General extends Component
public function getListeners()
{
+ $userId = Auth::id();
$teamId = Auth::user()->currentTeam()->id;
return [
"echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped',
+ "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
];
}
diff --git a/app/Livewire/Project/Database/Heading.php b/app/Livewire/Project/Database/Heading.php
index c3b57b9f4d..9ddb1909cc 100644
--- a/app/Livewire/Project/Database/Heading.php
+++ b/app/Livewire/Project/Database/Heading.php
@@ -31,8 +31,8 @@ class Heading extends Component
$this->database->update([
'started_at' => now(),
]);
- $this->dispatch('refresh');
$this->check_status();
+
if (is_null($this->database->config_hash) || $this->database->isConfigurationChanged()) {
$this->database->isConfigurationChanged(true);
$this->dispatch('configurationChanged');
@@ -44,7 +44,7 @@ class Heading extends Component
public function check_status($showNotification = false)
{
if ($this->database->destination->server->isFunctional()) {
- GetContainersStatus::dispatch($this->database->destination->server);
+ GetContainersStatus::run($this->database->destination->server);
}
if ($showNotification) {
@@ -63,6 +63,7 @@ class Heading extends Component
$this->database->status = 'exited';
$this->database->save();
$this->check_status();
+ $this->dispatch('refresh');
}
public function restart()
diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.php
index 213b0d2d33..a7c589f3e0 100644
--- a/app/Livewire/Project/Database/Keydb/General.php
+++ b/app/Livewire/Project/Database/Keydb/General.php
@@ -63,10 +63,13 @@ class General extends Component
public function getListeners()
{
+ $userId = Auth::id();
$teamId = Auth::user()->currentTeam()->id;
return [
"echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped',
+ "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
+ 'refresh' => '$refresh',
];
}
diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.php
index 06dffdc223..ceac4bffb2 100644
--- a/app/Livewire/Project/Database/Mariadb/General.php
+++ b/app/Livewire/Project/Database/Mariadb/General.php
@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server;
use App\Models\SslCertificate;
use App\Models\StandaloneMariadb;
+use Auth;
use Carbon\Carbon;
use Exception;
use Livewire\Component;
@@ -26,6 +27,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null;
+ public function getListeners()
+ {
+ $userId = Auth::id();
+
+ return [
+ "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
+ 'refresh' => '$refresh',
+ ];
+ }
+
protected $rules = [
'database.name' => 'required',
'database.description' => 'nullable',
diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php
index 282547283f..5d3702d9f6 100644
--- a/app/Livewire/Project/Database/Mongodb/General.php
+++ b/app/Livewire/Project/Database/Mongodb/General.php
@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server;
use App\Models\SslCertificate;
use App\Models\StandaloneMongodb;
+use Auth;
use Carbon\Carbon;
use Exception;
use Livewire\Component;
@@ -26,6 +27,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null;
+ public function getListeners()
+ {
+ $userId = Auth::id();
+
+ return [
+ "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
+ 'refresh' => '$refresh',
+ ];
+ }
+
protected $rules = [
'database.name' => 'required',
'database.description' => 'nullable',
diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.php
index c9424b5066..bb6964ef66 100644
--- a/app/Livewire/Project/Database/Mysql/General.php
+++ b/app/Livewire/Project/Database/Mysql/General.php
@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server;
use App\Models\SslCertificate;
use App\Models\StandaloneMysql;
+use Auth;
use Carbon\Carbon;
use Exception;
use Livewire\Component;
@@ -26,6 +27,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null;
+ public function getListeners()
+ {
+ $userId = Auth::id();
+
+ return [
+ "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
+ 'refresh' => '$refresh',
+ ];
+ }
+
protected $rules = [
'database.name' => 'required',
'database.description' => 'nullable',
diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.php
index 3057f53169..8440086d9c 100644
--- a/app/Livewire/Project/Database/Postgresql/General.php
+++ b/app/Livewire/Project/Database/Postgresql/General.php
@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server;
use App\Models\SslCertificate;
use App\Models\StandalonePostgresql;
+use Auth;
use Carbon\Carbon;
use Exception;
use Livewire\Component;
@@ -30,8 +31,11 @@ class General extends Component
public function getListeners()
{
+ $userId = Auth::id();
+
return [
- 'refresh',
+ "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
+ 'refresh' => '$refresh',
'save_init_script',
'delete_init_script',
];
@@ -204,7 +208,7 @@ class General extends Component
$delete_command = "rm -f $old_file_path";
try {
instant_remote_process([$delete_command], $this->server);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
$this->dispatch('error', 'Failed to remove old init script from server: '.$e->getMessage());
return;
@@ -245,7 +249,7 @@ class General extends Component
$command = "rm -f $file_path";
try {
instant_remote_process([$command], $this->server);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
$this->dispatch('error', 'Failed to remove init script from server: '.$e->getMessage());
return;
@@ -262,16 +266,11 @@ class General extends Component
$this->database->init_scripts = $updatedScripts;
$this->database->save();
- $this->refresh();
+ $this->dispatch('refresh')->self();
$this->dispatch('success', 'Init script deleted from the database and the server.');
}
}
- public function refresh(): void
- {
- $this->database->refresh();
- }
-
public function save_new_init_script()
{
$this->validate([
diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php
index 16519e2877..455367aa02 100644
--- a/app/Livewire/Project/Database/Redis/General.php
+++ b/app/Livewire/Project/Database/Redis/General.php
@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server;
use App\Models\SslCertificate;
use App\Models\StandaloneRedis;
+use Auth;
use Carbon\Carbon;
use Exception;
use Livewire\Component;
@@ -35,6 +36,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null;
+ public function getListeners()
+ {
+ $userId = Auth::id();
+
+ return [
+ "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
+ 'refresh' => '$refresh',
+ ];
+ }
+
protected $rules = [
'database.name' => 'required',
'database.description' => 'nullable',
diff --git a/app/View/Components/Forms/Select.php b/app/View/Components/Forms/Select.php
index b75cedaaec..feb4bf3430 100644
--- a/app/View/Components/Forms/Select.php
+++ b/app/View/Components/Forms/Select.php
@@ -18,6 +18,7 @@ class Select extends Component
public ?string $label = null,
public ?string $helper = null,
public bool $required = false,
+ public bool $disabled = false,
public string $defaultClass = 'select w-full'
) {
//
diff --git a/resources/css/app.css b/resources/css/app.css
index 175ac32596..815eb2abe8 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -46,7 +46,7 @@ body {
.input,
.select {
- @apply text-black dark:bg-coolgray-100 dark:text-white ring-neutral-200 dark:ring-coolgray-300 block w-full py-1.5 rounded border-0 text-sm ring-1 ring-inset;
+ @apply text-black dark:bg-coolgray-100 dark:text-white ring-neutral-200 dark:ring-coolgray-300 block w-full py-1.5 rounded border-0 text-sm ring-1 ring-inset disabled:dark:bg-coolgray-100/40 disabled:dark:ring-transparent disabled:bg-neutral-200 disabled:text-neutral-500;
}
.select {
@@ -97,6 +97,7 @@ label {
@apply dark:text-neutral-400;
}
+
table {
@apply min-w-full divide-y dark:divide-coolgray-200 divide-neutral-300;
}
diff --git a/resources/views/components/forms/select.blade.php b/resources/views/components/forms/select.blade.php
index 4da9eca1be..508a85e0c5 100644
--- a/resources/views/components/forms/select.blade.php
+++ b/resources/views/components/forms/select.blade.php
@@ -1,6 +1,7 @@
<div class="w-full">
@if ($label)
- <label class="flex gap-1 items-center mb-1 text-sm font-medium">{{ $label }}
+ <label
+ class="flex gap-1 items-center mb-1 text-sm font-medium {{ $disabled ? 'text-neutral-600' : '' }}">{{ $label }}
@if ($required)
<x-highlighted text="*" />
@endif
@@ -9,7 +10,7 @@
@endif
</label>
@endif
- <select {{ $attributes->merge(['class' => $defaultClass]) }} @required($required)
+ <select {{ $attributes->merge(['class' => $defaultClass]) }} @disabled($disabled) @required($required)
wire:dirty.class.remove='dark:focus:ring-coolgray-300 dark:ring-coolgray-300'
wire:dirty.class="dark:focus:ring-warning dark:ring-warning" wire:loading.attr="disabled" name={{ $id }}
@if ($attributes->whereStartsWith('wire:model')->first()) {{ $attributes->whereStartsWith('wire:model')->first() }} @else wire:model={{ $id }} @endif>
diff --git a/resources/views/livewire/project/database/dragonfly/general.blade.php b/resources/views/livewire/project/database/dragonfly/general.blade.php
index b08162cb63..60ad75d057 100644
--- a/resources/views/livewire/project/database/dragonfly/general.blade.php
+++ b/resources/views/livewire/project/database/dragonfly/general.blade.php
@@ -76,8 +76,16 @@
</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" />
+ <div class="w-64">
+ @if (str($database->status)->contains('exited'))
+ <x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
+ instantSave="instantSaveSSL" />
+ @else
+ <x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
+ instantSave="instantSaveSSL" disabled
+ helper="Database should be stopped to change this settings." />
+ @endif
+ </div>
</div>
</div>
<div>
diff --git a/resources/views/livewire/project/database/keydb/general.blade.php b/resources/views/livewire/project/database/keydb/general.blade.php
index 58a41c2890..065303f75f 100644
--- a/resources/views/livewire/project/database/keydb/general.blade.php
+++ b/resources/views/livewire/project/database/keydb/general.blade.php
@@ -53,34 +53,39 @@
<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" />
+ <div class="w-64">
+ @if (str($database->status)->contains('exited'))
+ <x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
+ instantSave="instantSaveSSL" />
+ @else
+ <x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
+ instantSave="instantSaveSSL" disabled
+ helper="Database should be stopped to change this settings." />
+ @endif
+ </div>
</div>
</div>
<div>
diff --git a/resources/views/livewire/project/database/mariadb/general.blade.php b/resources/views/livewire/project/database/mariadb/general.blade.php
index 96ba3a06a3..6186e4a82a 100644
--- a/resources/views/livewire/project/database/mariadb/general.blade.php
+++ b/resources/views/livewire/project/database/mariadb/general.blade.php
@@ -70,36 +70,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 && $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" />
+ <div class="w-64">
+ @if (str($database->status)->contains('exited'))
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
+ @else
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
+ helper="Database should be stopped to change this settings." />
+ @endif
+ </div>
</div>
</div>
-
+
<div>
<div class="flex flex-col py-2 w-64">
<div class="flex items-center gap-2 pb-2">
diff --git a/resources/views/livewire/project/database/mongodb/general.blade.php b/resources/views/livewire/project/database/mongodb/general.blade.php
index 4e353306a4..83c7f53049 100644
--- a/resources/views/livewire/project/database/mongodb/general.blade.php
+++ b/resources/views/livewire/project/database/mongodb/general.blade.php
@@ -85,52 +85,73 @@
</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" />
+ {{ $database->status }}
+
+ <div class="w-64">
+ @if (str($database->status)->contains('exited'))
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
+ @else
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
+ helper="Database should be stopped to change this settings." />
+ @endif
+ </div>
@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>
+ @if (str($database->status)->contains('exited'))
+ <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>
+ @else
+ <x-forms.select id="database.ssl_mode" label="SSL Mode" instantSave="instantSaveSSL"
+ disabled helper="Database should be stopped to change this settings.">
+ <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>
+ @endif
</div>
@endif
</div>
- </div>
- <div>
- <div class="flex flex-col py-2 w-64">
- <div class="flex items-center gap-2 pb-2">
- <div class="flex items-center">
- <h3>Proxy</h3>
- <x-loading wire:loading wire:target="instantSave" />
+ <div>
+ <div class="flex flex-col py-2 w-64">
+ <div class="flex items-center gap-2 pb-2">
+ <div class="flex items-center">
+ <h3>Proxy</h3>
+ <x-loading wire:loading wire:target="instantSave" />
+ </div>
+ @if (data_get($database, 'is_public'))
+ <x-slide-over fullScreen>
+ <x-slot:title>Proxy Logs</x-slot:title>
+ <x-slot:content>
+ <livewire:project.shared.get-logs :server="$server" :resource="$database"
+ container="{{ data_get($database, 'uuid') }}-proxy" lazy />
+ </x-slot:content>
+ <x-forms.button disabled="{{ !data_get($database, 'is_public') }}"
+ @click="slideOverOpen=true">Logs</x-forms.button>
+ </x-slide-over>
+ @endif
</div>
- @if (data_get($database, 'is_public'))
- <x-slide-over fullScreen>
- <x-slot:title>Proxy Logs</x-slot:title>
- <x-slot:content>
- <livewire:project.shared.get-logs :server="$server" :resource="$database"
- container="{{ data_get($database, 'uuid') }}-proxy" lazy />
- </x-slot:content>
- <x-forms.button disabled="{{ !data_get($database, 'is_public') }}"
- @click="slideOverOpen=true">Logs</x-forms.button>
- </x-slide-over>
- @endif
+ <x-forms.checkbox instantSave id="database.is_public" label="Make it publicly available" />
</div>
- <x-forms.checkbox instantSave id="database.is_public" label="Make it publicly available" />
+ <x-forms.input placeholder="5432" disabled="{{ data_get($database, 'is_public') }}"
+ id="database.public_port" label="Public Port" />
+ </div>
+ <x-forms.textarea label="Custom MongoDB Configuration" rows="10" id="database.mongo_conf" />
+ <h3 class="pt-4">Advanced</h3>
+ <div class="flex flex-col">
+ <x-forms.checkbox helper="Drain logs to your configured log drain endpoint in your Server settings."
+ instantSave="instantSaveAdvanced" id="database.is_log_drain_enabled" label="Drain Logs" />
</div>
- <x-forms.input placeholder="5432" disabled="{{ data_get($database, 'is_public') }}"
- id="database.public_port" label="Public Port" />
- </div>
- <x-forms.textarea label="Custom MongoDB Configuration" rows="10" id="database.mongo_conf" />
- <h3 class="pt-4">Advanced</h3>
- <div class="flex flex-col">
- <x-forms.checkbox helper="Drain logs to your configured log drain endpoint in your Server settings."
- instantSave="instantSaveAdvanced" id="database.is_log_drain_enabled" label="Drain Logs" />
- </div>
</form>
</div>
diff --git a/resources/views/livewire/project/database/mysql/general.blade.php b/resources/views/livewire/project/database/mysql/general.blade.php
index 2a02dd9cd6..c9090a4dbb 100644
--- a/resources/views/livewire/project/database/mysql/general.blade.php
+++ b/resources/views/livewire/project/database/mysql/general.blade.php
@@ -95,19 +95,38 @@
</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" />
+ <div class="w-64">
+ @if (str($database->status)->contains('exited'))
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
+ @else
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
+ helper="Database should be stopped to change this settings." />
+ @endif
+ </div>
@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>
+ @if (str($database->status)->contains('exited'))
+ <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>
+ @else
+ <x-forms.select id="database.ssl_mode" label="SSL Mode" instantSave="instantSaveSSL"
+ disabled helper="Database should be stopped to change this settings.">
+ <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>
+ @endif
</div>
@endif
</div>
diff --git a/resources/views/livewire/project/database/postgresql/general.blade.php b/resources/views/livewire/project/database/postgresql/general.blade.php
index b90836ce88..92e011622c 100644
--- a/resources/views/livewire/project/database/postgresql/general.blade.php
+++ b/resources/views/livewire/project/database/postgresql/general.blade.php
@@ -102,52 +102,72 @@
</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" />
+ <div class="w-64" wire:key='enable_ssl'>
+ @if ($database->isExited())
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
+ @else
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
+ helper="Database should be stopped to change this settings." />
+ @endif
+ </div>
@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>
+ @if ($database->isExited())
+ <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>
+ @else
+ <x-forms.select id="database.ssl_mode" label="SSL Mode" instantSave="instantSaveSSL"
+ disabled helper="Database should be stopped to change this settings.">
+ <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>
+ @endif
</div>
@endif
- </div>
- </div>
- <div class="flex flex-col gap-2">
- <div class="flex items-center justify-between py-2">
- <div class="flex items-center gap-2">
- <h3>Proxy</h3>
- <x-loading wire:loading wire:target="instantSave" />
+ <div class="flex flex-col gap-2">
+ <div class="flex items-center justify-between py-2">
+ <div class="flex items-center gap-2">
+ <h3>Proxy</h3>
+ <x-loading wire:loading wire:target="instantSave" />
+ </div>
+ @if (data_get($database, 'is_public'))
+ <x-slide-over fullScreen>
+ <x-slot:title>Proxy Logs</x-slot:title>
+ <x-slot:content>
+ <livewire:project.shared.get-logs :server="$server" :resource="$database"
+ container="{{ data_get($database, 'uuid') }}-proxy" lazy />
+ </x-slot:content>
+ <x-forms.button disabled="{{ !data_get($database, 'is_public') }}"
+ @click="slideOverOpen=true">Logs</x-forms.button>
+ </x-slide-over>
+ @endif
+ </div>
+ <div class="flex flex-col gap-2">
+ <x-forms.checkbox instantSave id="database.is_public" label="Make it publicly available" />
+ <x-forms.input placeholder="5432" disabled="{{ data_get($database, 'is_public') }}"
+ id="database.public_port" label="Public Port" />
+ </div>
</div>
- @if (data_get($database, 'is_public'))
- <x-slide-over fullScreen>
- <x-slot:title>Proxy Logs</x-slot:title>
- <x-slot:content>
- <livewire:project.shared.get-logs :server="$server" :resource="$database"
- container="{{ data_get($database, 'uuid') }}-proxy" lazy />
- </x-slot:content>
- <x-forms.button disabled="{{ !data_get($database, 'is_public') }}"
- @click="slideOverOpen=true">Logs</x-forms.button>
- </x-slide-over>
- @endif
- </div>
- <div class="flex flex-col gap-2">
- <x-forms.checkbox instantSave id="database.is_public" label="Make it publicly available" />
- <x-forms.input placeholder="5432" disabled="{{ data_get($database, 'is_public') }}"
- id="database.public_port" label="Public Port" />
- </div>
- </div>
- <div class="flex flex-col gap-2">
- <x-forms.textarea label="Custom PostgreSQL Configuration" rows="10" id="database.postgres_conf" />
- </div>
+ <div class="flex flex-col gap-2">
+ <x-forms.textarea label="Custom PostgreSQL Configuration" rows="10"
+ id="database.postgres_conf" />
+ </div>
</form>
<div class="flex flex-col gap-4 pt-4">
diff --git a/resources/views/livewire/project/database/redis/general.blade.php b/resources/views/livewire/project/database/redis/general.blade.php
index a6cae8e38d..20acf52c07 100644
--- a/resources/views/livewire/project/database/redis/general.blade.php
+++ b/resources/views/livewire/project/database/redis/general.blade.php
@@ -53,34 +53,39 @@
<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="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
+ <div class="w-64" wire:key='enable_ssl'>
+ @if (str($database->status)->contains('exited'))
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
+ @else
+ <x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
+ wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
+ helper="Database should be stopped to change this settings." />
+ @endif
+ </div>
</div>
</div>
<div>