diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 24565b389..4b1ac1b11 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -962,7 +962,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue } } if ($this->application->environment_variables->where('key', 'COOLIFY_FQDN')->isEmpty()) { - if ($this->application->compose_parsing_version === '3') { + if ((int) $this->application->compose_parsing_version >= 3) { $envs->push("COOLIFY_URL={$this->application->fqdn}"); } else { $envs->push("COOLIFY_FQDN={$this->application->fqdn}"); @@ -970,7 +970,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue } if ($this->application->environment_variables->where('key', 'COOLIFY_URL')->isEmpty()) { $url = str($this->application->fqdn)->replace('http://', '')->replace('https://', ''); - if ($this->application->compose_parsing_version === '3') { + if ((int) $this->application->compose_parsing_version >= 3) { $envs->push("COOLIFY_FQDN={$url}"); } else { $envs->push("COOLIFY_URL={$url}"); diff --git a/app/Models/Application.php b/app/Models/Application.php index 55006745a..17489040f 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -104,7 +104,7 @@ class Application extends BaseModel { use SoftDeletes; - private static $parserVersion = '3'; + private static $parserVersion = '4'; protected $guarded = []; @@ -1150,7 +1150,7 @@ class Application extends BaseModel public function parse(int $pull_request_id = 0, ?int $preview_id = null) { - if ($this->compose_parsing_version === '3') { + if ((int) $this->compose_parsing_version >= 3) { return newParser($this, $pull_request_id, $preview_id); } elseif ($this->docker_compose_raw) { return parseDockerComposeFile(resource: $this, isNew: false, pull_request_id: $pull_request_id, preview_id: $preview_id); diff --git a/app/Models/Service.php b/app/Models/Service.php index d236869ba..8e557d6cb 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -42,7 +42,7 @@ class Service extends BaseModel { use HasFactory, SoftDeletes; - private static $parserVersion = '3'; + private static $parserVersion = '4'; protected $guarded = []; @@ -1105,7 +1105,7 @@ class Service extends BaseModel public function parse(bool $isNew = false): Collection { - if ($this->compose_parsing_version === '3') { + if ((int) $this->compose_parsing_version >= 3) { return newParser($this); } elseif ($this->docker_compose_raw) { return parseDockerComposeFile($this, $isNew); diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 9ff05085a..d226bc1f4 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -3264,7 +3264,15 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int } elseif ($source->value() === '/tmp' || $source->value() === '/tmp/') { $volume = $source->value().':'.$target->value(); } else { - $mainDirectory = str(base_configuration_dir().'/applications/'.$uuid); + if ((int) $resource->compose_parsing_version >= 4) { + if ($isApplication) { + $mainDirectory = str(base_configuration_dir().'/applications/'.$uuid); + } elseif ($isService) { + $mainDirectory = str(base_configuration_dir().'/services/'.$uuid); + } + } else { + $mainDirectory = str(base_configuration_dir().'/applications/'.$uuid); + } $source = replaceLocalSource($source, $mainDirectory); if ($isApplication && $isPullRequest) { $source = $source."-pr-$pullRequestId"; @@ -3284,6 +3292,17 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int 'resource_type' => get_class($originalResource), ] ); + if (isDev()) { + if ((int) $resource->compose_parsing_version >= 4) { + if ($isApplication) { + $source = $source->replace($mainDirectory, '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/applications/'.$uuid); + } elseif ($isService) { + $source = $source->replace($mainDirectory, '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/services/'.$uuid); + } + } else { + $source = $source->replace($mainDirectory, '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/applications/'.$uuid); + } + } $volume = "$source:$target"; } } elseif ($type->value() === 'volume') { diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 94669f3a4..ce9fad1c4 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -256,7 +256,7 @@ helper="You need to modify the docker compose file." monacoEditorLanguage="yaml" useMonacoEditor /> @else - @if ($application->compose_parsing_version === '3') + @if ((int) $application->compose_parsing_version >= 3)