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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Fix container status handling and notifications
Andras Bacsai3dd36a22717b
diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.phpindex a45bebf8e1..79265f7a10 100644--- a/app/Jobs/ContainerStatusJob.php+++ b/app/Jobs/ContainerStatusJob.php@@ -35,17 +35,13 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncryptedreturn $this->server->id;}- public function handle(): void+ public function handle(){// ray("checking container statuses for {$this->server->id}");try {if (!$this->server->isServerReady()) {return;};- $containers = instant_remote_process(["docker container ls -q"], $this->server);- if (!$containers) {- return;- }$containers = instant_remote_process(["docker container inspect $(docker container ls -q) --format '{{json .}}'"], $this->server);$containers = format_docker_command_output_to_json($containers);$applications = $this->server->applications();@@ -167,7 +163,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted} else {$url = null;}- $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url));+ $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));$exitedService->update(['status' => 'exited']);}@@ -194,7 +190,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted$url = null;}- $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url));+ $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));}$notRunningApplicationPreviews = $previews->pluck('id')->diff($foundApplicationPreviews);foreach ($notRunningApplicationPreviews as $previewId) {@@ -219,7 +215,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted$url = null;}- $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url));+ $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));}$notRunningDatabases = $databases->pluck('id')->diff($foundDatabases);foreach ($notRunningDatabases as $database) {@@ -243,7 +239,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted} else {$url = null;}- $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url));+ $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));}// Check if proxy is running@@ -256,7 +252,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted$shouldStart = CheckProxy::run($this->server);if ($shouldStart) {StartProxy::run($this->server, false);- $this->server->team->notify(new ContainerRestarted('coolify-proxy', $this->server));+ $this->server->team?->notify(new ContainerRestarted('coolify-proxy', $this->server));} else {ray('Proxy could not be started.');}@@ -272,7 +268,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted} catch (\Throwable $e) {send_internal_notification("ContainerStatusJob failed on ({$this->server->id}) with: " . $e->getMessage());ray($e->getMessage());- handleError($e);+ return handleError($e);}}}diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex 071c252ffa..839f868356 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -281,7 +281,7 @@ function send_internal_notification(string $message): voidtry {$baseUrl = config('app.name');$team = Team::find(0);- $team->notify(new GeneralNotification("π {$baseUrl}: " . $message));+ $team?->notify(new GeneralNotification("π {$baseUrl}: " . $message));ray("π {$baseUrl}: " . $message);} catch (\Throwable $e) {ray($e->getMessage());diff --git a/config/sentry.php b/config/sentry.phpindex efd043adfa..c07fda49b3 100644--- a/config/sentry.php+++ b/config/sentry.php@@ -7,7 +7,7 @@ return [// The release version of your application// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))- 'release' => '4.0.0-beta.146',+ 'release' => '4.0.0-beta.147',// When left empty or `null` the Laravel environment will be used'environment' => config('app.env'),diff --git a/config/version.php b/config/version.phpindex 8c257643ae..cf8ab74384 100644--- a/config/version.php+++ b/config/version.php@@ -1,3 +1,3 @@<?php-return '4.0.0-beta.146';+return '4.0.0-beta.147';diff --git a/versions.json b/versions.jsonindex 905876d7a5..02f132c2fd 100644--- a/versions.json+++ b/versions.json@@ -4,7 +4,7 @@"version": "3.12.36"},"v4": {- "version": "4.0.0-beta.146"+ "version": "4.0.0-beta.147"}}}