This commit is contained in:
Andras Bacsai 2023-05-15 21:48:36 +02:00
parent 6910f9c5c7
commit 114647810b
8 changed files with 12 additions and 15 deletions

View File

@ -15,9 +15,9 @@ public function __invoke(Server $server)
"cat $proxy_path/docker-compose.yml", "cat $proxy_path/docker-compose.yml",
], $server, false); ], $server, false);
if (is_null($output)) { if (is_null($output)) {
$final_output = Str::of(getProxyConfiguration($server))->trim(); $final_output = Str::of(getProxyConfiguration($server))->trim()->value;
} else { } else {
$final_output = Str::of($output)->trim(); $final_output = Str::of($output)->trim()->value;
} }
$docker_compose_yml_base64 = base64_encode($final_output); $docker_compose_yml_base64 = base64_encode($final_output);
$server->extra_attributes->last_saved_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value; $server->extra_attributes->last_saved_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;

View File

@ -3,9 +3,7 @@
namespace App\Actions\Proxy; namespace App\Actions\Proxy;
use App\Enums\ActivityTypes; use App\Enums\ActivityTypes;
use App\Enums\ProxyTypes;
use App\Models\Server; use App\Models\Server;
use Illuminate\Support\Collection;
use Spatie\Activitylog\Models\Activity; use Spatie\Activitylog\Models\Activity;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -30,9 +28,9 @@ public function __invoke(Server $server): Activity
"cat $proxy_path/docker-compose.yml", "cat $proxy_path/docker-compose.yml",
], $server, false); ], $server, false);
if (is_null($configuration)) { if (is_null($configuration)) {
$configuration = Str::of(getProxyConfiguration($server))->trim(); $configuration = Str::of(getProxyConfiguration($server))->trim()->value;
} else { } else {
$configuration = Str::of($configuration)->trim(); $configuration = Str::of($configuration)->trim()->value;
} }
$docker_compose_yml_base64 = base64_encode($configuration); $docker_compose_yml_base64 = base64_encode($configuration);
$server->extra_attributes->last_applied_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value; $server->extra_attributes->last_applied_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;

View File

@ -51,7 +51,7 @@ public function saveConfiguration()
{ {
try { try {
$proxy_path = config('coolify.proxy_config_path'); $proxy_path = config('coolify.proxy_config_path');
$this->proxy_settings = Str::of($this->proxy_settings)->trim(); $this->proxy_settings = Str::of($this->proxy_settings)->trim()->value;
$docker_compose_yml_base64 = base64_encode($this->proxy_settings); $docker_compose_yml_base64 = base64_encode($this->proxy_settings);
$this->server->extra_attributes->last_saved_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value; $this->server->extra_attributes->last_saved_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value;
$this->server->save(); $this->server->save();

View File

@ -159,6 +159,7 @@ function instantRemoteProcess(array $command, Server $server, $throwError = true
{ {
$command_string = implode("\n", $command); $command_string = implode("\n", $command);
$private_key_location = savePrivateKeyForServer($server); $private_key_location = savePrivateKeyForServer($server);
$ssh_command = generateSshCommand($private_key_location, $server->ip, $server->user, $server->port, $command_string); $ssh_command = generateSshCommand($private_key_location, $server->ip, $server->user, $server->port, $command_string);
$process = Process::run($ssh_command); $process = Process::run($ssh_command);
$output = trim($process->output()); $output = trim($process->output());

View File

@ -46,5 +46,5 @@ h3 {
@apply text-lg font-bold py-4; @apply text-lg font-bold py-4;
} }
.box { .box {
@apply flex items-center justify-center text-sm rounded cursor-pointer h-14 bg-coolgray-200 hover:bg-coollabs p-2; @apply flex items-center justify-center text-sm rounded cursor-pointer h-14 bg-coolgray-200 hover:bg-coollabs-100 p-2;
} }

View File

@ -1,9 +1,8 @@
<x-layout> <x-layout>
@if ($servers->count() === 0) @if ($servers->count() === 0)
<div class="flex flex-col items-center justify-center h-full pt-32"> <div class="flex flex-col items-center justify-center h-full pt-32">
<div class="pb-3">Without a server, you won't be able to do much.</div> <div class="">Without a server, you won't be able to do much</div>
<div class="text-2xl">Let's create <a href="{{ route('server.new') }}" <div class="text-2xl">Let's create <a class="underline" href="{{ route('server.new') }}">your
class="p-2 rounded bg-coollabs hover:bg-coollabs-100">your
first</a> one!</div> first</a> one!</div>
</div> </div>
@else @else

View File

@ -3,8 +3,8 @@
<x-inputs.input id="name" label="Name" required /> <x-inputs.input id="name" label="Name" required />
<x-inputs.input id="description" label="Description" /> <x-inputs.input id="description" label="Description" />
<x-inputs.input type="textarea" id="value" label="Private Key" required /> <x-inputs.input type="textarea" id="value" label="Private Key" required />
<x-inputs.button type="submit" wire.click.prevent> <x-inputs.button isBold type="submit" wire.click.prevent>
Save Private Key Save
</x-inputs.button> </x-inputs.button>
</form> </form>
</div> </div>

View File

@ -16,8 +16,7 @@
<h1>Select a private key</h1> <h1>Select a private key</h1>
<div class="flex"> <div class="flex">
@foreach ($private_keys as $key) @foreach ($private_keys as $key)
<div class="w-32 box" :class="{ 'bg-coollabs': {{ $private_key_id == $key->id }} }" <div class="w-32 box" wire:click.defer.prevent="setPrivateKey('{{ $key->id }}')">
wire:click.defer.prevent="setPrivateKey('{{ $key->id }}')">
{{ $key->name }} {{ $key->name }}
</div> </div>
@endforeach @endforeach