diff --git a/app/Actions/Docker/GetContainersStatus.php b/app/Actions/Docker/GetContainersStatus.php index d606c7532..80f8c7d98 100644 --- a/app/Actions/Docker/GetContainersStatus.php +++ b/app/Actions/Docker/GetContainersStatus.php @@ -55,10 +55,10 @@ class GetContainersStatus $sentinel_found = json_decode($sentinel_found, true); $status = data_get($sentinel_found, '0.State.Status', 'exited'); if ($status === 'running') { - ray('Sentinel'); + ray('Checking with Sentinel'); $this->sentinel(); } else { - ray('Old way'); + ray('Checking the Old way'); $this->old_way(); } } diff --git a/app/Actions/Server/StartSentinel.php b/app/Actions/Server/StartSentinel.php new file mode 100644 index 000000000..b8b89a706 --- /dev/null +++ b/app/Actions/Server/StartSentinel.php @@ -0,0 +1,15 @@ +server->isFunctional()) { $this->cleanup(notify: false); $this->removeCoolifyYaml(); + $this->server->checkSentinel(); } } catch (\Throwable $e) { send_internal_notification('ServerStatusJob failed with: ' . $e->getMessage()); diff --git a/app/Models/Server.php b/app/Models/Server.php index 19da8d784..16659e2b8 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Actions\Server\InstallDocker; +use App\Actions\Server\StartSentinel; use App\Enums\ProxyTypes; use App\Notifications\Server\Revived; use App\Notifications\Server\Unreachable; @@ -462,6 +463,20 @@ $schema://$host { Storage::disk('ssh-keys')->delete($sshKeyFileLocation); Storage::disk('ssh-mux')->delete($this->muxFilename()); } + public function checkSentinel() { + ray("Checking sentinel on server: {$this->name}"); + if ($this->is_metrics_enabled) { + $sentinel_found = instant_remote_process(["docker inspect coolify-sentinel"], $this, false); + $sentinel_found = json_decode($sentinel_found, true); + $status = data_get($sentinel_found, '0.State.Status', 'exited'); + if ($status !== 'running') { + ray('Sentinel is not running, starting it...'); + StartSentinel::dispatch($this); + } else { + ray('Sentinel is running'); + } + } + } public function isServerReady(int $tries = 3) { if ($this->skipServer()) { diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 57dedea92..b934d8222 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -112,6 +112,9 @@ services: - "127.0.0.1:8888:8888" healthcheck: test: curl --fail http://127.0.0.1:8888/api/health || exit 1 + interval: 10s + retries: 2 + timeout: 5s postgres: volumes: - coolify-db:/var/lib/postgresql/data