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
few fixes
Andras Bacsaif648ab49f728
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex 37258845ac..4f39113538 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -43,7 +43,7 @@ class ApplicationDeploymentJob implements ShouldQueueprivate string $build_image_name;private string $production_image_name;private string $container_name;- private ApplicationPreview|null $preview;+ private ApplicationPreview|null $preview = null;public static int $batch_counter = 0;public $timeout = 10200;@@ -66,8 +66,10 @@ class ApplicationDeploymentJob implements ShouldQueue$this->application = Application::find($this->application_id);+ ray('pullrequestId: ' . $this->pull_request_id);if ($this->pull_request_id !== 0) {$this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);+ ray($this->preview);}$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();@@ -319,16 +321,10 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}}queue_next_deployment($this->application);if ($status === ProcessStatus::FINISHED->value) {- Notification::send(- $this->application->environment->project->team,- new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid)- );+ $this->application->environment->project->team->notify(new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid, $this->preview));}if ($status === ProcessStatus::ERROR->value) {- Notification::send(- $this->application->environment->project->team,- new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->preview)- );+ $this->application->environment->project->team->notify(new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->preview));}}private function execute_in_builder(string $command)diff --git a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.phpindex c8ed0293d3..a13ad7901c 100644--- a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php+++ b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php@@ -31,7 +31,6 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue$this->application = $application;$this->deployment_uuid = $deployment_uuid;$this->preview = $preview;-$this->application_name = data_get($application, 'name');$this->project_uuid = data_get($application, 'environment.project.uuid');$this->environment_name = data_get($application, 'environment.name');@@ -55,12 +54,17 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQuepublic function toMail(Team $team): MailMessage{$mail = new MailMessage();- $mail->subject("✅ New version is deployed of {$this->application_name}");+ $pull_request_id = data_get($this->preview, 'pull_request_id', 0);+ if ($pull_request_id === 0) {+ $mail->subject("✅ New version is deployed of {$this->application_name}");+ } else {+ $mail->subject("✅ Pull request #{$pull_request_id} of {$this->application_name} deployed successfully");+ }$mail->view('emails.application-deployed-successfully', ['name' => $this->application_name,'fqdn' => $this->fqdn,'url' => $this->deployment_url,- 'pull_request_id' => $this->preview->pull_request_id,+ 'pull_request_id' => $pull_request_id,]);return $mail;}diff --git a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.phpindex 0499cc1612..ecbc97359e 100644--- a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php+++ b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php@@ -60,7 +60,7 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue'name' => $this->application_name,'fqdn' => $this->fqdn,'url' => $this->deployment_url,- 'pull_request_id' => $this->preview->pull_request_id,+ 'pull_request_id' => data_get($this->preview, 'pull_request_id', 0),]);return $mail;}diff --git a/resources/views/emails/application-deployed-successfully.blade.php b/resources/views/emails/application-deployed-successfully.blade.phpindex f0a6a596f6..0e4fccf8e7 100644--- a/resources/views/emails/application-deployed-successfully.blade.php+++ b/resources/views/emails/application-deployed-successfully.blade.php@@ -1,9 +1,8 @@-Hello,<br><br>--A new version of your application "{{ $name }}"@if ($pull_request_id !== 0)- :PR#{{ $pull_request_id }}-@endif has been deployed 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>+@if ($pull_request_id === 0)+ A new version of <a target="_blank" href="{{ $fqdn }}">{{ $fqdn }}</a> is available.<br><br>+@else+ Pull request #{{ $pull_request_id }} is available for review at <a target="_blank"+ href="{{ $fqdn }}">{{ $fqdn }}</a><br><br>+@endif+<a target="_blank" href="{{ $url }}">View+ Deployment Logs</a><br><br>diff --git a/resources/views/emails/application-deployed-with-error.blade.php b/resources/views/emails/application-deployed-with-error.blade.phpindex 1e499e6e85..d01c96bf87 100644--- a/resources/views/emails/application-deployed-with-error.blade.php+++ b/resources/views/emails/application-deployed-with-error.blade.php@@ -1,8 +1,12 @@Hello,<br><br>-Deployment failed of "{{ $name }}"@if ($pull_request_id !== 0)- :PR#{{ $pull_request_id }}-@endif to <a target="_blank" href="{{ $fqdn }}">{{ $fqdn }}</a><br><br>+Deployment failed of "{{ $name }}"++@if ($pull_request_id !== 0)+ :PR #{{ $pull_request_id }}+@endif++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>+ Deployment Logs</a><br><br>