From a2f4d4ed6d6bed9fed76baa994a4edd9cab86606 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 12 Oct 2023 08:51:32 +0200 Subject: [PATCH] fix: make sure proxy wont start in NONE mode --- app/Actions/Proxy/StartProxy.php | 3 ++- app/Jobs/ContainerStatusJob.php | 1 - app/Models/Server.php | 7 +++++-- resources/views/components/server/navbar.blade.php | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Actions/Proxy/StartProxy.php b/app/Actions/Proxy/StartProxy.php index da09403cc..d6ae7eec8 100644 --- a/app/Actions/Proxy/StartProxy.php +++ b/app/Actions/Proxy/StartProxy.php @@ -2,6 +2,7 @@ namespace App\Actions\Proxy; +use App\Enums\ProxyTypes; use App\Models\Server; use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; @@ -14,7 +15,7 @@ class StartProxy { $commands = collect([]); $proxyType = $server->proxyType(); - if ($proxyType === 'none') { + if ($proxyType === ProxyTypes::NONE->value) { return 'OK'; } $proxy_path = get_proxy_path(); diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index c5c455472..392819440 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -114,7 +114,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted return data_get($value, 'Name') === '/coolify-proxy'; })->first(); if (!$foundProxyContainer) { - ray('Proxy not found, starting it...'); if ($this->server->isProxyShouldRun()) { StartProxy::run($this->server, false); $this->server->team->notify(new ContainerRestarted('coolify-proxy', $this->server)); diff --git a/app/Models/Server.php b/app/Models/Server.php index a53d6ffe5..313040afa 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -93,8 +93,11 @@ class Server extends BaseModel public function proxyType() { - $type = $this->proxy->get('type'); - if (is_null($type)) { + $proxyType = $this->proxy->get('type'); + if ($proxyType === ProxyTypes::NONE->value) { + return $proxyType; + } + if (is_null($proxyType)) { $this->proxy->type = ProxyTypes::TRAEFIK_V2->value; $this->proxy->status = ProxyStatus::EXITED->value; $this->save(); diff --git a/resources/views/components/server/navbar.blade.php b/resources/views/components/server/navbar.blade.php index 8230c3a7c..fbbdc545b 100644 --- a/resources/views/components/server/navbar.blade.php +++ b/resources/views/components/server/navbar.blade.php @@ -2,7 +2,9 @@

Server

- + @if ($server->proxyType() !== 'NONE') + + @endif
{{ data_get($server, 'name') }}