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/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php
index e7271039a..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,8 +125,13 @@ class ProductionSeeder extends Seeder
$server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
- StartProxy::dispatch($server);
- CheckAndStartSentinelJob::dispatch($server);
+ $shouldStart = CheckProxy::run($server);
+ if ($shouldStart) {
+ StartProxy::dispatch($server);
+ }
+ if ($server->isSentinelEnabled()) {
+ CheckAndStartSentinelJob::dispatch($server);
+ }
}
if (StandaloneDocker::find(0) == null) {
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 @@