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
fixes
Andras Bacsai0123ae97a1c8
diff --git a/app/Http/Livewire/PrivateKey/Change.php b/app/Http/Livewire/PrivateKey/Change.phpindex d66ffc7151..28b18494e8 100644--- a/app/Http/Livewire/PrivateKey/Change.php+++ b/app/Http/Livewire/PrivateKey/Change.php@@ -7,7 +7,6 @@ use Livewire\Component;class Change extends Component{- public string $private_key_uuid;public PrivateKey $private_key;protected $rules = [@@ -20,15 +19,15 @@ class Change extends Component'private_key.description' => 'description','private_key.private_key' => 'private key'];- public function mount()- {- $this->private_key = PrivateKey::where('uuid', $this->private_key_uuid)->first();- }public function delete(){- PrivateKey::where('uuid', $this->private_key_uuid)->delete();- session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();- redirect()->route('dashboard');+ try {+ PrivateKey::where('uuid', $this->private_key_uuid)->delete();+ session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();+ redirect()->route('dashboard');+ } catch (\Exception $e) {+ return general_error_handler(err: $e, that: $this);+ }}public function changePrivateKey(){diff --git a/app/Http/Livewire/Server/PrivateKey.php b/app/Http/Livewire/Server/PrivateKey.phpindex 420ce1b600..57ec27e1fb 100644--- a/app/Http/Livewire/Server/PrivateKey.php+++ b/app/Http/Livewire/Server/PrivateKey.php@@ -5,12 +5,27 @@ namespace App\Http\Livewire\Server;use App\Models\Server;use Illuminate\Support\Facades\Storage;use Livewire\Component;+use Masmerise\Toaster\Toaster;class PrivateKey extends Component{public Server $server;public $privateKeys;public $parameters;++ public function checkConnection()+ {+ try {+ $uptime = instant_remote_process(['uptime'], $this->server, false);+ if ($uptime) {+ Toaster::success('Server is reachable with this private key.');+ } else {+ Toaster::error('Server is NOT reachable with this private key.');+ }+ } catch (\Exception $e) {+ return general_error_handler(err: $e, that: $this);+ }+ }public function setPrivateKey($private_key_id){$this->server->update([@@ -18,8 +33,9 @@ class PrivateKey extends Component]);// Delete the old ssh mux file to force a new one to be created- Storage::disk('ssh-mux')->delete("{$this->server->first()->ip}_{$this->server->first()->port}_{$this->server->first()->user}");+ Storage::disk('ssh-mux')->delete($this->server->muxFilename());$this->server->refresh();+ $this->checkConnection();}public function mount(){diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.phpindex 2406c25a0a..39a6a8c8cc 100644--- a/app/Models/PrivateKey.php+++ b/app/Models/PrivateKey.php@@ -11,9 +11,6 @@ class PrivateKey extends BaseModel'private_key','team_id',];- protected $hidden = [- 'private_key',- ];static public function ownedByCurrentTeam(array $select = ['*']){$selectArray = collect($select)->concat(['id']);diff --git a/app/Models/Server.php b/app/Models/Server.phpindex 84596ea719..1a1a9704f4 100644--- a/app/Models/Server.php+++ b/app/Models/Server.php@@ -74,6 +74,10 @@ class Server extends BaseModel{return $this->hasOne(ServerSetting::class);}+ public function muxFilename()+ {+ return "{$this->ip}_{$this->port}_{$this->user}";+ }static public function ownedByCurrentTeam(array $select = ['*']){$selectArray = collect($select)->concat(['id']);diff --git a/resources/css/app.css b/resources/css/app.cssindex 44a30b363a..cff52e3ee4 100644--- a/resources/css/app.css+++ b/resources/css/app.css@@ -15,7 +15,7 @@ body {@apply pl-24 pr-10 mx-auto max-w-screen-xl pt-4;}input {- @apply input input-sm h-7 outline-none placeholder:text-neutral-700 text-white rounded bg-coolgray-200 w-full read-only:bg-coolgray-200/50 read-only:text-opacity-25;+ @apply input input-sm h-7 outline-none placeholder:text-neutral-700 text-white rounded bg-coolgray-200 w-full read-only:bg-coolgray-200/50 read-only:text-opacity-25 disabled:border-none;}input && :not(input[type="checkbox"]) {@apply border-none;@@ -25,7 +25,7 @@ input[type="checkbox"] {}textarea {- @apply textarea placeholder:text-neutral-700 text-white rounded scrollbar bg-coolgray-200;+ @apply textarea placeholder:text-neutral-700 text-white rounded scrollbar bg-coolgray-200 leading-5 text-xs;}select {@apply h-7 select select-xs disabled:bg-coolgray-200 border-none disabled:opacity-50 font-normal placeholder:text-neutral-700 text-white rounded bg-coolgray-200;diff --git a/resources/views/livewire/server/private-key.blade.php b/resources/views/livewire/server/private-key.blade.phpindex d5e4816ec8..ad7d1e387c 100644--- a/resources/views/livewire/server/private-key.blade.php+++ b/resources/views/livewire/server/private-key.blade.php@@ -1,20 +1,26 @@<div>- <div class="flex items-end gap-2">+ <div class="flex items-end gap-2 pb-6 "><h1>Private Key</h1><a href="{{ route('private-key.new') }}"><x-forms.button>Add a new Private Key</x-forms.button></a>+ <x-forms.button wire:click.prevent='checkConnection'>+ Check connection+ </x-forms.button></div>- <div class="pt-2 pb-6 ">Selected Private Key for SSH connection</div>- <div class="pb-10 ">++ <div class="flex flex-col gap-2 pb-6">@if (data_get($server, 'privateKey.uuid'))- Currently attached Private Key:- <a href="{{ route('private-key.show', ['private_key_uuid' => data_get($server, 'privateKey.uuid')]) }}">- <button class="text-white btn-link">{{ data_get($server, 'privateKey.name') }}</button>- </a>+ <div>+ Currently attached Private Key:+ <a href="{{ route('private-key.show', ['private_key_uuid' => data_get($server, 'privateKey.uuid')]) }}">+ <button class="text-white btn-link">{{ data_get($server, 'privateKey.name') }}</button>+ </a>+ </div>@else<div class="">No private key attached.</div>@endif+</div><h3 class="pb-4">Select a different Private Key</h3><div class="grid gap-2">diff --git a/resources/views/private-key/show.blade.php b/resources/views/private-key/show.blade.phpindex f27b681059..f3efc02a1d 100644--- a/resources/views/private-key/show.blade.php+++ b/resources/views/private-key/show.blade.php@@ -1,4 +1,3 @@<x-layout>-- <livewire:private-key.change :private_key_uuid="$private_key->uuid" />+ <livewire:private-key.change :private_key="$private_key" /></x-layout>diff --git a/routes/web.php b/routes/web.phpindex ffa7052248..a85eea34b6 100644--- a/routes/web.php+++ b/routes/web.php@@ -99,11 +99,11 @@ Route::middleware(['auth'])->group(function () {Route::middleware(['auth'])->group(function () {Route::get('/private-keys', fn () => view('private-key.all', [- 'privateKeys' => PrivateKey::ownedByCurrentTeam()->get()+ 'privateKeys' => PrivateKey::ownedByCurrentTeam(['name', 'uuid'])->get()]))->name('private-key.all');Route::get('/private-key/new', fn () => view('private-key.new'))->name('private-key.new');Route::get('/private-key/{private_key_uuid}', fn () => view('private-key.show', [- 'private_key' => PrivateKey::ownedByCurrentTeam()->whereUuid(request()->private_key_uuid)->firstOrFail()+ 'private_key' => PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key'])->whereUuid(request()->private_key_uuid)->firstOrFail()]))->name('private-key.show');});