From 5799e6d8b00ca98ecc13af94894c52ed084359cf Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 4 Sep 2024 14:09:52 +0200 Subject: [PATCH 1/4] fix: logical volumes could be overwritten with new path --- bootstrap/helpers/shared.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index b21ceac31..b34d9f174 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -3092,10 +3092,9 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int $topLevel->get('volumes')->put($name, [ 'name' => $name, ]); - LocalPersistentVolume::updateOrCreate( [ - 'mount_path' => $target, + 'name' => $name, 'resource_id' => $originalResource->id, 'resource_type' => get_class($originalResource), ], @@ -3206,7 +3205,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int } } // convert environment variables to one format - ray($environment); $environment = convertComposeEnvironmentToArray($environment); // Add Coolify defined environments From a3a61dbe55b0f003282e9343cc97d4caede4206a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 4 Sep 2024 14:09:55 +0200 Subject: [PATCH 2/4] refactor: Update Docker Compose location handling in PublicGitRepository --- app/Livewire/Project/New/PublicGitRepository.php | 10 ++++++++++ .../project/new/public-git-repository.blade.php | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Project/New/PublicGitRepository.php b/app/Livewire/Project/New/PublicGitRepository.php index b29fe8cab..b5c5cb1db 100644 --- a/app/Livewire/Project/New/PublicGitRepository.php +++ b/app/Livewire/Project/New/PublicGitRepository.php @@ -99,6 +99,16 @@ public function updatedBaseDirectory() } } + public function updatedDockerComposeLocation() + { + if ($this->docker_compose_location) { + $this->docker_compose_location = rtrim($this->docker_compose_location, '/'); + if (! str($this->docker_compose_location)->startsWith('/')) { + $this->docker_compose_location = '/'.$this->docker_compose_location; + } + } + } + public function updatedBuildPack() { if ($this->build_pack === 'nixpacks') { diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.php index 01cd67575..cef6cffaf 100644 --- a/resources/views/livewire/project/new/public-git-repository.blade.php +++ b/resources/views/livewire/project/new/public-git-repository.blade.php @@ -4,7 +4,7 @@
-
+
@@ -47,7 +47,7 @@ @if ($build_pack === 'dockercompose') - Compose file location in your repository: Date: Wed, 4 Sep 2024 14:10:19 +0200 Subject: [PATCH 3/4] Update version to 4.0.0-beta.329 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index 28fabe940..6d59954e0 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.328', + 'release' => '4.0.0-beta.329', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index f9078cf09..7cbe1f681 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Wed, 4 Sep 2024 14:33:16 +0200 Subject: [PATCH 4/4] fix: env variable in value parsed --- app/Livewire/Project/Service/EditCompose.php | 1 + app/Livewire/Project/Shared/EnvironmentVariable/All.php | 3 ++- app/Livewire/Project/Shared/EnvironmentVariable/Show.php | 2 +- bootstrap/helpers/shared.php | 5 ++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Livewire/Project/Service/EditCompose.php b/app/Livewire/Project/Service/EditCompose.php index 3d0ad4e0b..dc043e65a 100644 --- a/app/Livewire/Project/Service/EditCompose.php +++ b/app/Livewire/Project/Service/EditCompose.php @@ -43,6 +43,7 @@ public function saveEditedCompose() { $this->dispatch('info', 'Saving new docker compose...'); $this->dispatch('saveCompose', $this->service->docker_compose_raw); + $this->dispatch('refreshStorages'); } public function instantSave() diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index 4c79eb3a2..055788b57 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -24,6 +24,7 @@ class All extends Component protected $listeners = [ 'saveKey' => 'submit', + 'refreshEnvs', 'environmentVariableDeleted' => 'refreshEnvs', ]; @@ -61,7 +62,7 @@ public function sortEnvironmentVariables() $sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order'; $sortFunction = function ($variables) use ($sortBy) { - if (!$variables) { + if (! $variables) { return $variables; } if ($sortBy === 'key') { diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php index cbc4314f0..463ceecad 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php @@ -136,4 +136,4 @@ public function delete() return handleError($e); } } -} \ No newline at end of file +} diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index b34d9f174..cc5c13407 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -3331,7 +3331,10 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int foreach ($normalEnvironments as $key => $value) { $key = str($key); $value = str($value); - if ($value->startsWith('$')) { + if ($value->startsWith('$') || $value->contains('${')) { + if ($value->contains('${')) { + $value = $value->after('${')->before('}'); + } $value = str(replaceVariables(str($value))); if ($value->contains(':-')) { $key = $value->before(':');