From 8f7eb2d79051cc0d82f1b11904c8fdff0296d557 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Fri, 7 Aug 2026 15:21:18 +0200 Subject: [PATCH] feat(server): auto-resolve Sentinel URL and polish setup UI Ensure a Sentinel endpoint from instance FQDN/IP when enabling, use process dialogs for validation with install state, and tidy server create, boarding, metrics empty state, and log timestamps. --- app/Actions/Server/StartSentinel.php | 5 +- app/Livewire/Server/Sentinel.php | 3 +- app/Livewire/Server/ValidateAndInstall.php | 5 ++ app/Models/ServerSetting.php | 17 ++++- bootstrap/helpers/remoteProcess.php | 2 +- .../views/livewire/activity-monitor.blade.php | 2 +- .../views/livewire/boarding/index.blade.php | 8 +-- .../views/livewire/server/charts.blade.php | 4 -- .../views/livewire/server/create.blade.php | 63 ++++++++++--------- .../views/livewire/server/new/by-ip.blade.php | 52 +++++++++------ .../views/livewire/server/sentinel.blade.php | 9 +-- .../views/livewire/server/show.blade.php | 15 ++--- .../server/validate-and-install.blade.php | 54 ++++++++++------ tests/Feature/BoardingActionsLayoutTest.php | 16 +++++ .../Livewire/SentinelComponentTest.php | 17 +++++ tests/Feature/ServerBuildRoleHelperTest.php | 9 +++ tests/Feature/ServerCreatePageLayoutTest.php | 10 +++ .../ServerCreationBuildRoleLayoutTest.php | 22 +++++++ tests/Feature/ServerMetricsEmptyStateTest.php | 10 +++ tests/Feature/ServerValidationDialogTest.php | 55 ++++++++++++++++ tests/Unit/LogTimestampDisplayTest.php | 9 +++ .../StartSentinelEndpointFallbackTest.php | 16 +++++ 22 files changed, 306 insertions(+), 97 deletions(-) create mode 100644 tests/Feature/BoardingActionsLayoutTest.php create mode 100644 tests/Feature/ServerBuildRoleHelperTest.php create mode 100644 tests/Feature/ServerCreatePageLayoutTest.php create mode 100644 tests/Feature/ServerCreationBuildRoleLayoutTest.php create mode 100644 tests/Feature/ServerMetricsEmptyStateTest.php create mode 100644 tests/Feature/ServerValidationDialogTest.php create mode 100644 tests/Unit/LogTimestampDisplayTest.php create mode 100644 tests/Unit/StartSentinelEndpointFallbackTest.php diff --git a/app/Actions/Server/StartSentinel.php b/app/Actions/Server/StartSentinel.php index 6350a5f37..cec90288e 100644 --- a/app/Actions/Server/StartSentinel.php +++ b/app/Actions/Server/StartSentinel.php @@ -23,13 +23,10 @@ class StartSentinel $refreshRate = data_get($server, 'settings.sentinel_metrics_refresh_rate_seconds'); $pushInterval = data_get($server, 'settings.sentinel_push_interval_seconds'); $token = $server->settings->ensureValidSentinelToken(); - $endpoint = data_get($server, 'settings.sentinel_custom_url'); + $endpoint = $server->settings->ensureSentinelUrl(); $debug = data_get($server, 'settings.is_sentinel_debug_enabled'); $mountDir = '/data/coolify/sentinel'; $image = coolifyRegistryUrl().'/coollabsio/sentinel:'.$version; - if (! $endpoint) { - throw new \RuntimeException('You should set FQDN in Instance Settings.'); - } $environments = [ 'TOKEN' => $token, 'DEBUG' => $debug ? 'true' : 'false', diff --git a/app/Livewire/Server/Sentinel.php b/app/Livewire/Server/Sentinel.php index 909ed54f9..cd05002aa 100644 --- a/app/Livewire/Server/Sentinel.php +++ b/app/Livewire/Server/Sentinel.php @@ -114,9 +114,10 @@ class Sentinel extends Component return; } - $this->isSentinelEnabled = true; $customImage = isDev() ? $this->sentinelCustomDockerImage : null; StartSentinel::run($this->server, true, null, $customImage); + $this->sentinelCustomUrl = $this->server->settings->sentinel_custom_url; + $this->isSentinelEnabled = true; } else { $this->isSentinelEnabled = false; $this->isMetricsEnabled = false; diff --git a/app/Livewire/Server/ValidateAndInstall.php b/app/Livewire/Server/ValidateAndInstall.php index c7181ebcf..9e6108de0 100644 --- a/app/Livewire/Server/ValidateAndInstall.php +++ b/app/Livewire/Server/ValidateAndInstall.php @@ -39,6 +39,8 @@ class ValidateAndInstall extends Component public bool $ask = false; + public bool $isInstalling = false; + protected $listeners = [ 'init', 'validateConnection', @@ -51,6 +53,7 @@ class ValidateAndInstall extends Component public function init(int $data = 0) { + $this->isInstalling = false; $this->uptime = null; $this->supported_os_type = null; $this->prerequisites_installed = null; @@ -172,6 +175,7 @@ class ValidateAndInstall extends Component if ($this->number_of_tries <= $this->max_tries) { $this->installationStep = 'Prerequisites'; $activity = $this->server->installPrerequisites(); + $this->isInstalling = true; $this->number_of_tries++; $this->dispatch('activityMonitor', $activity->id, 'init', $this->number_of_tries, "{$this->installationStep} Installation Logs"); } @@ -208,6 +212,7 @@ class ValidateAndInstall extends Component if ($this->number_of_tries <= $this->max_tries) { $this->installationStep = 'Docker'; $activity = $this->server->installDocker(); + $this->isInstalling = true; $this->number_of_tries++; $this->dispatch('activityMonitor', $activity->id, 'init', $this->number_of_tries, "{$this->installationStep} Installation Logs"); } diff --git a/app/Models/ServerSetting.php b/app/Models/ServerSetting.php index 0453dc793..3bd39aeb1 100644 --- a/app/Models/ServerSetting.php +++ b/app/Models/ServerSetting.php @@ -219,7 +219,22 @@ class ServerSetting extends Model return $token; } - public function generateSentinelUrl(bool $save = true, bool $ignoreEvent = false) + public function ensureSentinelUrl(): string + { + $url = $this->sentinel_custom_url; + + if (blank($url)) { + $url = $this->generateSentinelUrl(ignoreEvent: true); + } + + if (blank($url)) { + throw new \RuntimeException('Set an instance FQDN or public IP before enabling Sentinel.'); + } + + return $url; + } + + public function generateSentinelUrl(bool $save = true, bool $ignoreEvent = false): ?string { $domain = null; $settings = InstanceSettings::get(); diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index 84522a5e1..fee3f376f 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -253,7 +253,7 @@ function decode_remote_command_output(?ApplicationDeploymentQueue $application_d } catch (Exception) { $timestamp->setTimezone('UTC'); } - data_set($i, 'timestamp', $timestamp->format('Y-M-d H:i:s.u')); + data_set($i, 'timestamp', $timestamp->format('Y-M-d H:i:s')); return $i; }) diff --git a/resources/views/livewire/activity-monitor.blade.php b/resources/views/livewire/activity-monitor.blade.php index f3e79db0e..495d5cf52 100644 --- a/resources/views/livewire/activity-monitor.blade.php +++ b/resources/views/livewire/activity-monitor.blade.php @@ -1,7 +1,7 @@ @php use App\Actions\CoolifyTask\RunRemoteProcess; @endphp