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.

fix

Andras Bacsai42d12e36e535
diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.php
index 54961e273b..521e089f6a 100644
--- a/app/Http/Livewire/Server/Form.php
+++ b/app/Http/Livewire/Server/Form.php
@@ -8,7 +8,6 @@ use Livewire\Component;
class Form extends Component
{
- public $server_id;
public Server $server;
public $uptime;
public $dockerVersion;
@@ -22,10 +21,6 @@ class Form extends Component
'server.settings.is_reachable' => 'required',
'server.settings.is_part_of_swarm' => 'required'
];
- public function mount()
- {
- $this->server = Server::find($this->server_id)->load(['settings']);
- }
public function installDocker()
{
$activity = resolve(InstallDocker::class)($this->server);
diff --git a/app/Http/Livewire/Server/PrivateKey.php b/app/Http/Livewire/Server/PrivateKey.php
index 2bd939723f..420ce1b600 100644
--- a/app/Http/Livewire/Server/PrivateKey.php
+++ b/app/Http/Livewire/Server/PrivateKey.php
@@ -2,28 +2,27 @@
namespace App\Http\Livewire\Server;
-use App\Models\PrivateKey as ModelsPrivateKey;
use App\Models\Server;
use Illuminate\Support\Facades\Storage;
use Livewire\Component;
class PrivateKey extends Component
{
- public $private_keys;
+ public Server $server;
+ public $privateKeys;
public $parameters;
public function setPrivateKey($private_key_id)
{
- $server = Server::where('uuid', $this->parameters['server_uuid']);
- $server->update([
+ $this->server->update([
'private_key_id' => $private_key_id
]);
+
// Delete the old ssh mux file to force a new one to be created
- Storage::disk('ssh-mux')->delete("{$server->first()->ip}_{$server->first()->port}_{$server->first()->user}");
- return redirect()->route('server.show', $this->parameters['server_uuid']);
+ Storage::disk('ssh-mux')->delete("{$this->server->first()->ip}_{$this->server->first()->port}_{$this->server->first()->user}");
+ $this->server->refresh();
}
public function mount()
{
$this->parameters = getRouteParameters();
- $this->private_keys = ModelsPrivateKey::where('team_id', session('currentTeam')->id)->get();
}
}
diff --git a/resources/views/components/server/navbar.blade.php b/resources/views/components/server/navbar.blade.php
index 3f2bc7e0b9..86d486339e 100644
--- a/resources/views/components/server/navbar.blade.php
+++ b/resources/views/components/server/navbar.blade.php
@@ -14,6 +14,18 @@
]) }}">
<button>Proxy</button>
</a>
+ <a class="{{ request()->routeIs('server.private-key') ? 'text-white' : '' }}"
+ href="{{ route('server.private-key', [
+ 'server_uuid' => Route::current()->parameters()['server_uuid'],
+ ]) }}">
+ <button>Private Key</button>
+ </a>
+ <a class="{{ request()->routeIs('server.destinations') ? 'text-white' : '' }}"
+ href="{{ route('server.destinations', [
+ 'server_uuid' => Route::current()->parameters()['server_uuid'],
+ ]) }}">
+ <button>Destinations</button>
+ </a>
@if (request()->routeIs('server.proxy'))
<div class="flex-1"></div>
<livewire:server.proxy.deploy :server="$server" />
diff --git a/resources/views/livewire/destination/form.blade.php b/resources/views/livewire/destination/form.blade.php
index 9cfe793234..76825d6dc2 100644
--- a/resources/views/livewire/destination/form.blade.php
+++ b/resources/views/livewire/destination/form.blade.php
@@ -6,9 +6,11 @@
<x-forms.button wire:click.prevent='submit' type="submit">
Save
</x-forms.button>
- <x-forms.button x-on:click.prevent="deleteDestination = true">
- Delete
- </x-forms.button>
+ @if ($destination->network !== 'coolify')
+ <x-forms.button x-on:click.prevent="deleteDestination = true">
+ Delete
+ </x-forms.button>
+ @endif
</div>
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php
index ae3ea6d858..ad18135efe 100644
--- a/resources/views/livewire/server/form.blade.php
+++ b/resources/views/livewire/server/form.blade.php
@@ -4,18 +4,11 @@
<div class="flex gap-2">
<h2>General</h2>
<x-forms.button type="submit">Save</x-forms.button>
- @if ($server_id !== 0)
+ @if ($server->id !== 0)
<x-forms.button x-on:click.prevent="deleteServer = true">
Delete
</x-forms.button>
@endif
- @if (!$server->settings->is_reachable)
- <div class="w-full">
- <x-forms.button isHighlighted wire:click.prevent='validateServer'>
- Validate Server
- </x-forms.button>
- </div>
- @endif
</div>
<div class="flex flex-col gap-2 xl:flex-row">
<div class="flex flex-col w-full">
@@ -44,9 +37,8 @@
@endif
</div>
</div>
-
+ <h3 class="pb-4">Actions</h3>
@if ($server->settings->is_reachable)
- <h3 class="pt-8 pb-4">Quick Actions</h3>
<div class="flex items-center gap-2">
<x-forms.button wire:click.prevent='validateServer'>
Check Server Details
@@ -58,14 +50,19 @@
Install Docker Engine
@endif
</x-forms.button>
- {{-- <x-forms.button wire:click.prevent='installDocker'>Install Docker</x-forms.button> --}}
+ </div>
+ @else
+ <div class="w-full">
+ <x-forms.button isHighlighted wire:click.prevent='validateServer'>
+ Validate Server
+ </x-forms.button>
</div>
@endif
<div class="container w-full py-4 mx-auto">
<livewire:activity-monitor :header="true" />
</div>
@isset($uptime)
- <h3 class="pb-3">Server Info</h3>
+ <h4 class="pb-3">Server Info</h4>
<div class="text-sm">
<p>Uptime: {{ $uptime }}</p>
@isset($dockerVersion)
@@ -74,38 +71,4 @@
</div>
@endisset
</form>
- <div class="flex items-center gap-2 py-4">
- <h3>Private Key</h3>
- <a href="{{ route('server.private-key', ['server_uuid' => $server->uuid]) }}">
- <x-forms.button>
- @if (data_get($server, 'privateKey.uuid'))
- Change
- @else
- Add
- @endif
- </x-forms.button>
- </a>
- </div>
- @if (data_get($server, 'privateKey.uuid'))
- <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>
- @else
- <div class="text-sm">No private key attached.</div>
- @endif
- <div class="flex items-center gap-2 py-4">
- <h3>Destinations</h3>
- <a href="{{ route('destination.new', ['server_id' => $server->id]) }}">
- <x-forms.button>Add</x-forms.button>
- </a>
- </div>
- <div>
- @forelse ($server->standaloneDockers as $docker)
- <a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
- <button class="text-white btn-link">{{ data_get($docker, 'network') }}</button>
- </a>
- @empty
- <div class="text-sm">No destinations added</div>
- @endforelse
- </div>
</div>
diff --git a/resources/views/livewire/server/new/by-ip.blade.php b/resources/views/livewire/server/new/by-ip.blade.php
index 04623b8a0f..4e8a3eb91a 100644
--- a/resources/views/livewire/server/new/by-ip.blade.php
+++ b/resources/views/livewire/server/new/by-ip.blade.php
@@ -22,8 +22,8 @@
@endif
@endforeach
</x-forms.select>
- <x-forms.checkbox class="pb-8" disabled instantSave noDirty id="is_part_of_swarm"
- label="Is it part of a Swarm cluster?" />
+ {{-- <x-forms.checkbox class="pb-8" disabled instantSave noDirty id="is_part_of_swarm"
+ label="Is it part of a Swarm cluster?" /> --}}
<x-forms.button type="submit">
Save New Server
</x-forms.button>
diff --git a/resources/views/livewire/server/private-key.blade.php b/resources/views/livewire/server/private-key.blade.php
index 6f2a30a563..a482d24370 100644
--- a/resources/views/livewire/server/private-key.blade.php
+++ b/resources/views/livewire/server/private-key.blade.php
@@ -1,10 +1,30 @@
-<div class="grid lg:grid-cols-2 gap-2">
- @forelse ($private_keys as $private_key)
- <x-forms.button wire:click='setPrivateKey({{ $private_key->id }})'>{{ $private_key->name }}
- </x-forms.button>
- @empty
- <div>No private keys found.
- <x-use-magic-bar />
- </div>
- @endforelse
+<div>
+ <div class="flex items-end gap-2">
+ <h1>Private Key</h1>
+ <a href="{{ route('private-key.new') }}">
+ <x-forms.button>Add a new Private Key</x-forms.button>
+ </a>
+ </div>
+ <div class="pt-2 pb-8 text-sm">Selected Private Key for SSH connection</div>
+ <div class="pb-10 text-sm">
+ @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>
+ @else
+ <div class="text-sm">No private key attached.</div>
+ @endif
+ </div>
+ <h3 class="pb-4">Select a different Private Key</h3>
+ <div class="grid gap-2">
+ @forelse ($privateKeys as $private_key)
+ <x-forms.button wire:click='setPrivateKey({{ $private_key->id }})'>{{ $private_key->name }}
+ </x-forms.button>
+ @empty
+ <div>No private keys found.
+ <x-use-magic-bar />
+ </div>
+ @endforelse
+ </div>
</div>
diff --git a/resources/views/livewire/server/proxy.blade.php b/resources/views/livewire/server/proxy.blade.php
index e573e7b2d6..aa314200de 100644
--- a/resources/views/livewire/server/proxy.blade.php
+++ b/resources/views/livewire/server/proxy.blade.php
@@ -19,7 +19,7 @@
@endif
<livewire:server.proxy.status :server="$server" />
</div>
- <div class="pb-4 text-sm">Traefik v2</div>
+ <div class="pt-3 pb-4 text-sm">Traefik v2</div>
@if (
$server->extra_attributes->proxy_last_applied_settings &&
$server->extra_attributes->proxy_last_saved_settings !== $server->extra_attributes->proxy_last_applied_settings)
diff --git a/resources/views/server/destinations.blade.php b/resources/views/server/destinations.blade.php
new file mode 100644
index 0000000000..e6d0e299b6
--- /dev/null
+++ b/resources/views/server/destinations.blade.php
@@ -0,0 +1,19 @@
+<x-layout>
+ <x-server.navbar :server="$server" />
+ <div class="flex items-end gap-2">
+ <h1>Destinations</h1>
+ <a href="{{ route('destination.new', ['server_id' => $server->id]) }}">
+ <x-forms.button>Add a new destination</x-forms.button>
+ </a>
+ </div>
+ <div class="pt-2 pb-8 text-sm">Docker Networks available on the server</div>
+ <div class="pb-10 text-sm">
+ @forelse ($server->standaloneDockers as $docker)
+ <a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
+ <x-forms.button>{{ data_get($docker, 'network') }} </x-forms.button>
+ </a>
+ @empty
+ <div class="text-sm">No destinations added</div>
+ @endforelse
+ </div>
+</x-layout>
diff --git a/resources/views/server/private-key.blade.php b/resources/views/server/private-key.blade.php
index 01cd389edf..3c42f98f0c 100644
--- a/resources/views/server/private-key.blade.php
+++ b/resources/views/server/private-key.blade.php
@@ -1,4 +1,4 @@
<x-layout>
- <h1 class="pb-2">Select a private Key</h1>
- <livewire:server.private-key />
+ <x-server.navbar :server="$server" />
+ <livewire:server.private-key :server="$server" :privateKeys="$privateKeys" />
</x-layout>
diff --git a/resources/views/server/show.blade.php b/resources/views/server/show.blade.php
index 8f69518b2b..478f4b03ef 100644
--- a/resources/views/server/show.blade.php
+++ b/resources/views/server/show.blade.php
@@ -1,4 +1,4 @@
<x-layout>
<x-server.navbar :server="$server" />
- <livewire:server.form :server_id="$server->id" />
+ <livewire:server.form :server="$server" />
</x-layout>
diff --git a/routes/web.php b/routes/web.php
index 3c286c97ae..0c8a9c9ee6 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -75,7 +75,13 @@ Route::middleware(['auth'])->group(function () {
Route::get('/server/{server_uuid}/proxy', fn () => view('server.proxy', [
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
]))->name('server.proxy');
- Route::get('/server/{server_uuid}/private-key', fn () => view('server.private-key'))->name('server.private-key');
+ Route::get('/server/{server_uuid}/private-key', fn () => view('server.private-key', [
+ 'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
+ 'privateKeys' => PrivateKey::ownedByCurrentTeam()->get(),
+ ]))->name('server.private-key');
+ Route::get('/server/{server_uuid}/destinations', fn () => view('server.destinations', [
+ 'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail()
+ ]))->name('server.destinations');
});