Small fixes before release (#5999)
* chore(version): update coolify-realtime to version 1.0.9 in docker-compose and versions files * feat(migration): add is_sentinel_enabled column to server_settings with default true * fix(migration): update default value handling for is_sentinel_enabled column in server_settings * feat(seeder): dispatch StartProxy action for each server in ProductionSeeder * feat(seeder): add CheckAndStartSentinelJob dispatch for each server in ProductionSeeder * fix(seeder): conditionally dispatch CheckAndStartSentinelJob based on server's sentinel status * feat(seeder): conditionally dispatch StartProxy action based on proxy check result * refactor(ui): terminal * refactor(ui): remove terminal header from execute-container-command view * refactor(ui): remove unnecessary padding from deployment, backup, and logs sections
This commit is contained in:
@@ -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,
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user