diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 0dedfd596..b9c60605f 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1077,7 +1077,10 @@ private function generate_env_variables() private function generate_compose_file() { $ports = $this->application->settings->is_static ? [80] : $this->application->ports_exposes_array; - + $onlyPort = null; + if (count($ports) > 0) { + $onlyPort = $ports[0]; + } $persistent_storages = $this->generate_local_persistent_volumes(); $volume_names = $this->generate_local_persistent_volumes_only_volume_names(); $environment_variables = $this->generate_environment_variables($ports); @@ -1088,6 +1091,25 @@ private function generate_compose_file() $labels = $labels->filter(function ($value, $key) { return !Str::startsWith($value, 'coolify.'); }); + $found_caddy_labels = $labels->filter(function ($value, $key) { + return Str::startsWith($value, 'caddy_'); + }); + if ($found_caddy_labels->count() === 0) { + if ($this->pull_request_id !== 0) { + $domains = str(data_get($this->preview, 'fqdn'))->explode(','); + } else { + $domains = str(data_get($this->application, 'fqdn'))->explode(','); + } + $labels = $labels->merge(fqdnLabelsForCaddy( + network: $this->application->destination->network, + uuid: $this->application->uuid, + domains: $domains, + onlyPort: $onlyPort, + is_force_https_enabled: $this->application->isForceHttpsEnabled(), + is_gzip_enabled: $this->application->isGzipEnabled(), + is_stripprefix_enabled: $this->application->isStripprefixEnabled() + )); + } $this->application->custom_labels = base64_encode($labels->implode("\n")); $this->application->save(); } else { diff --git a/resources/views/livewire/server/proxy.blade.php b/resources/views/livewire/server/proxy.blade.php index 7c6599792..ba3909739 100644 --- a/resources/views/livewire/server/proxy.blade.php +++ b/resources/views/livewire/server/proxy.blade.php @@ -13,7 +13,7 @@ Save -
Before switching proxies, please read this.
+
Before switching proxies, please read this.
@if ($server->proxyType() === 'TRAEFIK_V2')
Traefik v2
@elseif ($server->proxyType() === 'CADDY')