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
Merge remote-tracking branch 'origin/main' into pr-11443-next
Andras Bacsaiebfd4d0c1c4d
diff --cc app/Actions/Server/StartSentinel.phpindex edcd4a1edd,98af978bbb..3857d8c4d3--- a/app/Actions/Server/StartSentinel.php+++ b/app/Actions/Server/StartSentinel.php@@@ -83,11 -48,11 +83,15 @@@ class StartSentine}$dockerEnvironments = implode(' ', array_map(fn ($key, $value) => '-e '.escapeshellarg("$key=$value"), array_keys($environments), $environments));$dockerLabels = implode(' ', array_map(fn ($key, $value) => "$key=$value", array_keys($labels), $labels));+ $trafficLogDirectory = self::trafficLogDirectory($server);+ $trafficMount = $server->isTrafficAnalyticsEnabled()+ ? '-v '.escapeshellarg("{$trafficLogDirectory}:{$trafficLogDirectory}:ro").' '+ : '';- $dockerCommand = "docker run -d $dockerEnvironments --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v $mountDir:/app/db {$trafficMount}--pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-start-period 120s --health-interval 10s --health-retries 3 --add-host=host.docker.internal:host-gateway --label $dockerLabels $image";+ $network = $server->isLocalhost() ? ' --network coolify' : '';- $dockerCommand = "docker run -d$network $dockerEnvironments --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v $mountDir:/app/db --pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-start-period 120s --health-interval 10s --health-retries 3 --add-host=host.docker.internal:host-gateway --label $dockerLabels $image";++ $dockerCommand = "docker run -d$network $dockerEnvironments --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v $mountDir:/app/db {$trafficMount}--pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-start-period 120s --health-interval 10s --health-retries 3 --add-host=host.docker.internal:host-gateway --label $dockerLabels $image";++ $server->sentinelHeartbeat(isReset: true);+ $server->forceFill(['sentinel_waiting_since' => now()])->save();instant_remote_process(['docker rm -f coolify-sentinel || true',diff --cc app/Livewire/Server/Sentinel.phpindex b6444e573d,09b123dcc3..acfb42a2a0--- a/app/Livewire/Server/Sentinel.php+++ b/app/Livewire/Server/Sentinel.php@@@ -20,6 -20,19 +20,10 @@@ class Sentinel extends Componenpublic ?string $sentinelUpdatedAt = null;+ public string $sentinelStatus = 'out_of_sync';++ public ?int $sentinelRestartRequestedAt = null;+- #[Validate(['required', 'integer', 'min:1'])]- public int|string $sentinelMetricsRefreshRateSeconds;-- #[Validate(['required', 'integer', 'min:1'])]- public int|string $sentinelMetricsHistoryDays;-- #[Validate(['required', 'integer', 'min:10'])]- public int|string $sentinelPushIntervalSeconds;-#[Validate(['nullable', 'url'])]public ?string $sentinelCustomUrl = null;diff --cc resources/views/livewire/server/sentinel.blade.phpindex 512b0588a9,7415ff6ca6..e3a72e8686--- a/resources/views/livewire/server/sentinel.blade.php+++ b/resources/views/livewire/server/sentinel.blade.php@@@ -72,12 -138,12 +123,13 @@@]" /><div x-data="{customImage: localStorage.getItem('sentinel_custom_docker_image_{{ $server->uuid }}') || '',- saveCustomImage() {+ async applyCustomImage() {localStorage.setItem('sentinel_custom_docker_image_{{ $server->uuid }}', this.customImage);- $wire.set('sentinelCustomDockerImage', this.customImage || null);+ await $wire.set('sentinelCustomDockerImage', this.customImage || null);+ await $wire.restartSentinel();}}"+ @sentinel-defaults-restored.window="localStorage.removeItem('sentinel_custom_docker_image_{{ $server->uuid }}'); customImage = ''"{{-- Only hydrate Livewire when a real override exists. Unconditional$wire.set('', null→'') on every open marks the component dirty andflashes the unsaved bar until the round-trip completes. --}}diff --cc tests/Feature/Livewire/SentinelRestoreDefaultsTest.phpindex 0000000000,8ea265f968..155f6cd059mode 000000,100644..100644--- a/tests/Feature/Livewire/SentinelRestoreDefaultsTest.php+++ b/tests/Feature/Livewire/SentinelRestoreDefaultsTest.php@@@ -1,0 -1,204 +1,201 @@@+ <?php++ use App\Actions\Server\StartSentinel;+ use App\Livewire\Server\Sentinel;+ use App\Models\Server;+ use App\Models\Team;+ use App\Models\User;+ use Illuminate\Foundation\Testing\RefreshDatabase;+ use Illuminate\Support\Facades\DB;+ use Illuminate\Support\Facades\Queue;+ use Illuminate\Support\Once;+ use Livewire\Livewire;+ use Lorisleiva\Actions\Decorators\JobDecorator;++ uses(RefreshDatabase::class);++ beforeEach(function () {+ DB::table('instance_settings')->insert(['id' => 0]);+ Once::flush();+ $team = Team::factory()->create();+ $user = User::factory()->create();+ $team->members()->attach($user->id, ['role' => 'owner']);+ session(['currentTeam' => $team]);+ $this->actingAs($user);++ $this->server = Server::factory()->create([+ 'id' => 0,+ 'team_id' => $team->id,+ 'ip' => 'host.docker.internal',+ ]);+ });++ it('restores default Sentinel configuration without rotating credentials or disabling metrics', function () {+ $settings = $this->server->settings;+ $token = $settings->sentinel_token;+ $settings->forceFill([+ 'is_metrics_enabled' => true,+ 'is_sentinel_enabled' => true,+ 'sentinel_custom_url' => 'https://coolify.example.com',+ 'sentinel_metrics_refresh_rate_seconds' => 30,+ 'sentinel_metrics_history_days' => 14,+ 'sentinel_push_interval_seconds' => 120,+ 'is_sentinel_debug_enabled' => true,+ ])->saveQuietly();+ Queue::fake();++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->set('sentinelCustomDockerImage', 'sentinel:development')+ ->call('restoreDefaultConfiguration')+ ->assertSet('sentinelCustomUrl', 'http://coolify:8080')- ->assertSet('sentinelMetricsRefreshRateSeconds', 10)- ->assertSet('sentinelMetricsHistoryDays', 7)- ->assertSet('sentinelPushIntervalSeconds', 60)+ ->assertSet('isSentinelDebugEnabled', false)+ ->assertSet('sentinelCustomDockerImage', null)+ ->assertDispatched('sentinel-defaults-restored')+ ->assertDispatched('success', 'Default Sentinel configuration restored. Restarting Sentinel.');++ Queue::assertPushed(JobDecorator::class, fn (JobDecorator $job): bool => $job->getAction() instanceof StartSentinel);+ expect(Queue::pushed(JobDecorator::class))->toHaveCount(1);++ $settings->refresh();++ expect($settings->sentinel_token)->toBe($token)+ ->and((bool) $settings->is_metrics_enabled)->toBeTrue()+ ->and((bool) $settings->is_sentinel_enabled)->toBeTrue()+ ->and($settings->sentinel_custom_url)->toBe('http://coolify:8080')+ ->and($settings->sentinel_metrics_refresh_rate_seconds)->toBe(10)+ ->and($settings->sentinel_metrics_history_days)->toBe(7)+ ->and($settings->sentinel_push_interval_seconds)->toBe(60)+ ->and((bool) $settings->is_sentinel_debug_enabled)->toBeFalse();+ });++ it('offers a confirmed restore action and explains what it preserves', function () {+ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->assertSee('Restore defaults')+ ->assertSee('The Sentinel token and metrics setting will be preserved.');+ });++ it('does not let team members restore Sentinel defaults', function () {+ $member = User::factory()->create();+ $this->server->team->members()->attach($member->id, ['role' => 'member']);+ $before = $this->server->settings->fresh()->getAttributes();+ $this->actingAs($member);+ session(['currentTeam' => $this->server->team]);++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->call('restoreDefaultConfiguration');++ expect($this->server->settings->fresh()->getAttributes())->toBe($before);+ });++ it('shows local troubleshooting guidance when Sentinel is out of sync', function () {+ $this->server->sentinelHeartbeat(isReset: true);++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->assertSee('Sentinel has not reported within the expected interval.')+ ->assertSee('Open Sentinel logs')+ ->assertSeeHtml('href="'.route('server.sentinel.logs', ['server_uuid' => $this->server->uuid]).'"')+ ->assertDontSee('docker logs --tail 100 coolify-sentinel')+ ->assertSee('Sync Sentinel to recreate it on the Coolify Docker network.')+ ->assertDontSee('The remote server needs outbound access');+ });++ it('shows remote connectivity checks when Sentinel is out of sync', function () {+ $remoteServer = Server::factory()->create([+ 'team_id' => $this->server->team_id,+ 'ip' => '192.0.2.10',+ ]);+ $remoteServer->settings->forceFill([+ 'sentinel_custom_url' => 'https://coolify.example.com',+ ])->saveQuietly();+ $remoteServer->sentinelHeartbeat(isReset: true);++ Livewire::test(Sentinel::class, ['server' => $remoteServer])+ ->assertSee('The remote server needs outbound access to this Coolify URL.')+ ->assertSee('https://coolify.example.com/api/health')+ ->assertSee('Check DNS, TLS certificates, outbound firewall rules, and proxy settings.')+ ->assertDontSee('Sync Sentinel to recreate it on the Coolify Docker network.');+ });++ it('shell quotes the remote health URL in troubleshooting guidance', function () {+ $remoteServer = Server::factory()->create([+ 'team_id' => $this->server->team_id,+ 'ip' => '192.0.2.10',+ ]);+ $remoteServer->settings->forceFill([+ 'sentinel_custom_url' => 'https://coolify.example.com/$(id)',+ ])->saveQuietly();+ $remoteServer->sentinelHeartbeat(isReset: true);++ Livewire::test(Sentinel::class, ['server' => $remoteServer])+ ->assertSee("curl -fsS 'https://coolify.example.com/\$(id)/api/health'");+ });++ it('does not show troubleshooting guidance while Sentinel is live', function () {+ $this->server->sentinelHeartbeat();++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->assertDontSee('Sentinel has not reported within the expected interval.')+ ->assertDontSee('Open Sentinel logs');+ });++ it('shows restarting until the sentinel container starts', function () {+ Queue::fake();++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->call('restartSentinel')+ ->assertSet('sentinelStatus', 'restarting')+ ->assertSee('Restarting')+ ->assertDispatched('sentinel-status-changed', outOfSync: false, expiresInMilliseconds: 90000);+ });++ it('shows waiting for first report after the sentinel container starts', function () {+ $this->server->forceFill(['sentinel_waiting_since' => now()])->save();++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->call('handleSentinelRestarted', ['serverUuid' => $this->server->uuid])+ ->assertSet('sentinelStatus', 'waiting')+ ->assertSee('Waiting for first report')+ ->assertDontSee('Sentinel is out of sync');+ });++ it('uses one push interval plus thirty seconds for the first report timeout', function () {+ $this->server->settings->forceFill(['sentinel_push_interval_seconds' => 60])->saveQuietly();++ expect($this->server->firstSentinelReportTimeoutSeconds())->toBe(90)+ ->and($this->server->waitBeforeDoingSshCheck())->toBe(180);++ $this->server->forceFill(['sentinel_waiting_since' => now()->subSeconds(89)])->save();+ expect($this->server->fresh()->sentinelStatus())->toBe('waiting');++ $this->server->forceFill(['sentinel_waiting_since' => now()->subSeconds(91)])->save();+ expect($this->server->fresh()->sentinelStatus())->toBe('out_of_sync');+ });++ it('leaves restarting state when no container-start event arrives before the timeout', function () {+ $this->server->sentinelHeartbeat(isReset: true);++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->set('sentinelStatus', 'restarting')+ ->set('sentinelRestartRequestedAt', now()->subSeconds($this->server->firstSentinelReportTimeoutSeconds() + 1)->timestamp)+ ->call('refreshSentinelStatus')+ ->assertSet('sentinelStatus', 'out_of_sync');+ });++ it('shows in sync after the first authenticated report', function () {+ $this->server->sentinelHeartbeat();++ Livewire::test(Sentinel::class, ['server' => $this->server])+ ->call('handleSentinelSynchronized', ['serverUuid' => $this->server->uuid])+ ->assertSet('sentinelStatus', 'in_sync')+ ->assertSee('In sync');+ });++ it('shows out of sync when the first report timeout expires', function () {+ $this->server->forceFill([+ 'sentinel_waiting_since' => now()->subSeconds($this->server->firstSentinelReportTimeoutSeconds() + 1),+ ])->save();++ Livewire::test(Sentinel::class, ['server' => $this->server->fresh()])+ ->assertSet('sentinelStatus', 'out_of_sync')+ ->assertSee('Out of sync');+ });diff --cc tests/Feature/PersistentStorageVolumesLayoutTest.phpindex a567a6e5c8,8cc5104711..77778537f3--- a/tests/Feature/PersistentStorageVolumesLayoutTest.php+++ b/tests/Feature/PersistentStorageVolumesLayoutTest.php@@@ -215,6 -236,43 +228,40 @@@ it('renders volumes as a data table wit->toMatch('/\.application-settings-form label\s*\{[^}]*font-size:\s*13px/s');});+ it('keeps source paths out of the Docker volume creation form', function () {+ $view = file_get_contents(resource_path('views/livewire/project/service/storage.blade.php'));++ expect($view)+ ->not->toContain('id="host_path"')+ ->not->toContain('label="Source Path"')+ ->not->toContain('Swarm Mode detected');+ });++ it('creates named Docker volumes without a source path in swarm mode', function () {+ [$application] = createApplicationWithVolume();+ $application->persistentStorages()->delete();++ Livewire::test(Storage::class, ['resource' => $application])+ ->set('isSwarm', true)+ ->set('name', 'storage-app-data')+ ->set('mount_path', '/data')+ ->call('submitPersistentVolume')+ ->assertHasNoErrors();++ expect($application->persistentStorages()->first()->host_path)->toBeNull();+ });++ it('removes the source path column from Docker volume views', function () {+ $allView = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));- $showView = file_get_contents(resource_path('views/livewire/project/shared/storages/show.blade.php'));++ expect($allView)+ ->not->toContain('Source Path')+ ->not->toContain('volumes-col-source')+ ->not->toContain('forms.{{ $id }}.hostPath')- ->and($showView)- ->not->toContain('Source Path')- ->not->toContain('volumes-col-source')- ->not->toContain('id="hostPath"');++ ->and(resource_path('views/livewire/project/shared/storages/show.blade.php'))++ ->not->toBeFile();+ });+it('renders volume actions and PR suffix controls as valid markup', function () {[$application] = createApplicationWithVolume();LocalPersistentVolume::create([