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