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
updated DiscordMessages for Server notifications
Jakub Novákf021a4289055
diff --git a/app/Notifications/Server/DockerCleanup.php b/app/Notifications/Server/DockerCleanup.phpindex 682ed7a1a7..68d35b15ed 100644--- a/app/Notifications/Server/DockerCleanup.php+++ b/app/Notifications/Server/DockerCleanup.php@@ -5,6 +5,7 @@ namespace App\Notifications\Server;use App\Models\Server;use App\Notifications\Channels\DiscordChannel;use App\Notifications\Channels\TelegramChannel;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Notification;@@ -49,11 +50,13 @@ class DockerCleanup extends Notification implements ShouldQueue// return $mail;// }- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- $message = "Coolify: Server '{$this->server->name}' cleanup job done!\n\n{$this->message}";-- return $message;+ return new DiscordMessage(+ title: "Coolify: Server '{$this->server->name}' cleanup job done!",+ description: $this->message,+ color: DiscordMessage::successColor(),+ );}public function toTelegram(): arraydiff --git a/app/Notifications/Server/ForceDisabled.php b/app/Notifications/Server/ForceDisabled.phpindex 6377f2f150..a02228dc37 100644--- a/app/Notifications/Server/ForceDisabled.php+++ b/app/Notifications/Server/ForceDisabled.php@@ -6,6 +6,7 @@ use App\Models\Server;use App\Notifications\Channels\DiscordChannel;use App\Notifications\Channels\EmailChannel;use App\Notifications\Channels\TelegramChannel;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;@@ -50,9 +51,15 @@ class ForceDisabled extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- $message = "Coolify: Server ({$this->server->name}) disabled because it is not paid!\n All automations and integrations are stopped.\nPlease update your subscription to enable the server again [here](https://app.coolify.io/subscriptions).";+ $message = new DiscordMessage(+ title: "Coolify: Server ({$this->server->name}) disabled because it is not paid!",+ description: 'All automations and integrations are stopped.',+ color: DiscordMessage::errorColor(),+ );++ $message->addField('Link', 'Please update your subscription to enable the server again [here](https://app.coolify.io/subscriptions).');return $message;}diff --git a/app/Notifications/Server/ForceEnabled.php b/app/Notifications/Server/ForceEnabled.phpindex 83594d6434..c5c3e42b3e 100644--- a/app/Notifications/Server/ForceEnabled.php+++ b/app/Notifications/Server/ForceEnabled.php@@ -6,6 +6,7 @@ use App\Models\Server;use App\Notifications\Channels\DiscordChannel;use App\Notifications\Channels\EmailChannel;use App\Notifications\Channels\TelegramChannel;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;@@ -50,11 +51,13 @@ class ForceEnabled extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- $message = "Coolify: Server ({$this->server->name}) enabled again!";-- return $message;+ return new DiscordMessage(+ title: "Coolify: Server '{$this->server->name}' enabled again!",+ description: 'All automations and integrations are started.',+ color: DiscordMessage::successColor(),+ );}public function toTelegram(): arraydiff --git a/app/Notifications/Server/HighDiskUsage.php b/app/Notifications/Server/HighDiskUsage.phpindex 34cb220910..c91b8c2668 100644--- a/app/Notifications/Server/HighDiskUsage.php+++ b/app/Notifications/Server/HighDiskUsage.php@@ -6,6 +6,7 @@ use App\Models\Server;use App\Notifications\Channels\DiscordChannel;use App\Notifications\Channels\EmailChannel;use App\Notifications\Channels\TelegramChannel;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;@@ -52,9 +53,17 @@ class HighDiskUsage extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- $message = "Coolify: Server '{$this->server->name}' high disk usage detected!\nDisk usage: {$this->disk_usage}%. Threshold: {$this->docker_cleanup_threshold}%.\nPlease cleanup your disk to prevent data-loss.\nHere are some tips: https://coolify.io/docs/knowledge-base/server/automated-cleanup.";+ $message = new DiscordMessage(+ title: "Coolify: Server '{$this->server->name}' high disk usage detected!",+ description: 'Please cleanup your disk to prevent data-loss.',+ color: DiscordMessage::errorColor(),+ );++ $message->addField('Disk usage', "{$this->disk_usage}%");+ $message->addField('Threshold', "{$this->docker_cleanup_threshold}%");+ $message->addField('Link', 'Here are some tips: https://coolify.io/docs/knowledge-base/server/automated-cleanup.');return $message;}diff --git a/app/Notifications/Server/Revived.php b/app/Notifications/Server/Revived.phpindex 3f2b3b6962..c3a3f389ae 100644--- a/app/Notifications/Server/Revived.php+++ b/app/Notifications/Server/Revived.php@@ -8,6 +8,7 @@ use App\Models\Server;use App\Notifications\Channels\DiscordChannel;use App\Notifications\Channels\EmailChannel;use App\Notifications\Channels\TelegramChannel;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;@@ -72,11 +73,13 @@ class Revived extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- $message = "Coolify: Server '{$this->server->name}' revived. All automations & integrations are turned on again!";-- return $message;+ return new DiscordMessage(+ title: "Coolify: Server '{$this->server->name}' revived.",+ description: 'All automations & integrations are turned on again!',+ color: DiscordMessage::successColor(),+ );}public function toTelegram(): arraydiff --git a/app/Notifications/Server/Unreachable.php b/app/Notifications/Server/Unreachable.phpindex 2fb83559aa..7e56123e4f 100644--- a/app/Notifications/Server/Unreachable.php+++ b/app/Notifications/Server/Unreachable.php@@ -6,6 +6,7 @@ use App\Models\Server;use App\Notifications\Channels\DiscordChannel;use App\Notifications\Channels\EmailChannel;use App\Notifications\Channels\TelegramChannel;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;@@ -63,9 +64,15 @@ class Unreachable extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- $message = "Coolify: Your server '{$this->server->name}' is unreachable. All automations & integrations are turned off! Please check your server! IMPORTANT: We automatically try to revive your server and turn on all automations & integrations.";+ $message = new DiscordMessage(+ title: "Coolify: Your server '{$this->server->name}' is unreachable.",+ description: 'All automations & integrations are turned off! Please check your server!',+ color: DiscordMessage::errorColor(),+ );++ $message->addField('IMPORTANT', 'We automatically try to revive your server and turn on all automations & integrations.');return $message;}