From 11fa319c3fb77fc0d14eba614c68e38d9bb4ffa5 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:34:41 +0200 Subject: [PATCH 01/90] chore(version): update coolify-realtime to version 1.0.9 in docker-compose and versions files --- docker-compose.prod.yml | 2 +- other/nightly/docker-compose.prod.yml | 2 +- other/nightly/install.sh | 2 ++ other/nightly/versions.json | 2 +- scripts/install.sh | 2 ++ versions.json | 2 +- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 965fca276..57f062202 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -61,7 +61,7 @@ services: retries: 10 timeout: 2s soketi: - image: '${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-realtime:1.0.8' + image: '${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-realtime:1.0.9' ports: - "${SOKETI_PORT:-6001}:6001" - "6002:6002" diff --git a/other/nightly/docker-compose.prod.yml b/other/nightly/docker-compose.prod.yml index fa30677ad..57f062202 100644 --- a/other/nightly/docker-compose.prod.yml +++ b/other/nightly/docker-compose.prod.yml @@ -61,7 +61,7 @@ services: retries: 10 timeout: 2s soketi: - image: '${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-realtime:1.0.8' + image: '${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-realtime:1.0.9' ports: - "${SOKETI_PORT:-6001}:6001" - "6002:6002" diff --git a/other/nightly/install.sh b/other/nightly/install.sh index c190c57ed..e9f54952a 100755 --- a/other/nightly/install.sh +++ b/other/nightly/install.sh @@ -801,6 +801,8 @@ set -e if [ "$IS_COOLIFY_VOLUME_EXISTS" -eq 0 ]; then echo " - Generating SSH key." + test -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal && rm -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal + test -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal.pub && rm -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal.pub ssh-keygen -t ed25519 -a 100 -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal -q -N "" -C coolify chown 9999 /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal sed -i "/coolify/d" ~/.ssh/authorized_keys diff --git a/other/nightly/versions.json b/other/nightly/versions.json index 6b41be267..eda548570 100644 --- a/other/nightly/versions.json +++ b/other/nightly/versions.json @@ -10,7 +10,7 @@ "version": "1.0.8" }, "realtime": { - "version": "1.0.8" + "version": "1.0.9" }, "sentinel": { "version": "0.0.15" diff --git a/scripts/install.sh b/scripts/install.sh index 217c70532..ae237a54a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -801,6 +801,8 @@ set -e if [ "$IS_COOLIFY_VOLUME_EXISTS" -eq 0 ]; then echo " - Generating SSH key." + test -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal && rm -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal + test -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal.pub && rm -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal.pub ssh-keygen -t ed25519 -a 100 -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal -q -N "" -C coolify chown 9999 /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal sed -i "/coolify/d" ~/.ssh/authorized_keys diff --git a/versions.json b/versions.json index 6b41be267..eda548570 100644 --- a/versions.json +++ b/versions.json @@ -10,7 +10,7 @@ "version": "1.0.8" }, "realtime": { - "version": "1.0.8" + "version": "1.0.9" }, "sentinel": { "version": "0.0.15" From e8e7b3bc59118c3eb805ffe9adbab34020f59c6c Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:38:01 +0200 Subject: [PATCH 02/90] feat(migration): add is_sentinel_enabled column to server_settings with default true --- ...6_123532_change_sentinel_on_by_default.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php diff --git a/database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php b/database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php new file mode 100644 index 000000000..4bcaf0a91 --- /dev/null +++ b/database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php @@ -0,0 +1,28 @@ +boolean('is_sentinel_enabled')->default(true); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('server_settings', function (Blueprint $table) { + $table->boolean('is_sentinel_enabled')->default(false); + }); + } +}; From e2df86f0f25c691391b9a1f32ed45d29c767c549 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:49:01 +0200 Subject: [PATCH 03/90] fix(migration): update default value handling for is_sentinel_enabled column in server_settings --- .../2025_06_16_123532_change_sentinel_on_by_default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php b/database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php index 4bcaf0a91..f4c6d4038 100644 --- a/database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php +++ b/database/migrations/2025_06_16_123532_change_sentinel_on_by_default.php @@ -12,7 +12,7 @@ return new class extends Migration public function up(): void { Schema::table('server_settings', function (Blueprint $table) { - $table->boolean('is_sentinel_enabled')->default(true); + $table->boolean('is_sentinel_enabled')->default(true)->change(); }); } @@ -22,7 +22,7 @@ return new class extends Migration public function down(): void { Schema::table('server_settings', function (Blueprint $table) { - $table->boolean('is_sentinel_enabled')->default(false); + $table->boolean('is_sentinel_enabled')->default(false)->change(); }); } }; From cde3c697a7ea0520f15d01c3e11c8bac3d2d78b1 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:51:54 +0200 Subject: [PATCH 04/90] feat(seeder): dispatch StartProxy action for each server in ProductionSeeder --- database/seeders/ProductionSeeder.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 058d4c8e4..645de6e09 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -2,6 +2,7 @@ namespace Database\Seeders; +use App\Actions\Proxy\StartProxy; use App\Data\ServerMetadata; use App\Enums\ProxyStatus; use App\Enums\ProxyTypes; @@ -115,11 +116,13 @@ class ProductionSeeder extends Seeder $server->settings->is_reachable = true; $server->settings->is_usable = true; $server->settings->save(); + StartProxy::dispatch($server); } else { $server = Server::find(0); $server->settings->is_reachable = true; $server->settings->is_usable = true; $server->settings->save(); + StartProxy::dispatch($server); } if (StandaloneDocker::find(0) == null) { From ad8b5bdcd35fddfff494b117db2b24a68ced6013 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:03:10 +0200 Subject: [PATCH 05/90] feat(seeder): add CheckAndStartSentinelJob dispatch for each server in ProductionSeeder --- database/seeders/ProductionSeeder.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 645de6e09..e7271039a 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -6,6 +6,7 @@ use App\Actions\Proxy\StartProxy; use App\Data\ServerMetadata; use App\Enums\ProxyStatus; use App\Enums\ProxyTypes; +use App\Jobs\CheckAndStartSentinelJob; use App\Models\GithubApp; use App\Models\GitlabApp; use App\Models\InstanceSettings; @@ -117,12 +118,14 @@ class ProductionSeeder extends Seeder $server->settings->is_usable = true; $server->settings->save(); StartProxy::dispatch($server); + CheckAndStartSentinelJob::dispatch($server); } else { $server = Server::find(0); $server->settings->is_reachable = true; $server->settings->is_usable = true; $server->settings->save(); StartProxy::dispatch($server); + CheckAndStartSentinelJob::dispatch($server); } if (StandaloneDocker::find(0) == null) { From 423cf8f67d88d7d0c0912b01929640a2e6ccf86f Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 17 Jun 2025 08:10:19 +0200 Subject: [PATCH 06/90] fix(seeder): conditionally dispatch CheckAndStartSentinelJob based on server's sentinel status --- database/seeders/ProductionSeeder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index e7271039a..839e2e15d 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -125,7 +125,9 @@ class ProductionSeeder extends Seeder $server->settings->is_usable = true; $server->settings->save(); StartProxy::dispatch($server); - CheckAndStartSentinelJob::dispatch($server); + if ($server->isSentinelEnabled()) { + CheckAndStartSentinelJob::dispatch($server); + } } if (StandaloneDocker::find(0) == null) { From bd9f3d9a6941e8b2bcd3724439b36cc1a1310a32 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 17 Jun 2025 08:11:02 +0200 Subject: [PATCH 07/90] feat(seeder): conditionally dispatch StartProxy action based on proxy check result --- database/seeders/ProductionSeeder.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 839e2e15d..adada458e 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -2,6 +2,7 @@ namespace Database\Seeders; +use App\Actions\Proxy\CheckProxy; use App\Actions\Proxy\StartProxy; use App\Data\ServerMetadata; use App\Enums\ProxyStatus; @@ -124,7 +125,10 @@ class ProductionSeeder extends Seeder $server->settings->is_reachable = true; $server->settings->is_usable = true; $server->settings->save(); - StartProxy::dispatch($server); + $shouldStart = CheckProxy::run($server); + if ($shouldStart) { + StartProxy::dispatch($server); + } if ($server->isSentinelEnabled()) { CheckAndStartSentinelJob::dispatch($server); } From f7daddce5867c5d1e8570c152d3c9e37ec38bc14 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 17 Jun 2025 09:28:07 +0200 Subject: [PATCH 08/90] refactor(ui): terminal --- .../Shared/ExecuteContainerCommand.php | 47 +++-------- app/Livewire/Project/Shared/Terminal.php | 2 +- resources/js/terminal.js | 1 - .../application/configuration.blade.php | 2 +- .../project/application/heading.blade.php | 2 +- .../project/database/configuration.blade.php | 2 +- .../project/database/heading.blade.php | 2 +- .../project/service/configuration.blade.php | 2 +- .../project/service/heading.blade.php | 2 +- .../livewire/project/service/index.blade.php | 2 +- .../execute-container-command.blade.php | 84 ++++++++----------- .../views/livewire/server/navbar.blade.php | 2 +- 12 files changed, 52 insertions(+), 98 deletions(-) diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index 97131c75c..ca1597d4f 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -13,8 +13,6 @@ class ExecuteContainerCommand extends Component { public $selected_container = 'default'; - public $container; - public Collection $containers; public $parameters; @@ -23,13 +21,9 @@ class ExecuteContainerCommand extends Component public string $type; - public Server $server; - public Collection $servers; - public bool $hasShell = true; - - public bool $isConnecting = true; + public bool $isConnecting = false; protected $rules = [ 'server' => 'required', @@ -78,8 +72,9 @@ class ExecuteContainerCommand extends Component } elseif (data_get($this->parameters, 'server_uuid')) { $this->type = 'server'; $this->resource = Server::where('uuid', $this->parameters['server_uuid'])->firstOrFail(); - $this->server = $this->resource; + $this->servers = $this->servers->push($this->resource); } + $this->servers = $this->servers->sortByDesc(fn ($server) => $server->isTerminalEnabled()); } public function loadContainers() @@ -97,7 +92,7 @@ class ExecuteContainerCommand extends Component } foreach ($containers as $container) { // if container state is running - if (data_get($container, 'State') === 'running') { + if (data_get($container, 'State') === 'running' && $server->isTerminalEnabled()) { $payload = [ 'server' => $server, 'container' => $container, @@ -106,7 +101,7 @@ class ExecuteContainerCommand extends Component } } } elseif (data_get($this->parameters, 'database_uuid')) { - if ($this->resource->isRunning()) { + if ($this->resource->isRunning() && $server->isTerminalEnabled()) { $this->containers = $this->containers->push([ 'server' => $server, 'container' => [ @@ -116,7 +111,7 @@ class ExecuteContainerCommand extends Component } } elseif (data_get($this->parameters, 'service_uuid')) { $this->resource->applications()->get()->each(function ($application) { - if ($application->isRunning()) { + if ($application->isRunning() && $this->resource->server->isTerminalEnabled()) { $this->containers->push([ 'server' => $this->resource->server, 'container' => [ @@ -137,41 +132,24 @@ class ExecuteContainerCommand extends Component }); } } - if ($this->containers->count() > 0) { - $this->container = $this->containers->first(); - } if ($this->containers->count() === 1) { $this->selected_container = data_get($this->containers->first(), 'container.Names'); } } - private function checkShellAvailability(Server $server, string $container): bool - { - $escapedContainer = escapeshellarg($container); - try { - instant_remote_process([ - "docker exec {$escapedContainer} bash -c 'exit 0' 2>/dev/null || ". - "docker exec {$escapedContainer} sh -c 'exit 0' 2>/dev/null", - ], $server); - - return true; - } catch (\Throwable) { - return false; - } - } - #[On('connectToServer')] public function connectToServer() { try { - if ($this->server->isForceDisabled()) { + $server = $this->servers->first(); + if ($server->isForceDisabled()) { throw new \RuntimeException('Server is disabled.'); } $this->dispatch( 'send-terminal-command', false, - data_get($this->server, 'name'), - data_get($this->server, 'uuid') + data_get($server, 'name'), + data_get($server, 'uuid') ); } catch (\Throwable $e) { return handleError($e, $this); @@ -222,11 +200,6 @@ class ExecuteContainerCommand extends Component throw new \RuntimeException('Server ownership verification failed.'); } - $this->hasShell = $this->checkShellAvailability($server, data_get($container, 'container.Names')); - if (! $this->hasShell) { - return; - } - $this->dispatch( 'send-terminal-command', true, diff --git a/app/Livewire/Project/Shared/Terminal.php b/app/Livewire/Project/Shared/Terminal.php index 52b209529..819d364e2 100644 --- a/app/Livewire/Project/Shared/Terminal.php +++ b/app/Livewire/Project/Shared/Terminal.php @@ -45,7 +45,7 @@ class Terminal extends Component { $server = Server::ownedByCurrentTeam()->whereUuid($serverUuid)->firstOrFail(); if (! $server->isTerminalEnabled() || $server->isForceDisabled()) { - throw new \RuntimeException('Terminal access is disabled on this server.'); + abort(403, 'Terminal access is disabled on this server.'); } if ($isContainer) { diff --git a/resources/js/terminal.js b/resources/js/terminal.js index d556baaf1..10535f3ea 100644 --- a/resources/js/terminal.js +++ b/resources/js/terminal.js @@ -514,7 +514,6 @@ export function initializeTerminalComponent() { const currentRows = this.term.rows; if (cols !== currentCols || rows !== currentRows) { - console.log(`[Terminal] Resizing terminal: ${currentCols}x${currentRows} -> ${cols}x${rows}`); this.term.resize(cols, rows); this.sendMessage({ resize: { cols: cols, rows: rows } diff --git a/resources/views/livewire/project/application/configuration.blade.php b/resources/views/livewire/project/application/configuration.blade.php index b907117e3..bf169077c 100644 --- a/resources/views/livewire/project/application/configuration.blade.php +++ b/resources/views/livewire/project/application/configuration.blade.php @@ -6,7 +6,7 @@ -
+
General diff --git a/resources/views/livewire/project/application/heading.blade.php b/resources/views/livewire/project/application/heading.blade.php index 6b5c33cdb..bc568bfe3 100644 --- a/resources/views/livewire/project/application/heading.blade.php +++ b/resources/views/livewire/project/application/heading.blade.php @@ -1,4 +1,4 @@ -