Skip to content

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.

fix(core): Improve label generation and merging for applications and services

Andras Bacsai1c21652d5db9
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 21c7e4820f..5301363785 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -19,6 +19,7 @@ use App\Notifications\Application\DeploymentFailed;
use App\Notifications\Application\DeploymentSuccess;
use App\Traits\ExecuteRemoteCommand;
use Carbon\Carbon;
+use Exception;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
use Illuminate\Contracts\Queue\ShouldQueue;
diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php
index ebbdcd5daf..b8dfd023aa 100644
--- a/bootstrap/helpers/docker.php
+++ b/bootstrap/helpers/docker.php
@@ -604,6 +604,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect
);
+ $labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
@@ -659,6 +660,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled()
);
+ $labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
@@ -671,6 +673,9 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
}
}
+ $labels = $labels->map(function ($value, $key) {
+ return "$key=$value";
+ })->values();
return $labels->all();
}
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index c3d7d0bfc1..d4fce18bd4 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -2045,6 +2045,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
service_name: $serviceName,
image: data_get($service, 'image')
);
+ $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
network: $resource->destination->network,
uuid: $resource->uuid,
@@ -2818,6 +2819,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
is_gzip_enabled: $resource->isGzipEnabled(),
is_stripprefix_enabled: $resource->isStripprefixEnabled(),
);
+ $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels =
fqdnLabelsForCaddy(
network: $resource->destination->network,