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: traefik labels

Andras Bacsai404c664500ed
diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php
index 21dfe3e3c1..59f45358e7 100644
--- a/bootstrap/helpers/docker.php
+++ b/bootstrap/helpers/docker.php
@@ -249,6 +249,10 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
// Set labels for http (redirect to https)
$labels->push("traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
$labels->push("traefik.http.routers.{$http_label}.entryPoints=http");
+ $labels->push("traefik.http.routers.{$http_label}.service={$http_label}");
+ if ($port) {
+ $labels->push("traefik.http.services.{$http_label}.loadbalancer.server.port=$port");
+ }
if ($is_force_https_enabled) {
$labels->push("traefik.http.routers.{$http_label}.middlewares=redirect-to-https");
}
@@ -257,8 +261,8 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
$labels->push("traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
$labels->push("traefik.http.routers.{$http_label}.entryPoints=http");
$labels->push("traefik.http.routers.{$http_label}.middlewares=gzip");
+ $labels->push("traefik.http.routers.{$http_label}.service={$http_label}");
if ($port) {
- $labels->push("traefik.http.routers.{$http_label}.service={$http_label}");
$labels->push("traefik.http.services.{$http_label}.loadbalancer.server.port=$port");
}
if ($path !== '/') {
@@ -266,10 +270,9 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
$labels->push("traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}");
}
}
- } catch(\Throwable $e) {
+ } catch (\Throwable $e) {
continue;
}
-
}
return $labels;
@@ -278,7 +281,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
{
$ports = $application->settings->is_static ? [80] : $application->ports_exposes_array;
$onlyPort = null;
- if (count($ports) === 1) {
+ if (count($ports) > 0) {
$onlyPort = $ports[0];
}
$pull_request_id = data_get($preview, 'pull_request_id', 0);