fix: proxy container status
This commit is contained in:
parent
9646969107
commit
9a706d55b4
@ -40,7 +40,8 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||
return $this->server->uuid;
|
||||
}
|
||||
|
||||
private function checkServerConnection() {
|
||||
private function checkServerConnection()
|
||||
{
|
||||
$uptime = instant_remote_process(['uptime'], $this->server, false);
|
||||
if (!is_null($uptime)) {
|
||||
return true;
|
||||
@ -66,6 +67,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||
sleep(5);
|
||||
}
|
||||
$containers = instant_remote_process(["docker container ls -q"], $this->server);
|
||||
ray($containers);
|
||||
if (!$containers) {
|
||||
return;
|
||||
}
|
||||
@ -74,14 +76,20 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||
$applications = $this->server->applications();
|
||||
$databases = $this->server->databases();
|
||||
$previews = $this->server->previews();
|
||||
if ($this->server->isProxyShouldRun()) {
|
||||
|
||||
/// Check if proxy is running
|
||||
$foundProxyContainer = $containers->filter(function ($value, $key) {
|
||||
return data_get($value, 'Name') === '/coolify-proxy';
|
||||
})->first();
|
||||
if (!$foundProxyContainer) {
|
||||
if ($this->server->isProxyShouldRun()) {
|
||||
resolve(StartProxy::class)($this->server, false);
|
||||
$this->server->team->notify(new ContainerRestarted('coolify-proxy', $this->server));
|
||||
}
|
||||
} else {
|
||||
ray($foundProxyContainer);
|
||||
$this->server->proxy->status = data_get($foundProxyContainer, 'State.Status');
|
||||
$this->server->save();
|
||||
}
|
||||
$foundApplications = [];
|
||||
$foundApplicationPreviews = [];
|
||||
@ -132,7 +140,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$notRunningApplications = $applications->pluck('id')->diff($foundApplications);
|
||||
foreach ($notRunningApplications as $applicationId) {
|
||||
@ -253,7 +260,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||
return Str::startsWith(data_get($value, 'Name'), "/$uuid-pr-{$preview->id}");
|
||||
})->first();
|
||||
}
|
||||
|
||||
}
|
||||
foreach ($databases as $database) {
|
||||
$uuid = data_get($database, 'uuid');
|
||||
|
Loading…
x
Reference in New Issue
Block a user