Refactor GetContainersStatus.php for improved readability and maintainability
This commit is contained in:
parent
ba40f93386
commit
e91a64b1cc
@ -449,7 +449,7 @@ class GetContainersStatus
|
|||||||
if ($this->server->isSwarm()) {
|
if ($this->server->isSwarm()) {
|
||||||
return data_get($value, 'Spec.Name') === "coolify-proxy_$uuid";
|
return data_get($value, 'Spec.Name') === "coolify-proxy_$uuid";
|
||||||
} else {
|
} else {
|
||||||
return data_get($value, 'Name') === "$uuid-proxy";
|
return data_get($value, 'Name') === "/$uuid-proxy";
|
||||||
}
|
}
|
||||||
})->first();
|
})->first();
|
||||||
if (!$foundTcpProxy) {
|
if (!$foundTcpProxy) {
|
||||||
@ -473,7 +473,7 @@ class GetContainersStatus
|
|||||||
if ($this->server->isSwarm()) {
|
if ($this->server->isSwarm()) {
|
||||||
return data_get($value, 'Spec.Name') === "coolify-proxy_$uuid";
|
return data_get($value, 'Spec.Name') === "coolify-proxy_$uuid";
|
||||||
} else {
|
} else {
|
||||||
return data_get($value, 'Name') === "$uuid-proxy";
|
return data_get($value, 'Name') === "/$uuid-proxy";
|
||||||
}
|
}
|
||||||
})->first();
|
})->first();
|
||||||
if (!$foundTcpProxy) {
|
if (!$foundTcpProxy) {
|
||||||
|
@ -13,6 +13,6 @@ class StartSentinel
|
|||||||
if ($restart) {
|
if ($restart) {
|
||||||
instant_remote_process(['docker rm -f coolify-sentinel'], $server, false);
|
instant_remote_process(['docker rm -f coolify-sentinel'], $server, false);
|
||||||
}
|
}
|
||||||
return instant_remote_process(["docker run --rm --pull always -d --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v /data/coolify/metrics:/var/www/html/storage/app/metrics --pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-interval 10s --health-retries 3 ghcr.io/coollabsio/sentinel:$version"], $server, false);
|
return instant_remote_process(["docker run --rm --pull always -d --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v /data/coolify/metrics:/app/metrics -v /data/coolify/logs:/app/logs --pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-interval 10s --health-retries 3 ghcr.io/coollabsio/sentinel:$version"], $server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,10 @@ class PullSentinelImageJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
ray('Failed to get latest Sentinel version');
|
ray('Failed to get latest Sentinel version');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$local_version = instant_remote_process(['docker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/version"'], $this->server, '0.0.0');
|
$local_version = instant_remote_process(['docker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/version"'], $this->server, false);
|
||||||
|
if (empty($local_version)) {
|
||||||
|
$local_version = '0.0.0';
|
||||||
|
}
|
||||||
if (version_compare($local_version, $version, '<')) {
|
if (version_compare($local_version, $version, '<')) {
|
||||||
StartSentinel::run($this->server, $version, true);
|
StartSentinel::run($this->server, $version, true);
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user