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
feat: add coolify.environment label
Julien1086aea54d36
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex 7177b27f35..ef7163fccd 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -1683,7 +1683,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueuereturn escapeDollarSign($value);});}- $labels = $labels->merge(defaultLabels($this->application->id, $this->application->uuid, $this->application->project()->name, $this->application->name, $this->pull_request_id))->toArray();+ $labels = $labels->merge(defaultLabels($this->application->id, $this->application->uuid, $this->application->project()->name, $this->application->name, $this->application->environment->name, $this->pull_request_id))->toArray();// Check for custom HEALTHCHECKif ($this->application->build_pack === 'dockerfile' || $this->application->dockerfile) {diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.phpindex f80f7a69cc..ed2e34559c 100644--- a/bootstrap/helpers/docker.php+++ b/bootstrap/helpers/docker.php@@ -196,11 +196,12 @@ function defaultDatabaseLabels($database) {$labels->push('coolify.resourceName='.Str::slug($database->name));$labels->push('coolify.serviceName='.Str::slug($database->name));$labels->push('coolify.projectName='.Str::slug($database->project()->name));+ $labels->push('coolify.environment='.Str::slug($database->environment->name));return $labels;}-function defaultLabels($id, $name, string $projectName, string $resourceName, $pull_request_id = 0, string $type = 'application', $subType = null, $subId = null, $subName = null)+function defaultLabels($id, $name, string $projectName, string $resourceName, string $environment, $pull_request_id = 0, string $type = 'application', $subType = null, $subId = null, $subName = null){$labels = collect([]);$labels->push('coolify.managed=true');@@ -211,6 +212,8 @@ function defaultLabels($id, $name, string $projectName, string $resourceName, $p$labels->push('coolify.resourceName='.Str::slug($resourceName));$labels->push('coolify.projectName='.Str::slug($projectName));$labels->push('coolify.serviceName='.Str::slug($subName ?? $resourceName));+ $labels->push('coolify.environment='.Str::slug($environment));+$labels->push('coolify.pullRequestId='.$pull_request_id);if ($type === 'service') {$subId && $labels->push('coolify.service.subId='.$subId);diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex fe01e046e9..a006073577 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -2068,6 +2068,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = falsubType: $isDatabase ? 'database' : 'application',subId: $savedService->id,subName: $savedService->name,+ environment: $resource->environment->name,);$serviceLabels = $serviceLabels->merge($defaultLabels);if (! $isDatabase && $fqdns->count() > 0) {@@ -2902,6 +2903,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = falname: $containerName,projectName: $resource->project()->name,resourceName: $resource->name,+ environment: $resource->environment->name,pull_request_id: $pull_request_id,type: 'application');@@ -3687,13 +3689,15 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int}}}+$defaultLabels = defaultLabels(id: $resource->id,name: $containerName,projectName: $resource->project()->name,resourceName: $resource->name,pull_request_id: $pullRequestId,- type: 'application'+ type: 'application',+ environment: $resource->environment->name,);} elseif ($isService) {if ($savedService->serviceType()) {@@ -3711,6 +3715,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?intsubType: $isDatabase ? 'database' : 'application',subId: $savedService->id,subName: $savedService->human_name ?? $savedService->name,+ environment: $resource->environment->name,);}// Add COOLIFY_FQDN & COOLIFY_URL to environment