fix(server): validate servers without a proxy

Closes #11048
This commit is contained in:
Andras Bacsai
2026-10-24 00:45:06 +02:00
parent d542f13b9c
commit 18f74536e4
3 changed files with 44 additions and 1 deletions
+1 -1
View File
@@ -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 startup
@@ -310,6 +310,11 @@ class ValidateAndInstall extends Component
if ($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) {
@@ -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);
});