Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

chore: Refactor GetContainersStatus.php for improved readability and maintainability

Andras Bacsai3eb4aed86770
diff --git a/app/Actions/Docker/GetContainersStatus.php b/app/Actions/Docker/GetContainersStatus.php
index 952dbfa1b0..d606c75328 100644
--- a/app/Actions/Docker/GetContainersStatus.php
+++ b/app/Actions/Docker/GetContainersStatus.php
@@ -52,11 +52,13 @@ class GetContainersStatus
return;
}
$sentinel_found = instant_remote_process(["docker inspect coolify-sentinel"], $this->server, false);
- if ($sentinel_found) {
- raY('Sentinel');
+ $sentinel_found = json_decode($sentinel_found, true);
+ $status = data_get($sentinel_found, '0.State.Status', 'exited');
+ if ($status === 'running') {
+ ray('Sentinel');
$this->sentinel();
} else {
- raY('Old way');
+ ray('Old way');
$this->old_way();
}
}
@@ -107,7 +109,6 @@ class GetContainersStatus
if ($application) {
$foundApplications[] = $application->id;
$statusFromDb = $application->status;
- ray($statusFromDb, $containerStatus);
if ($statusFromDb !== $containerStatus) {
$application->update(['status' => $containerStatus]);
}