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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: new dev volumes and service files fix: new parser version (4) that will fix data layout (applications goes to /applications, services goes to /services)
Andras Bacsai987b90ead2fb
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex 24565b3898..4b1ac1b11f 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.phpindex 55006745ac..17489040fb 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 BaseModelpublic 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.phpindex d236869baa..8e557d6cb0 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 BaseModelpublic 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.phpindex 9ff05085a9..d226bc1f41 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.phpindex 94669f3a4b..ce9fad1c4c 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)<x-forms.textarea rows="10" readonly id="application.docker_compose_raw"label="Docker Compose Content (raw)" helper="You need to modify the docker compose file."monacoEditorLanguage="yaml" useMonacoEditor />