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
updates
Andras Bacsai6d2b88c31f7b
diff --git a/app/Http/Livewire/Notifications/DiscordSettings.php b/app/Http/Livewire/Notifications/DiscordSettings.phpindex 4e47c3ec76..4a9ae47882 100644--- a/app/Http/Livewire/Notifications/DiscordSettings.php+++ b/app/Http/Livewire/Notifications/DiscordSettings.php@@ -15,16 +15,12 @@ class DiscordSettings extends Componentprotected $rules = ['model.extra_attributes.discord_active' => 'nullable|boolean','model.extra_attributes.discord_webhook' => 'required|url',- 'model.extra_attributes.notifications_test' => 'nullable|boolean',- 'model.extra_attributes.notifications_deployments' => 'nullable|boolean',+ 'model.extra_attributes.notifications_discord_test' => 'nullable|boolean',+ 'model.extra_attributes.notifications_discord_deployments' => 'nullable|boolean',];protected $validationAttributes = ['model.extra_attributes.discord_webhook' => 'Discord Webhook',];- public function instantSaveEvents()- {- $this->saveModel();- }public function instantSave(){try {@@ -34,7 +30,7 @@ class DiscordSettings extends Component$this->validate();}}- private function saveModel()+ public function saveModel(){$this->model->save();if (is_a($this->model, Team::class)) {diff --git a/app/Http/Livewire/Notifications/EmailSettings.php b/app/Http/Livewire/Notifications/EmailSettings.phpindex 186ca7898f..2943ef14f5 100644--- a/app/Http/Livewire/Notifications/EmailSettings.php+++ b/app/Http/Livewire/Notifications/EmailSettings.php@@ -24,8 +24,8 @@ class EmailSettings extends Component'model.extra_attributes.smtp_password' => 'nullable','model.extra_attributes.smtp_timeout' => 'nullable','model.extra_attributes.smtp_test_recipients' => 'nullable',- 'model.extra_attributes.notifications_deployments' => 'nullable|boolean',- 'model.extra_attributes.notifications_test' => 'nullable|boolean',+ 'model.extra_attributes.notifications_email_test' => 'nullable|boolean',+ 'model.extra_attributes.notifications_email_deployments' => 'nullable|boolean',];protected $validationAttributes = ['model.extra_attributes.smtp_from_address' => 'From Address',@@ -62,7 +62,7 @@ class EmailSettings extends Component$this->model->extra_attributes->smtp_test_recipients = str_replace(' ', '', $this->model->extra_attributes->smtp_test_recipients);$this->saveModel();}- private function saveModel()+ public function saveModel(){$this->model->save();if (is_a($this->model, Team::class)) {@@ -73,10 +73,7 @@ class EmailSettings extends Componentpublic function sendTestNotification(){Notification::send($this->model, new TestNotification);- }- public function instantSaveEvents()- {- $this->saveModel();+ $this->emit('success', 'Test notification sent.');}public function instantSave(){diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex 450e5a8cc7..f45d1d2837 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -9,7 +9,8 @@ use App\Enums\ProcessStatus;use App\Models\Application;use App\Models\ApplicationDeploymentQueue;use App\Models\ApplicationPreview;-use App\Notifications\Notifications\ApplicationDeployedNotification;+use App\Notifications\Notifications\Application\DeployedSuccessfullyNotification;+use App\Notifications\Notifications\Application\DeployedWithErrorNotification;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;@@ -317,7 +318,12 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}dispatch(new InstanceProxyCheckJob());}queue_next_deployment($this->application);- Notification::send($this->application->environment->project->team, new ApplicationDeployedNotification($this->application, $this->deployment_uuid));+ if ($status === ProcessStatus::ERROR->value) {+ Notification::send($this->application->environment->project->team, new DeployedWithErrorNotification($this->application, $this->deployment_uuid));+ }+ if ($status === ProcessStatus::FINISHED->value) {+ Notification::send($this->application->environment->project->team, new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid));+ }}private function execute_in_builder(string $command){diff --git a/app/Notifications/Notifications/ApplicationDeployedNotification.php b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.phpsimilarity index 77%rename from app/Notifications/Notifications/ApplicationDeployedNotification.phprename to app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.phpindex 8718b5a614..19137df1c2 100644--- a/app/Notifications/Notifications/ApplicationDeployedNotification.php+++ b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php@@ -1,6 +1,6 @@<?php-namespace App\Notifications\Notifications;+namespace App\Notifications\Notifications\Application;use App\Models\Application;use App\Models\Team;@@ -12,12 +12,13 @@ use Illuminate\Notifications\Messages\MailMessage;use Illuminate\Notifications\Notification;use Illuminate\Support\Str;-class ApplicationDeployedNotification extends Notification implements ShouldQueue+class DeployedSuccessfullyNotification extends Notification implements ShouldQueue{use Queueable;public Application $application;public string $application_name;public string $deployment_uuid;+public string|null $deployment_url = null;public string $project_uuid;public string $environment_name;@@ -26,8 +27,8 @@ class ApplicationDeployedNotification extends Notification implements ShouldQueupublic function __construct(Application $application, string $deployment_uuid){$this->application = $application;- $this->application_name = data_get($application, 'name');$this->deployment_uuid = $deployment_uuid;+ $this->application_name = data_get($application, 'name');$this->project_uuid = data_get($application, 'environment.project.uuid');$this->environment_name = data_get($application, 'environment.name');$this->fqdn = data_get($application, 'fqdn');@@ -39,10 +40,10 @@ class ApplicationDeployedNotification extends Notification implements ShouldQueupublic function via(object $notifiable): array{$channels = [];- if ($notifiable->extra_attributes?->get('email_active') && $notifiable->extra_attributes?->get('notifications_deployments')) {+ if ($notifiable->extra_attributes?->get('smtp_active') && $notifiable->extra_attributes?->get('notifications_email_deployments')) {$channels[] = EmailChannel::class;}- if ($notifiable->extra_attributes?->get('discord_active') && $notifiable->extra_attributes?->get('notifications_deployments')) {+ if ($notifiable->extra_attributes?->get('discord_active') && $notifiable->extra_attributes?->get('notifications_discord_deployments')) {$channels[] = DiscordChannel::class;}return $channels;@@ -50,8 +51,8 @@ class ApplicationDeployedNotification extends Notification implements ShouldQueupublic function toMail(Team $team): MailMessage{$mail = new MailMessage();- $mail->subject("New version is deployed of {$this->application_name}");- $mail->view('emails.application-deployed', [+ $mail->subject("✅ New version is deployed of {$this->application_name}");+ $mail->view('emails.application-deployed-successfully', ['name' => $this->application_name,'fqdn' => $this->fqdn,'url' => $this->deployment_url,@@ -61,7 +62,8 @@ class ApplicationDeployedNotification extends Notification implements ShouldQueupublic function toDiscord(): string{- return '⚒️ A new version has been deployed of **' . $this->application_name . '**.+ return '✅ A new version has been deployed of **' . $this->application_name . '**.+[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';}}diff --git a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.phpnew file mode 100644index 0000000000..8980d0e468--- /dev/null+++ b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php@@ -0,0 +1,69 @@+<?php++namespace App\Notifications\Notifications\Application;++use App\Models\Application;+use App\Models\Team;+use App\Notifications\Channels\EmailChannel;+use App\Notifications\Channels\DiscordChannel;+use Illuminate\Bus\Queueable;+use Illuminate\Contracts\Queue\ShouldQueue;+use Illuminate\Notifications\Messages\MailMessage;+use Illuminate\Notifications\Notification;+use Illuminate\Support\Str;++class DeployedWithErrorNotification extends Notification implements ShouldQueue+{+ use Queueable;+ public Application $application;+ public string $application_name;+ public string $deployment_uuid;++ public string|null $deployment_url = null;+ public string $project_uuid;+ public string $environment_name;+ public string $fqdn;++ public function __construct(Application $application, string $deployment_uuid)+ {+ $this->application = $application;+ $this->deployment_uuid = $deployment_uuid;+ $this->application_name = data_get($application, 'name');+ $this->project_uuid = data_get($application, 'environment.project.uuid');+ $this->environment_name = data_get($application, 'environment.name');+ $this->fqdn = data_get($application, 'fqdn');+ if (Str::of($this->fqdn)->explode(',')->count() > 1) {+ $this->fqdn = Str::of($this->fqdn)->explode(',')->first();+ }+ $this->deployment_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";+ }+ public function via(object $notifiable): array+ {+ $channels = [];+ if ($notifiable->extra_attributes?->get('smtp_active') && $notifiable->extra_attributes?->get('notifications_email_deployments')) {+ $channels[] = EmailChannel::class;+ }+ if ($notifiable->extra_attributes?->get('discord_active') && $notifiable->extra_attributes?->get('notifications_discord_deployments')) {+ $channels[] = DiscordChannel::class;+ }+ return $channels;+ }+ public function toMail(Team $team): MailMessage+ {+ $mail = new MailMessage();+ $mail->subject("❌ Deployment failed of {$this->application_name}");+ $mail->view('emails.application-deployed-with-error', [+ 'name' => $this->application_name,+ 'fqdn' => $this->fqdn,+ 'url' => $this->deployment_url,+ ]);+ return $mail;+ }++ public function toDiscord(): string+ {+ return '❌ Deployment failed of **' . $this->application_name . '**.++[Deployment logs](' . $this->deployment_url . ')';+ }+}diff --git a/app/Notifications/Notifications/TestNotification.php b/app/Notifications/Notifications/TestNotification.phpindex 9f535e0a3d..d98ed1af1a 100644--- a/app/Notifications/Notifications/TestNotification.php+++ b/app/Notifications/Notifications/TestNotification.php@@ -15,10 +15,10 @@ class TestNotification extends Notification implements ShouldQueuepublic function via(object $notifiable): array{$channels = [];- if ($notifiable->extra_attributes?->get('email_active') && $notifiable->extra_attributes?->get('notifications_test')) {+ if ($notifiable->extra_attributes?->get('smtp_active') && $notifiable->extra_attributes?->get('notifications_email_test')) {$channels[] = EmailChannel::class;}- if ($notifiable->extra_attributes?->get('discord_active') && $notifiable->extra_attributes?->get('notifications_test')) {+ if ($notifiable->extra_attributes?->get('discord_active') && $notifiable->extra_attributes?->get('notifications_discord_test')) {$channels[] = DiscordChannel::class;}return $channels;diff --git a/resources/views/components/notification-subscription.blade.php b/resources/views/components/notification-subscription.blade.phpdeleted file mode 100644index 7812208679..0000000000--- a/resources/views/components/notification-subscription.blade.php+++ /dev/null@@ -1,9 +0,0 @@- <h4 class="mt-4">Subscribe to events</h4>- <div class="w-64 ">- @if (isDev())- <x-forms.checkbox instantSave="instantSaveEvents" id="model.extra_attributes.notifications_test"- label="Test Notifications" />- @endif- <x-forms.checkbox instantSave="instantSaveEvents" id="model.extra_attributes.notifications_deployments"- label="New Deployments" />- </div>diff --git a/resources/views/emails/application-deployed.blade.php b/resources/views/emails/application-deployed-successfully.blade.phpsimilarity index 100%rename from resources/views/emails/application-deployed.blade.phprename to resources/views/emails/application-deployed-successfully.blade.phpdiff --git a/resources/views/emails/application-deployed-with-error.blade.php b/resources/views/emails/application-deployed-with-error.blade.phpnew file mode 100644index 0000000000..ed4127cf7b--- /dev/null+++ b/resources/views/emails/application-deployed-with-error.blade.php@@ -0,0 +1,7 @@+Hello,<br><br>++Deployment failed of "{{ $name }}" to <a target="_blank"+ href="{{ $fqdn }}">{{ $fqdn }}</a><br><br>++Click the following link to view the deployment logs: <a target="_blank" href="{{ $url }}">View+ Deployment</a><br><br>diff --git a/resources/views/livewire/notifications/discord-settings.blade.php b/resources/views/livewire/notifications/discord-settings.blade.phpindex aa66c5ff47..ac943dacb2 100644--- a/resources/views/livewire/notifications/discord-settings.blade.php+++ b/resources/views/livewire/notifications/discord-settings.blade.php@@ -19,5 +19,13 @@helper="Generate a webhook in Discord.<br>Example: https://discord.com/api/webhooks/...." requiredid="model.extra_attributes.discord_webhook" label="Webhook" /></form>- <x-notification-subscription />+ <h4 class="mt-4">Subscribe to events</h4>+ <div class="w-64 ">+ @if (isDev())+ <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_discord_test"+ label="Test Notifications" />+ @endif+ <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_discord_deployments"+ label="New Deployments" />+ </div></div>diff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.phpindex 81c1b78baf..015db8b009 100644--- a/resources/views/livewire/notifications/email-settings.blade.php+++ b/resources/views/livewire/notifications/email-settings.blade.php@@ -53,5 +53,13 @@</div></div></form>- <x-notification-subscription />+ <h4 class="mt-4">Subscribe to events</h4>+ <div class="w-64 ">+ @if (isDev())+ <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_email_test"+ label="Test Notifications" />+ @endif+ <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_email_deployments"+ label="New Deployments" />+ </div></div>