From 8292961a6ca7e4e272312e4a751bde5bd858c4e5 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 28 Feb 2025 13:41:17 +0100 Subject: [PATCH 1/4] version++ --- config/constants.php | 2 +- other/nightly/docker-compose.prod.yml | 2 +- other/nightly/versions.json | 4 ++-- versions.json | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/constants.php b/config/constants.php index ffd870c7d..e7505de2e 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,7 +2,7 @@ return [ 'coolify' => [ - 'version' => '4.0.0-beta.396', + 'version' => '4.0.0-beta.397', 'helper_version' => '1.0.7', 'realtime_version' => '1.0.6', 'self_hosted' => env('SELF_HOSTED', true), diff --git a/other/nightly/docker-compose.prod.yml b/other/nightly/docker-compose.prod.yml index 2e46438bd..23a65cca6 100644 --- a/other/nightly/docker-compose.prod.yml +++ b/other/nightly/docker-compose.prod.yml @@ -61,7 +61,7 @@ services: retries: 10 timeout: 2s soketi: - image: 'ghcr.io/coollabsio/coolify-realtime:1.0.5' + image: 'ghcr.io/coollabsio/coolify-realtime:1.0.6' ports: - "${SOKETI_PORT:-6001}:6001" - "6002:6002" diff --git a/other/nightly/versions.json b/other/nightly/versions.json index fa0e454d7..8d1c91433 100644 --- a/other/nightly/versions.json +++ b/other/nightly/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.382" + "version": "4.0.0-beta.397" }, "nightly": { - "version": "4.0.0-beta.383" + "version": "4.0.0-beta.398" }, "helper": { "version": "1.0.7" diff --git a/versions.json b/versions.json index eb8e5c923..8d1c91433 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.396" + "version": "4.0.0-beta.397" }, "nightly": { - "version": "4.0.0-beta.397" + "version": "4.0.0-beta.398" }, "helper": { "version": "1.0.7" From 5ac43fd426925c3b877d12312edf7daee3eff1a8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 28 Feb 2025 14:41:54 +0100 Subject: [PATCH 2/4] fix(billing): Handle 'past_due' subscription status in Stripe processing --- app/Jobs/StripeProcessJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/StripeProcessJob.php b/app/Jobs/StripeProcessJob.php index d61c738f4..803029772 100644 --- a/app/Jobs/StripeProcessJob.php +++ b/app/Jobs/StripeProcessJob.php @@ -217,7 +217,7 @@ class StripeProcessJob implements ShouldQueue 'stripe_plan_id' => $planId, 'stripe_cancel_at_period_end' => $cancelAtPeriodEnd, ]); - if ($status === 'paused' || $status === 'incomplete_expired') { + if ($status === 'paused' || $status === 'incomplete_expired' || $status === 'past_due') { if ($subscription->stripe_subscription_id === $subscriptionId) { $subscription->update([ 'stripe_invoice_paid' => false, From a402c28606d639b6f7d284447a3dc5a73182124e Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 28 Feb 2025 20:25:19 +0100 Subject: [PATCH 3/4] fix(revert): label parsing --- bootstrap/helpers/docker.php | 43 +++++-------- bootstrap/helpers/shared.php | 118 ++++++++++++++++------------------- 2 files changed, 69 insertions(+), 92 deletions(-) diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index b8dfd023a..80e19d80f 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -569,7 +569,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview if ($shouldGenerateLabelsExactly) { switch ($application->destination->server->proxyType()) { case ProxyTypes::TRAEFIK->value: - $proxyLabels = fqdnLabelsForTraefik( + $labels = $labels->merge(fqdnLabelsForTraefik( uuid: $appUuid, domains: $domains, onlyPort: $onlyPort, @@ -577,11 +577,10 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(), redirect_direction: $application->redirect - ); - $labels = $labels->merge(convertToKeyValueCollection($proxyLabels)); + )); break; case ProxyTypes::CADDY->value: - $proxyLabels = fqdnLabelsForCaddy( + $labels = $labels->merge(fqdnLabelsForCaddy( network: $application->destination->network, uuid: $appUuid, domains: $domains, @@ -590,12 +589,11 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(), redirect_direction: $application->redirect - ); - $labels = $labels->merge(convertToKeyValueCollection($proxyLabels)); + )); break; } } else { - $proxyLabels = fqdnLabelsForTraefik( + $labels = $labels->merge(fqdnLabelsForTraefik( uuid: $appUuid, domains: $domains, onlyPort: $onlyPort, @@ -603,9 +601,8 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(), redirect_direction: $application->redirect - ); - $labels = $labels->merge(convertToKeyValueCollection($proxyLabels)); - $proxyLabels = fqdnLabelsForCaddy( + )); + $labels = $labels->merge(fqdnLabelsForCaddy( network: $application->destination->network, uuid: $appUuid, domains: $domains, @@ -614,8 +611,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(), redirect_direction: $application->redirect - ); - $labels = $labels->merge(convertToKeyValueCollection($proxyLabels)); + )); } } } else { @@ -628,18 +624,17 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview if ($shouldGenerateLabelsExactly) { switch ($application->destination->server->proxyType()) { case ProxyTypes::TRAEFIK->value: - $proxyLabels = fqdnLabelsForTraefik( + $labels = $labels->merge(fqdnLabelsForTraefik( uuid: $appUuid, domains: $domains, onlyPort: $onlyPort, is_force_https_enabled: $application->isForceHttpsEnabled(), is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled() - ); - $labels = $labels->merge(convertToKeyValueCollection($proxyLabels)); + )); break; case ProxyTypes::CADDY->value: - $proxyLabels = fqdnLabelsForCaddy( + $labels = $labels->merge(fqdnLabelsForCaddy( network: $application->destination->network, uuid: $appUuid, domains: $domains, @@ -647,21 +642,19 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview is_force_https_enabled: $application->isForceHttpsEnabled(), is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled() - ); - $labels = $labels->merge(convertToKeyValueCollection($proxyLabels)); + )); break; } } else { - $proxyLabels = fqdnLabelsForTraefik( + $labels = $labels->merge(fqdnLabelsForTraefik( uuid: $appUuid, domains: $domains, onlyPort: $onlyPort, is_force_https_enabled: $application->isForceHttpsEnabled(), is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled() - ); - $labels = $labels->merge(convertToKeyValueCollection($proxyLabels)); - $proxyLabels = fqdnLabelsForCaddy( + )); + $labels = $labels->merge(fqdnLabelsForCaddy( network: $application->destination->network, uuid: $appUuid, domains: $domains, @@ -669,13 +662,9 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview is_force_https_enabled: $application->isForceHttpsEnabled(), is_gzip_enabled: $application->isGzipEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled() - ); - $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 d4fce18bd..1e9089348 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -1476,7 +1476,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal $serviceNetworks = collect(data_get($service, 'networks', [])); $serviceVariables = collect(data_get($service, 'environment', [])); $serviceLabels = collect(data_get($service, 'labels', [])); - $serviceLabels = convertToKeyValueCollection($serviceLabels); $hasHostNetworkMode = data_get($service, 'network_mode') === 'host' ? true : false; if ($serviceLabels->count() > 0) { $removedLabels = collect([]); @@ -2005,7 +2004,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal if ($shouldGenerateLabelsExactly) { switch ($resource->server->proxyType()) { case ProxyTypes::TRAEFIK->value: - $proxyLabels = fqdnLabelsForTraefik( + $serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik( uuid: $resource->uuid, domains: $fqdns, is_force_https_enabled: true, @@ -2014,12 +2013,10 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal is_stripprefix_enabled: $savedService->isStripprefixEnabled(), service_name: $serviceName, image: data_get($service, 'image') - ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); - + )); break; case ProxyTypes::CADDY->value: - $proxyLabels = fqdnLabelsForCaddy( + $serviceLabels = $serviceLabels->merge(fqdnLabelsForCaddy( network: $resource->destination->network, uuid: $resource->uuid, domains: $fqdns, @@ -2029,13 +2026,11 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal is_stripprefix_enabled: $savedService->isStripprefixEnabled(), service_name: $serviceName, image: data_get($service, 'image') - ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); - + )); break; } } else { - $proxyLabels = fqdnLabelsForTraefik( + $serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik( uuid: $resource->uuid, domains: $fqdns, is_force_https_enabled: true, @@ -2044,9 +2039,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal is_stripprefix_enabled: $savedService->isStripprefixEnabled(), service_name: $serviceName, image: data_get($service, 'image') - ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); - $proxyLabels = fqdnLabelsForCaddy( + )); + $serviceLabels = $serviceLabels->merge(fqdnLabelsForCaddy( network: $resource->destination->network, uuid: $resource->uuid, domains: $fqdns, @@ -2056,8 +2050,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal is_stripprefix_enabled: $savedService->isStripprefixEnabled(), service_name: $serviceName, image: data_get($service, 'image') - ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); + )); } } } @@ -2206,7 +2199,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal $serviceVariables = collect(data_get($service, 'environment', [])); $serviceDependencies = collect(data_get($service, 'depends_on', [])); $serviceLabels = collect(data_get($service, 'labels', [])); - $serviceLabels = convertToKeyValueCollection($serviceLabels); $serviceBuildVariables = collect(data_get($service, 'build.args', [])); $serviceVariables = $serviceVariables->merge($serviceBuildVariables); if ($serviceLabels->count() > 0) { @@ -2780,47 +2772,48 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal if ($shouldGenerateLabelsExactly) { switch ($server->proxyType()) { case ProxyTypes::TRAEFIK->value: - $proxyLabels = fqdnLabelsForTraefik( - uuid: $resource->uuid, - domains: $fqdns, - serviceLabels: $serviceLabels, - generate_unique_uuid: $resource->build_pack === 'dockercompose', - image: data_get($service, 'image'), - is_force_https_enabled: $resource->isForceHttpsEnabled(), - is_gzip_enabled: $resource->isGzipEnabled(), - is_stripprefix_enabled: $resource->isStripprefixEnabled(), + $serviceLabels = $serviceLabels->merge( + fqdnLabelsForTraefik( + uuid: $resource->uuid, + domains: $fqdns, + serviceLabels: $serviceLabels, + generate_unique_uuid: $resource->build_pack === 'dockercompose', + image: data_get($service, 'image'), + is_force_https_enabled: $resource->isForceHttpsEnabled(), + is_gzip_enabled: $resource->isGzipEnabled(), + is_stripprefix_enabled: $resource->isStripprefixEnabled(), + ) ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); - break; case ProxyTypes::CADDY->value: - $proxyLabels = fqdnLabelsForCaddy( - network: $resource->destination->network, - uuid: $resource->uuid, - domains: $fqdns, - serviceLabels: $serviceLabels, - image: data_get($service, 'image'), - is_force_https_enabled: $resource->isForceHttpsEnabled(), - is_gzip_enabled: $resource->isGzipEnabled(), - is_stripprefix_enabled: $resource->isStripprefixEnabled(), + $serviceLabels = $serviceLabels->merge( + fqdnLabelsForCaddy( + network: $resource->destination->network, + uuid: $resource->uuid, + domains: $fqdns, + serviceLabels: $serviceLabels, + image: data_get($service, 'image'), + is_force_https_enabled: $resource->isForceHttpsEnabled(), + is_gzip_enabled: $resource->isGzipEnabled(), + is_stripprefix_enabled: $resource->isStripprefixEnabled(), + ) ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); - break; } } else { - $proxyLabels = fqdnLabelsForTraefik( - uuid: $resource->uuid, - domains: $fqdns, - serviceLabels: $serviceLabels, - generate_unique_uuid: $resource->build_pack === 'dockercompose', - image: data_get($service, 'image'), - is_force_https_enabled: $resource->isForceHttpsEnabled(), - is_gzip_enabled: $resource->isGzipEnabled(), - is_stripprefix_enabled: $resource->isStripprefixEnabled(), + $serviceLabels = $serviceLabels->merge( + fqdnLabelsForTraefik( + uuid: $resource->uuid, + domains: $fqdns, + serviceLabels: $serviceLabels, + generate_unique_uuid: $resource->build_pack === 'dockercompose', + image: data_get($service, 'image'), + is_force_https_enabled: $resource->isForceHttpsEnabled(), + is_gzip_enabled: $resource->isGzipEnabled(), + is_stripprefix_enabled: $resource->isStripprefixEnabled(), + ) ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); - $proxyLabels = + $serviceLabels = $serviceLabels->merge( fqdnLabelsForCaddy( network: $resource->destination->network, uuid: $resource->uuid, @@ -2830,8 +2823,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal is_force_https_enabled: $resource->isForceHttpsEnabled(), is_gzip_enabled: $resource->isGzipEnabled(), is_stripprefix_enabled: $resource->isStripprefixEnabled(), - ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); + ) + ); } } } @@ -2846,7 +2839,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal pull_request_id: $pull_request_id, type: 'application' ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($defaultLabels)); + $serviceLabels = $serviceLabels->merge($defaultLabels); if ($server->isLogDrainEnabled()) { if ($resource instanceof Application && $resource->isLogDrainEnabled()) { @@ -3186,7 +3179,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int $use_network_mode = data_get($service, 'network_mode') !== null; $depends_on = collect(data_get($service, 'depends_on', [])); $labels = collect(data_get($service, 'labels', [])); - $labels = convertToKeyValueCollection($labels); $environment = collect(data_get($service, 'environment', [])); $ports = collect(data_get($service, 'ports', [])); $buildArgs = collect(data_get($service, 'build.args', [])); @@ -3699,7 +3691,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int return $value; }); } - $serviceLabels = $labels->merge(convertToKeyValueCollection($defaultLabels)); + $serviceLabels = $labels->merge($defaultLabels); if ($serviceLabels->count() > 0) { if ($isApplication) { $isContainerLabelEscapeEnabled = data_get($resource, 'settings.is_container_label_escape_enabled'); @@ -3731,7 +3723,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int if ($shouldGenerateLabelsExactly) { switch ($server->proxyType()) { case ProxyTypes::TRAEFIK->value: - $proxyLabels = fqdnLabelsForTraefik( + $serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik( uuid: $uuid, domains: $fqdns, is_force_https_enabled: true, @@ -3740,11 +3732,10 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int is_stripprefix_enabled: $originalResource->isStripprefixEnabled(), service_name: $serviceName, image: $image - ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); + )); break; case ProxyTypes::CADDY->value: - $proxyLabels = fqdnLabelsForCaddy( + $serviceLabels = $serviceLabels->merge(fqdnLabelsForCaddy( network: $network, uuid: $uuid, domains: $fqdns, @@ -3755,13 +3746,11 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int service_name: $serviceName, image: $image, predefinedPort: $predefinedPort - ); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); - + )); break; } } else { - $proxyLabels = fqdnLabelsForTraefik( + $serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik( uuid: $uuid, domains: $fqdns, is_force_https_enabled: true, @@ -3770,8 +3759,8 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int is_stripprefix_enabled: $originalResource->isStripprefixEnabled(), service_name: $serviceName, image: $image - ); - $proxyLabels = $proxyLabels->merge(fqdnLabelsForCaddy( + )); + $serviceLabels = $serviceLabels->merge(fqdnLabelsForCaddy( network: $network, uuid: $uuid, domains: $fqdns, @@ -3783,7 +3772,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int image: $image, predefinedPort: $predefinedPort )); - $serviceLabels = $serviceLabels->merge(convertToKeyValueCollection($proxyLabels)); } } if ($isService) { From f1b98f5ce9f22d24159fbefbac7089ede46e9444 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 28 Feb 2025 20:28:35 +0100 Subject: [PATCH 4/4] fix(helpers): Initialize command variable in parseCommandFromMagicEnvVariable --- bootstrap/helpers/shared.php | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 1e9089348..17ddcbda0 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -748,6 +748,7 @@ function parseCommandFromMagicEnvVariable(Str|string $key): Stringable { $value = str($key); $count = substr_count($value->value(), '_'); + $command = null; if ($count === 2) { if ($value->startsWith('SERVICE_FQDN') || $value->startsWith('SERVICE_URL')) { // SERVICE_FQDN_UMAMI