From 8b6b1b6a9da37ae98de328318b36fc20cf2a9194 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Thu, 23 Jan 2025 18:51:24 +0100 Subject: [PATCH 01/10] fix(storage): Hetzner storage buckets not working - fix: Hetzner buckets do not work for backups - refactor: removed special handling for Hetzner as it is no longer needed --- app/Jobs/DatabaseBackupJob.php | 7 +------ app/Livewire/Storage/Create.php | 6 ------ app/Models/S3Storage.php | 5 ----- bootstrap/helpers/databases.php | 2 +- bootstrap/helpers/s3.php | 2 +- 5 files changed, 3 insertions(+), 19 deletions(-) diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php index 0861c6bcc..09a187f6a 100644 --- a/app/Jobs/DatabaseBackupJob.php +++ b/app/Jobs/DatabaseBackupJob.php @@ -495,12 +495,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue } else { $commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}"; } - if ($this->s3->isHetzner()) { - $endpointWithoutBucket = 'https://'.str($endpoint)->after('https://')->after('.')->value(); - $commands[] = "docker exec backup-of-{$this->backup->uuid} mc alias set --path=off --api=S3v4 temporary {$endpointWithoutBucket} $key $secret"; - } else { - $commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret"; - } + $commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret"; $commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/"; instant_remote_process($commands, $this->server); diff --git a/app/Livewire/Storage/Create.php b/app/Livewire/Storage/Create.php index c5250e1e3..d0fdbcdf7 100644 --- a/app/Livewire/Storage/Create.php +++ b/app/Livewire/Storage/Create.php @@ -49,12 +49,6 @@ class Create extends Component $this->endpoint = 'https://'.$value; $value = $this->endpoint; } - - if (str($value)->contains('your-objectstorage.com') && ! isset($this->bucket)) { - $this->bucket = str($value)->after('//')->before('.'); - } elseif (str($value)->contains('your-objectstorage.com')) { - $this->bucket = $this->bucket ?: str($value)->after('//')->before('.'); - } } public function submit() diff --git a/app/Models/S3Storage.php b/app/Models/S3Storage.php index f1247e6f7..4b1d745fb 100644 --- a/app/Models/S3Storage.php +++ b/app/Models/S3Storage.php @@ -40,11 +40,6 @@ class S3Storage extends BaseModel return "{$this->endpoint}/{$this->bucket}"; } - public function isHetzner() - { - return str($this->endpoint)->contains('your-objectstorage.com'); - } - public function isDigitalOcean() { return str($this->endpoint)->contains('digitaloceanspaces.com'); diff --git a/bootstrap/helpers/databases.php b/bootstrap/helpers/databases.php index ee65a902f..0e879ad3b 100644 --- a/bootstrap/helpers/databases.php +++ b/bootstrap/helpers/databases.php @@ -208,7 +208,7 @@ function deleteBackupsS3(string|array|null $filenames, S3Storage $s3): void 'bucket' => $s3->bucket, 'endpoint' => $s3->endpoint, 'use_path_style_endpoint' => true, - 'bucket_endpoint' => $s3->isHetzner() || $s3->isDigitalOcean(), + 'bucket_endpoint' => $s3->isDigitalOcean(), 'aws_url' => $s3->awsUrl(), ]); diff --git a/bootstrap/helpers/s3.php b/bootstrap/helpers/s3.php index 2ee7bf44a..10bc66fa1 100644 --- a/bootstrap/helpers/s3.php +++ b/bootstrap/helpers/s3.php @@ -14,7 +14,7 @@ function set_s3_target(S3Storage $s3) 'bucket' => $s3['bucket'], 'endpoint' => $s3['endpoint'], 'use_path_style_endpoint' => true, - 'bucket_endpoint' => $s3->isHetzner() || $s3->isDigitalOcean(), + 'bucket_endpoint' => $s3->isDigitalOcean(), 'aws_url' => $s3->awsUrl(), ]); } From 9184d0bdfebd9711f7d2d3cb16337001e0f8e00b Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Thu, 23 Jan 2025 18:52:11 +0100 Subject: [PATCH 02/10] chore(versions): update coolify versions to v4.0.0-beta.3909 --- config/constants.php | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/constants.php b/config/constants.php index da7bdc65e..739a616ae 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,7 +2,7 @@ return [ 'coolify' => [ - 'version' => '4.0.0-beta.389', + 'version' => '4.0.0-beta.390', 'helper_version' => '1.0.6', 'realtime_version' => '1.0.5', 'self_hosted' => env('SELF_HOSTED', true), diff --git a/versions.json b/versions.json index fa38cf43c..141624819 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.389" + "version": "4.0.0-beta.390" }, "nightly": { - "version": "4.0.0-beta.390" + "version": "4.0.0-beta.391" }, "helper": { "version": "1.0.6" From db8f0de8a3c724e981ee7a64ed5f4d3528a48514 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 24 Jan 2025 11:14:55 +0100 Subject: [PATCH 03/10] fix(ui): update database control UI to check server functionality before displaying actions --- .../project/database/heading.blade.php | 137 +++++++++--------- 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/resources/views/livewire/project/database/heading.blade.php b/resources/views/livewire/project/database/heading.blade.php index 84cc4d065..9d34f7dcf 100644 --- a/resources/views/livewire/project/database/heading.blade.php +++ b/resources/views/livewire/project/database/heading.blade.php @@ -34,72 +34,79 @@ @endif -
- @if (!str($database->status)->startsWith('exited')) - - - - - - - - - Restart - - - - - destination->server->isFunctional()) +
+ @if (!str($database->status)->startsWith('exited')) + + + + + + + + + Restart + + + + + + + + + + + + Stop + + + @else + - @endif - @script - - @endscript -
+ Start + + @endif + @script + + @endscript +
+ @else +
Underlying server is not functional.
+ @endif From 23f803b87912c8359eb0aea637169d5db3b221e4 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:35:01 +0100 Subject: [PATCH 04/10] fix(ui): typo in upgrade message --- resources/views/livewire/upgrade.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/upgrade.blade.php b/resources/views/livewire/upgrade.blade.php index 6e71ebbc0..1187642ea 100644 --- a/resources/views/livewire/upgrade.blade.php +++ b/resources/views/livewire/upgrade.blade.php @@ -116,7 +116,7 @@ }, 5000) } else { this.currentStatus = - "Waiting for Coolify to come back from dead..." + "Waiting for Coolify to come back from the dead..." } }) }, 2000); From 91d90ccb6cb9ef2213970833ec58d0bec49d8039 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 24 Jan 2025 20:02:31 +0100 Subject: [PATCH 05/10] fix(ui): Cloudflare tunnel configuration should be an info, not a warning --- app/Livewire/Server/ConfigureCloudflareTunnels.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Livewire/Server/ConfigureCloudflareTunnels.php b/app/Livewire/Server/ConfigureCloudflareTunnels.php index f58d7b6be..f27614aa4 100644 --- a/app/Livewire/Server/ConfigureCloudflareTunnels.php +++ b/app/Livewire/Server/ConfigureCloudflareTunnels.php @@ -41,7 +41,7 @@ class ConfigureCloudflareTunnels extends Component $server->ip = $this->ssh_domain; $server->save(); $server->settings->save(); - $this->dispatch('warning', 'Cloudflare Tunnels configuration started.'); + $this->dispatch('info', 'Cloudflare Tunnels configuration started.'); } catch (\Throwable $e) { return handleError($e, $this); } From 12c7ee287946458365e3f21fee8801e459c8c901 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sat, 25 Jan 2025 23:40:40 +0100 Subject: [PATCH 06/10] fix(s3): DigitalOcean storage buckets do not work --- app/Models/S3Storage.php | 5 ----- bootstrap/helpers/databases.php | 1 - bootstrap/helpers/s3.php | 3 --- 3 files changed, 9 deletions(-) diff --git a/app/Models/S3Storage.php b/app/Models/S3Storage.php index 4b1d745fb..33f4fa37c 100644 --- a/app/Models/S3Storage.php +++ b/app/Models/S3Storage.php @@ -40,11 +40,6 @@ class S3Storage extends BaseModel return "{$this->endpoint}/{$this->bucket}"; } - public function isDigitalOcean() - { - return str($this->endpoint)->contains('digitaloceanspaces.com'); - } - public function testConnection(bool $shouldSave = false) { try { diff --git a/bootstrap/helpers/databases.php b/bootstrap/helpers/databases.php index 0e879ad3b..f2c069ac4 100644 --- a/bootstrap/helpers/databases.php +++ b/bootstrap/helpers/databases.php @@ -208,7 +208,6 @@ function deleteBackupsS3(string|array|null $filenames, S3Storage $s3): void 'bucket' => $s3->bucket, 'endpoint' => $s3->endpoint, 'use_path_style_endpoint' => true, - 'bucket_endpoint' => $s3->isDigitalOcean(), 'aws_url' => $s3->awsUrl(), ]); diff --git a/bootstrap/helpers/s3.php b/bootstrap/helpers/s3.php index 10bc66fa1..7029377a4 100644 --- a/bootstrap/helpers/s3.php +++ b/bootstrap/helpers/s3.php @@ -4,8 +4,6 @@ use App\Models\S3Storage; function set_s3_target(S3Storage $s3) { - $is_digital_ocean = false; - config()->set('filesystems.disks.custom-s3', [ 'driver' => 's3', 'region' => $s3['region'], @@ -14,7 +12,6 @@ function set_s3_target(S3Storage $s3) 'bucket' => $s3['bucket'], 'endpoint' => $s3['endpoint'], 'use_path_style_endpoint' => true, - 'bucket_endpoint' => $s3->isDigitalOcean(), 'aws_url' => $s3->awsUrl(), ]); } From d5504ea546d8a1dbd211a2e28188874791040bfc Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sat, 25 Jan 2025 23:44:12 +0100 Subject: [PATCH 07/10] refactor(s3): improve S3 bucket endpoint formatting - remove the bucket name from the DigitalOcean endpoint - always add https in front if it is not http or already https --- app/Livewire/Storage/Create.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/Livewire/Storage/Create.php b/app/Livewire/Storage/Create.php index d0fdbcdf7..1d60d6ac5 100644 --- a/app/Livewire/Storage/Create.php +++ b/app/Livewire/Storage/Create.php @@ -3,6 +3,7 @@ namespace App\Livewire\Storage; use App\Models\S3Storage; +use Illuminate\Support\Uri; use Livewire\Component; class Create extends Component @@ -45,9 +46,24 @@ class Create extends Component public function updatedEndpoint($value) { - if (! str($value)->startsWith('https://') && ! str($value)->startsWith('http://')) { - $this->endpoint = 'https://'.$value; - $value = $this->endpoint; + try { + if (empty($value)) { + return; + } + if (str($value)->contains('digitaloceanspaces.com')) { + $uri = Uri::of($value); + $host = $uri->host(); + + if (preg_match('/^(.+)\.([^.]+\.digitaloceanspaces\.com)$/', $host, $matches)) { + $host = $matches[2]; + $value = "https://{$host}"; + } + } + } finally { + if (! str($value)->startsWith('https://') && ! str($value)->startsWith('http://')) { + $value = 'https://'.$value; + } + $this->endpoint = $value; } } From 50750eb9e4529c21a370791c8a6d317d179f9f31 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sun, 26 Jan 2025 18:02:33 +0100 Subject: [PATCH 08/10] fix(ui): correct typo in container label helper text --- .../views/livewire/project/application/general.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 026b3b579..ed1526bdd 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -285,7 +285,7 @@ helper="By default, $ (and other chars) is escaped. So if you write $ in the labels, it will be saved as $$.

If you want to use env variables inside the labels, turn this off." id="application.settings.is_container_label_escape_enabled" instantSave> {{-- --}} @endif @@ -318,7 +318,7 @@ @endif
Date: Mon, 27 Jan 2025 13:52:25 +0100 Subject: [PATCH 09/10] refactor(vite): improve environment variable handling in Vite configuration --- vite.config.js | 66 ++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/vite.config.js b/vite.config.js index 8b3841550..fc739c95d 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,37 +1,41 @@ -import { defineConfig } from "vite"; +import { defineConfig, loadEnv } from "vite"; import laravel from "laravel-vite-plugin"; import vue from "@vitejs/plugin-vue"; -export default defineConfig({ - server: { - watch: { - ignored: [ - "**/dev_*_data/**", - "**/storage/**", - ], - }, - host: "0.0.0.0", - hmr: { - host: process.env.VITE_HOST, - }, - }, - plugins: [ - laravel({ - input: ["resources/css/app.css", "resources/js/app.js"], - refresh: true, - }), - vue({ - template: { - transformAssetUrls: { - base: null, - includeAbsolute: false, - }, +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), '') + + return { + server: { + watch: { + ignored: [ + "**/dev_*_data/**", + "**/storage/**", + ], + }, + host: "0.0.0.0", + hmr: { + host: env.VITE_HOST || '0.0.0.0' }, - }), - ], - resolve: { - alias: { - vue: "vue/dist/vue.esm-bundler.js", }, - }, + plugins: [ + laravel({ + input: ["resources/css/app.css", "resources/js/app.js"], + refresh: true, + }), + vue({ + template: { + transformAssetUrls: { + base: null, + includeAbsolute: false, + }, + }, + }), + ], + resolve: { + alias: { + vue: "vue/dist/vue.esm-bundler.js", + }, + }, + } }); From fddaf9134d823046ecc691ff5c0257d379619307 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 27 Jan 2025 14:05:18 +0100 Subject: [PATCH 10/10] fix: disable certain parts if readonly label is turned off --- app/Livewire/Project/Application/General.php | 3 + .../project/application/general.blade.php | 73 +++++++++++++------ 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index ca57a8e95..08fff38c6 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -187,6 +187,9 @@ class General extends Component }); } } + if ($this->application->settings->is_container_label_readonly_enabled) { + $this->resetDefaultLabels(false); + } } public function loadComposeFile($isInit = false) diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index ed1526bdd..0a981f3a9 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -71,27 +71,50 @@ @endif @if ($application->build_pack !== 'dockercompose')
- - - Generate Domain - + @if ($application->settings->is_container_label_readonly_enabled == false) + + @else + + Generate Domain + + @endif
- - - - - - - -
Set Direction
-
-
+ @if ($application->settings->is_container_label_readonly_enabled == false) + @if ($application->redirect === 'both') + + @elseif ($application->redirect === 'www') + + @elseif ($application->redirect === 'non-www') + + @endif + @else + + + + + + @if ($application->settings->is_container_label_readonly_enabled) + + +
Set Direction
+
+
+ @endif + @endif
@endif @@ -299,9 +322,15 @@ @if ($application->settings->is_static || $application->build_pack === 'static') @else - + @if ($application->settings->is_container_label_readonly_enabled === false) + + @else + + @endif @endif @if (!$application->destination->server->isSwarm())