diff --git a/app/Actions/Service/StartService.php b/app/Actions/Service/StartService.php
index 1e7779a75..d48594e62 100644
--- a/app/Actions/Service/StartService.php
+++ b/app/Actions/Service/StartService.php
@@ -41,6 +41,6 @@ class StartService
}
}
- return remote_process($commands, $service->server, type_uuid: $service->uuid);
+ return remote_process($commands, $service->server, type_uuid: $service->uuid, callEventOnFinish: 'ServiceStatusChanged');
}
}
diff --git a/app/Livewire/Project/Service/Heading.php b/app/Livewire/Project/Service/Heading.php
index eb7f469a8..d78fbe9ed 100644
--- a/app/Livewire/Project/Service/Heading.php
+++ b/app/Livewire/Project/Service/Heading.php
@@ -6,7 +6,6 @@ use App\Actions\Docker\GetContainersStatus;
use App\Actions\Service\StartService;
use App\Actions\Service\StopService;
use App\Enums\ProcessStatus;
-use App\Events\ServiceStatusChanged;
use App\Models\Service;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
@@ -96,7 +95,7 @@ class Heading extends Component
public function start()
{
$activity = StartService::run($this->service, pullLatestImages: true);
- $this->dispatch('activityMonitor', $activity->id, ServiceStatusChanged::class);
+ $this->dispatch('activityMonitor', $activity->id);
}
public function forceDeploy()
@@ -112,7 +111,7 @@ class Heading extends Component
$activity->save();
}
$activity = StartService::run($this->service, pullLatestImages: true, stopBeforeStart: true);
- $this->dispatch('activityMonitor', $activity->id, ServiceStatusChanged::class);
+ $this->dispatch('activityMonitor', $activity->id);
} catch (\Exception $e) {
$this->dispatch('error', $e->getMessage());
}
@@ -136,7 +135,7 @@ class Heading extends Component
return;
}
$activity = StartService::run($this->service, stopBeforeStart: true);
- $this->dispatch('activityMonitor', $activity->id, ServiceStatusChanged::class);
+ $this->dispatch('activityMonitor', $activity->id);
}
public function pullAndRestartEvent()
@@ -148,7 +147,7 @@ class Heading extends Component
return;
}
$activity = StartService::run($this->service, pullLatestImages: true, stopBeforeStart: true);
- $this->dispatch('activityMonitor', $activity->id, ServiceStatusChanged::class);
+ $this->dispatch('activityMonitor', $activity->id);
}
public function render()
diff --git a/app/Models/Service.php b/app/Models/Service.php
index c3c8f3215..a9302d7e7 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -2,6 +2,7 @@
namespace App\Models;
+use App\Enums\ProcessStatus;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -9,6 +10,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;
use OpenApi\Attributes as OA;
+use Spatie\Activitylog\Models\Activity;
use Spatie\Url\Url;
use Visus\Cuid2\Cuid2;
@@ -116,6 +118,18 @@ class Service extends BaseModel
return (bool) str($this->status)->contains('exited');
}
+ public function isStarting(): bool
+ {
+ try {
+ $activity = Activity::where('properties->type_uuid', $this->uuid)->latest()->first();
+ $status = data_get($activity, 'properties.status');
+
+ return $status === ProcessStatus::QUEUED->value || $status === ProcessStatus::IN_PROGRESS->value;
+ } catch (\Throwable) {
+ return false;
+ }
+ }
+
public function type()
{
return 'service';
@@ -159,6 +173,10 @@ class Service extends BaseModel
public function getStatusAttribute()
{
+ if ($this->isStarting()) {
+ return 'starting:unhealthy';
+ }
+
$applications = $this->applications;
$databases = $this->databases;
diff --git a/resources/views/components/status/services.blade.php b/resources/views/components/status/services.blade.php
index 5a52335a7..557fbfbfe 100644
--- a/resources/views/components/status/services.blade.php
+++ b/resources/views/components/status/services.blade.php
@@ -1,5 +1,7 @@
@if (str($complexStatus)->contains('running'))
+@elseif(str($complexStatus)->contains('starting'))
+
@elseif(str($complexStatus)->contains('restarting'))
@elseif(str($complexStatus)->contains('degraded'))
diff --git a/resources/views/livewire/project/resource/index.blade.php b/resources/views/livewire/project/resource/index.blade.php
index 421f74f8b..b508b7bae 100644
--- a/resources/views/livewire/project/resource/index.blade.php
+++ b/resources/views/livewire/project/resource/index.blade.php
@@ -72,6 +72,9 @@
+
+
+
@@ -118,6 +121,9 @@
+
+
+
@@ -164,6 +170,9 @@
+
+
+
diff --git a/resources/views/livewire/project/service/heading.blade.php b/resources/views/livewire/project/service/heading.blade.php
index c13ca59b7..e3c9129fa 100644
--- a/resources/views/livewire/project/service/heading.blade.php
+++ b/resources/views/livewire/project/service/heading.blade.php
@@ -136,7 +136,7 @@