Skip to content

Commit 987b90e

Browse files
committed
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)
1 parent 68f541d commit 987b90e

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

app/Jobs/ApplicationDeploymentJob.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,15 +962,15 @@ private function save_environment_variables()
962962
}
963963
}
964964
if ($this->application->environment_variables->where('key', 'COOLIFY_FQDN')->isEmpty()) {
965-
if ($this->application->compose_parsing_version === '3') {
965+
if ((int) $this->application->compose_parsing_version >= 3) {
966966
$envs->push("COOLIFY_URL={$this->application->fqdn}");
967967
} else {
968968
$envs->push("COOLIFY_FQDN={$this->application->fqdn}");
969969
}
970970
}
971971
if ($this->application->environment_variables->where('key', 'COOLIFY_URL')->isEmpty()) {
972972
$url = str($this->application->fqdn)->replace('http://', '')->replace('https://', '');
973-
if ($this->application->compose_parsing_version === '3') {
973+
if ((int) $this->application->compose_parsing_version >= 3) {
974974
$envs->push("COOLIFY_FQDN={$url}");
975975
} else {
976976
$envs->push("COOLIFY_URL={$url}");

app/Models/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Application extends BaseModel
104104
{
105105
use SoftDeletes;
106106

107-
private static $parserVersion = '3';
107+
private static $parserVersion = '4';
108108

109109
protected $guarded = [];
110110

@@ -1150,7 +1150,7 @@ public function oldRawParser()
11501150

11511151
public function parse(int $pull_request_id = 0, ?int $preview_id = null)
11521152
{
1153-
if ($this->compose_parsing_version === '3') {
1153+
if ((int) $this->compose_parsing_version >= 3) {
11541154
return newParser($this, $pull_request_id, $preview_id);
11551155
} elseif ($this->docker_compose_raw) {
11561156
return parseDockerComposeFile(resource: $this, isNew: false, pull_request_id: $pull_request_id, preview_id: $preview_id);

app/Models/Service.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Service extends BaseModel
4242
{
4343
use HasFactory, SoftDeletes;
4444

45-
private static $parserVersion = '3';
45+
private static $parserVersion = '4';
4646

4747
protected $guarded = [];
4848

@@ -1105,7 +1105,7 @@ public function saveComposeConfigs()
11051105

11061106
public function parse(bool $isNew = false): Collection
11071107
{
1108-
if ($this->compose_parsing_version === '3') {
1108+
if ((int) $this->compose_parsing_version >= 3) {
11091109
return newParser($this);
11101110
} elseif ($this->docker_compose_raw) {
11111111
return parseDockerComposeFile($this, $isNew);

bootstrap/helpers/shared.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3264,7 +3264,15 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
32643264
} elseif ($source->value() === '/tmp' || $source->value() === '/tmp/') {
32653265
$volume = $source->value().':'.$target->value();
32663266
} else {
3267-
$mainDirectory = str(base_configuration_dir().'/applications/'.$uuid);
3267+
if ((int) $resource->compose_parsing_version >= 4) {
3268+
if ($isApplication) {
3269+
$mainDirectory = str(base_configuration_dir().'/applications/'.$uuid);
3270+
} elseif ($isService) {
3271+
$mainDirectory = str(base_configuration_dir().'/services/'.$uuid);
3272+
}
3273+
} else {
3274+
$mainDirectory = str(base_configuration_dir().'/applications/'.$uuid);
3275+
}
32683276
$source = replaceLocalSource($source, $mainDirectory);
32693277
if ($isApplication && $isPullRequest) {
32703278
$source = $source."-pr-$pullRequestId";
@@ -3284,6 +3292,17 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
32843292
'resource_type' => get_class($originalResource),
32853293
]
32863294
);
3295+
if (isDev()) {
3296+
if ((int) $resource->compose_parsing_version >= 4) {
3297+
if ($isApplication) {
3298+
$source = $source->replace($mainDirectory, '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/applications/'.$uuid);
3299+
} elseif ($isService) {
3300+
$source = $source->replace($mainDirectory, '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/services/'.$uuid);
3301+
}
3302+
} else {
3303+
$source = $source->replace($mainDirectory, '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/applications/'.$uuid);
3304+
}
3305+
}
32873306
$volume = "$source:$target";
32883307
}
32893308
} elseif ($type->value() === 'volume') {

resources/views/livewire/project/application/general.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry"
256256
helper="You need to modify the docker compose file." monacoEditorLanguage="yaml"
257257
useMonacoEditor />
258258
@else
259-
@if ($application->compose_parsing_version === '3')
259+
@if ((int) $application->compose_parsing_version >= 3)
260260
<x-forms.textarea rows="10" readonly id="application.docker_compose_raw"
261261
label="Docker Compose Content (raw)" helper="You need to modify the docker compose file."
262262
monacoEditorLanguage="yaml" useMonacoEditor />

0 commit comments

Comments
 (0)