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
fix(server): validate servers without a proxy
Andras Bacsai18f74536e403
diff --git a/app/Jobs/ValidateAndInstallServerJob.php b/app/Jobs/ValidateAndInstallServerJob.phpindex 7ebfbbc142..c6e8f53957 100644--- a/app/Jobs/ValidateAndInstallServerJob.php+++ b/app/Jobs/ValidateAndInstallServerJob.php@@ -180,7 +180,7 @@ class ValidateAndInstallServerJob implements ShouldBeEncrypted, ShouldQueue]);// Start proxy if needed- if (! $this->server->isBuildServer()) {+ if ($this->server->isProxyShouldRun()) {$proxyShouldRun = CheckProxy::run($this->server, true);if ($proxyShouldRun) {// Ensure networks exist BEFORE dispatching async proxy startupdiff --git a/app/Livewire/Server/ValidateAndInstall.php b/app/Livewire/Server/ValidateAndInstall.phpindex c7ce754732..84b2ffaa32 100644--- a/app/Livewire/Server/ValidateAndInstall.php+++ b/app/Livewire/Server/ValidateAndInstall.php@@ -310,6 +310,11 @@ class ValidateAndInstall extends Componentif ($this->server->isSentinelEnabled()) {CheckAndStartSentinelJob::dispatch($this->server);}+ if (! $this->server->isProxyShouldRun()) {+ $this->dispatch('success', 'Server validated.');++ return;+ }$this->dispatch('success', 'Server validated, proxy is starting in a moment.');$proxyShouldRun = CheckProxy::run($this->server, true);if (! $proxyShouldRun) {diff --git a/tests/Feature/ServerDockerVersionValidationTest.php b/tests/Feature/ServerDockerVersionValidationTest.phpindex f41992431c..b7fd74ef29 100644--- a/tests/Feature/ServerDockerVersionValidationTest.php+++ b/tests/Feature/ServerDockerVersionValidationTest.php@@ -1,6 +1,9 @@<?php+use App\Actions\Proxy\StartProxy;+use App\Enums\ProxyTypes;use App\Events\ServerReachabilityChanged;+use App\Jobs\ValidateAndInstallServerJob;use App\Livewire\Server\ValidateAndInstall;use App\Models\InstanceSettings;use App\Models\PrivateKey;@@ -10,6 +13,7 @@ use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Facades\Event;use Illuminate\Support\Facades\Process;+use Illuminate\Support\Facades\Queue;use Livewire\Livewire;uses(RefreshDatabase::class);@@ -85,3 +89,37 @@ it('shows the sudo command for non-root servers', function () {expect(validateDockerVersionError($this->server->fresh()))->toContain('Run "sudo docker version --format json" on the server as the deploy user');});++it('validates a server without a proxy and does not start a proxy', function () {+ Queue::fake();+ $this->server->proxy->set('type', ProxyTypes::NONE->value);+ $this->server->save();+ $this->server->settings->update(['is_reachable' => true, 'is_usable' => true]);+ fakeDockerVersionOutput('{"Server":{"Version":"29.6.2"}}');++ expect(validateDockerVersionError($this->server->fresh()))->toBeNull()+ ->and($this->server->fresh()->is_validating)->toBeFalsy();+ Queue::assertNotPushed(StartProxy::class);+});++it('validates a server without a proxy in the background job', function () {+ Queue::fake();+ $this->server->proxy->set('type', ProxyTypes::NONE->value);+ $this->server->save();+ $this->server->settings->update(['is_reachable' => true, 'is_usable' => true]);++ $server = Mockery::mock($this->server->fresh())->makePartial();+ $server->shouldReceive('validateConnection')->andReturn(['uptime' => true, 'error' => null]);+ $server->shouldReceive('validateOS')->andReturn('debian');+ $server->shouldReceive('validatePrerequisites')->andReturn(['success' => true]);+ $server->shouldReceive('validateDockerEngine')->andReturn(true);+ $server->shouldReceive('validateDockerCompose')->andReturn(true);+ $server->shouldReceive('validateDockerEngineVersion')->andReturn(true);+ $server->shouldReceive('gatherServerMetadata')->andReturnNull();++ (new ValidateAndInstallServerJob($server))->handle();++ expect($this->server->fresh()->validation_logs)->toBeNull()+ ->and($this->server->fresh()->is_validating)->toBeFalsy();+ Queue::assertNotPushed(StartProxy::class);+});