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 high disk usage notification bug in ServerStatusJob.php and HighDiskUsage.php
Andras Bacsai81437e682232
diff --git a/app/Jobs/ServerStatusJob.php b/app/Jobs/ServerStatusJob.phpindex 1d9c4a6829..d3599049db 100644--- a/app/Jobs/ServerStatusJob.php+++ b/app/Jobs/ServerStatusJob.php@@ -33,11 +33,13 @@ class ServerStatusJob implements ShouldQueue, ShouldBeEncrypted{ray("checking server status for {$this->server->id}");try {-$this->server->checkServerRediness();$disk_usage = $this->server->getDiskUsage();- ray($this->server->settings->cleanup_after_percentage);if ($disk_usage >= $this->server->settings->cleanup_after_percentage) {+ if ($this->server->high_disk_usage_notification_sent) {+ ray('high disk usage notification already sent');+ return;+ }$this->server->high_disk_usage_notification_sent = true;$this->server->save();$this->server->team->notify(new HighDiskUsage($this->server, $disk_usage, $this->server->settings->cleanup_after_percentage));diff --git a/app/Notifications/Server/HighDiskUsage.php b/app/Notifications/Server/HighDiskUsage.phpindex e638bc6c9e..d23a2a0a4c 100644--- a/app/Notifications/Server/HighDiskUsage.php+++ b/app/Notifications/Server/HighDiskUsage.php@@ -18,9 +18,6 @@ class HighDiskUsage extends Notification implements ShouldQueuepublic $tries = 1;public function __construct(public Server $server, public int $disk_usage, public int $cleanup_after_percentage){- if ($this->server->high_disk_usage_notification_sent === false) {- return;- }}public function via(object $notifiable): array@@ -56,13 +53,13 @@ class HighDiskUsage extends Notification implements ShouldQueuepublic function toDiscord(): string{- $message = "Coolify: Server '{$this->server->name}' high disk usage detected! \nDisk usage: {$this->disk_usage}";+ $message = "Coolify: Server '{$this->server->name}' high disk usage detected! \nDisk usage: {$this->disk_usage}. Please cleanup your disk to prevent data-loss. Here are some tips: https://coolify.io/docs/automated-cleanup.";return $message;}public function toTelegram(): array{return [- "message" => "Coolify: Server '{$this->server->name}' high disk usage detected! \n Disk usage: {$this->disk_usage}"+ "message" => "Coolify: Server '{$this->server->name}' high disk usage detected! \n Disk usage: {$this->disk_usage}. Please cleanup your disk to prevent data-loss. Here are some tips: https://coolify.io/docs/automated-cleanup."];}}diff --git a/resources/views/emails/high-disk-usage.blade.php b/resources/views/emails/high-disk-usage.blade.phpindex cff1590db8..0a4baa300e 100644--- a/resources/views/emails/high-disk-usage.blade.php+++ b/resources/views/emails/high-disk-usage.blade.php@@ -1,7 +1,9 @@<x-emails.layout>-Your server ({{ $name }}) has high disk usage ({{ $disk_usage }}%).+Your server ({{ $name }}) has high disk usage ({{ $disk_usage }}% used). Threshold is {{ $threshold }}%.-Threshold is {{ $threshold }}% (you can change it in the Server Settings menu).+Please cleanup your disk to prevent data-loss. Here are some [tips](https://coolify.io/docs/automated-cleanup).++(You can change the threshold in the Server Settings menu.)</x-emails.layout>