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
wip
Andras Bacsai8910d5a65dd0
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex 215d7e7d93..37258845ac 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -318,16 +318,16 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}dispatch(new InstanceProxyCheckJob());}queue_next_deployment($this->application);- if ($status === ProcessStatus::ERROR->value) {+ if ($status === ProcessStatus::FINISHED->value) {Notification::send($this->application->environment->project->team,- new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->pull_request_id)+ new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid));}- if ($status === ProcessStatus::FINISHED->value) {+ if ($status === ProcessStatus::ERROR->value) {Notification::send($this->application->environment->project->team,- new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid, $this->pull_request_id)+ new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->preview));}}diff --git a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.phpindex 9749b9c2e0..5ef1370e95 100644--- a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php+++ b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php@@ -3,6 +3,7 @@namespace App\Notifications\Notifications\Application;use App\Models\Application;+use App\Models\ApplicationPreview;use App\Models\Team;use App\Notifications\Channels\EmailChannel;use App\Notifications\Channels\DiscordChannel;@@ -17,7 +18,7 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQueuse Queueable;public Application $application;public string $deployment_uuid;- public int $pull_request_id;+ public ApplicationPreview|null $preview = null;public string $application_name;public string|null $deployment_url = null;@@ -25,11 +26,11 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQuepublic string $environment_name;public string $fqdn;- public function __construct(Application $application, string $deployment_uuid, int $pull_request_id = 0)+ public function __construct(Application $application, string $deployment_uuid, ApplicationPreview|null $preview = null){$this->application = $application;$this->deployment_uuid = $deployment_uuid;- $this->pull_request_id = $pull_request_id;+ $this->preview = $preview;$this->application_name = data_get($application, 'name');$this->project_uuid = data_get($application, 'environment.project.uuid');@@ -59,20 +60,20 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue'name' => $this->application_name,'fqdn' => $this->fqdn,'url' => $this->deployment_url,- 'pull_request_id' => $this->pull_request_id,+ 'pull_request_id' => $this->preview->pull_request_id,]);return $mail;}public function toDiscord(): string{- if ($this->pull_request_id !== 0) {- $message = '✅ Pull request #' . $this->pull_request_id . ' of **' . $this->application_name . '**.';+ if ($this->preview) {+ $message = '✅ Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '**. \n\n';+ $message .= '[Application Link](' . $this->preview->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';} else {- $message = '✅ A new version has been deployed of **' . $this->application_name . '**.';+ $message = '✅ A new version has been deployed of **' . $this->application_name . '**. \n\n ';+ $message .= '[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';}- $message .= "\n\n";- $message .= '[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';return $message;}}diff --git a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.phpindex 3ada48475f..01e3b4101e 100644--- a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php+++ b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php@@ -3,6 +3,7 @@namespace App\Notifications\Notifications\Application;use App\Models\Application;+use App\Models\ApplicationPreview;use App\Models\Team;use App\Notifications\Channels\EmailChannel;use App\Notifications\Channels\DiscordChannel;@@ -17,7 +18,7 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueueuse Queueable;public Application $application;public string $deployment_uuid;- public int $pull_request_id;+ public ApplicationPreview|null $preview;public string $application_name;public string|null $deployment_url = null;@@ -25,11 +26,11 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueuepublic string $environment_name;public string $fqdn;- public function __construct(Application $application, string $deployment_uuid, int $pull_request_id = 0)+ public function __construct(Application $application, string $deployment_uuid, ApplicationPreview|null $preview){$this->application = $application;$this->deployment_uuid = $deployment_uuid;- $this->pull_request_id = $pull_request_id;+ $this->preview = $preview;$this->application_name = data_get($application, 'name');$this->project_uuid = data_get($application, 'environment.project.uuid');@@ -59,7 +60,7 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue'name' => $this->application_name,'fqdn' => $this->fqdn,'url' => $this->deployment_url,- 'pull_request_id' => $this->pull_request_id,+ 'pull_request_id' => $this->preview->pull_request_id,]);return $mail;}@@ -67,8 +68,8 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueuepublic function toDiscord(): string{$message = '❌ Deployment failed of **' . $this->application_name;- if ($this->pull_request_id !== 0) {- $message .= ": PR# {$this->pull_request_id}";+ if ($this->preview) {+ $message .= ": PR# {$this->preview->pull_request_id}";}$message .= '**.';$message .= "\n\n";diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex 473ebec792..b79ed21718 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -44,9 +44,15 @@ function getRouteParameters()function get_latest_version_of_coolify(){- $response = Http::get('https://cdn.coollabs.io/coolify/versions.json');- $versions = $response->json();- return data_get($versions, 'coolify.v4.version');+ try {+ $response = Http::get('https://cdn.coollabs.io/coolify/versions.json');+ $versions = $response->json();+ return data_get($versions, 'coolify.v4.version');+ } catch (\Throwable $th) {+ //throw $th;+ ray($th->getMessage());+ return '0.0.0';+ }}function generate_random_name()