From 548c4a4c642277d11c66d6a701256be7e245a8e0 Mon Sep 17 00:00:00 2001 From: Pjort Date: Mon, 15 Jul 2024 17:47:35 +0200 Subject: [PATCH 1/7] Update supabase.yaml Fixes problem related to emails sent for invite and forgotten password, that then doesn't actually use the external URL instead uses the hardcoded: http://supabase-kong:8000 --- templates/compose/supabase.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/compose/supabase.yaml b/templates/compose/supabase.yaml index 14a8e36a0d..8ae617d9cc 100644 --- a/templates/compose/supabase.yaml +++ b/templates/compose/supabase.yaml @@ -301,7 +301,7 @@ services: - DEFAULT_ORGANIZATION_NAME=${STUDIO_DEFAULT_ORGANIZATION:-Default Organization} - DEFAULT_PROJECT_NAME=${STUDIO_DEFAULT_PROJECT:-Default Project} - - SUPABASE_URL=http://supabase-kong:8000 + - SUPABASE_URL=${SERVICE_FQDN_SUPABASEKONG:-http://supabase-kong:8000} - SUPABASE_PUBLIC_URL=${SERVICE_FQDN_SUPABASEKONG} - SUPABASE_ANON_KEY=${SERVICE_SUPABASEANON_KEY} - SUPABASE_SERVICE_KEY=${SERVICE_SUPABASESERVICE_KEY} @@ -1182,7 +1182,7 @@ services: retries: 3 environment: - JWT_SECRET=${SERVICE_PASSWORD_JWT} - - SUPABASE_URL=http://supabase-kong:8000 + - SUPABASE_URL=${SERVICE_FQDN_SUPABASEKONG:-http://supabase-kong:8000} - SUPABASE_ANON_KEY=${SERVICE_SUPABASEANON_KEY} - SUPABASE_SERVICE_ROLE_KEY=${SERVICE_SUPABASESERVICE_KEY} - SUPABASE_DB_URL=postgresql://postgres:${SERVICE_PASSWORD_POSTGRES}@${POSTGRES_HOSTNAME:-supabase-db}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-postgres} From 804c70b57529a7fa55771d9fba458008b22c8ea1 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 17 Jul 2024 07:58:45 +0200 Subject: [PATCH 2/7] chore: Update version to 4.0.0-beta.315 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index c4301f2b1c..33c7a4795e 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.314', + 'release' => '4.0.0-beta.315', // 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 ccda21c323..76a71a7164 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Wed, 17 Jul 2024 07:59:06 +0200 Subject: [PATCH 3/7] revert: pull policy --- app/Actions/Service/StartService.php | 2 +- app/Actions/Shared/PullImage.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Actions/Service/StartService.php b/app/Actions/Service/StartService.php index b33a52748b..4b6a25dcc6 100644 --- a/app/Actions/Service/StartService.php +++ b/app/Actions/Service/StartService.php @@ -20,7 +20,7 @@ public function handle(Service $service) $commands[] = "docker network inspect $service->uuid >/dev/null 2>&1 || docker network create --attachable $service->uuid"; $commands[] = 'echo Starting service.'; $commands[] = "echo 'Pulling images.'"; - $commands[] = 'docker compose pull --policy always'; + $commands[] = 'docker compose pull'; $commands[] = "echo 'Starting containers.'"; $commands[] = 'docker compose up -d --remove-orphans --force-recreate --build'; $commands[] = "docker network connect $service->uuid coolify-proxy >/dev/null 2>&1 || true"; diff --git a/app/Actions/Shared/PullImage.php b/app/Actions/Shared/PullImage.php index d8d81d23bb..4bd1cf4530 100644 --- a/app/Actions/Shared/PullImage.php +++ b/app/Actions/Shared/PullImage.php @@ -15,7 +15,7 @@ public function handle(Service $resource) $commands[] = 'cd '.$resource->workdir(); $commands[] = "echo 'Saved configuration files to {$resource->workdir()}.'"; - $commands[] = 'docker compose pull --policy always'; + $commands[] = 'docker compose pull'; $server = data_get($resource, 'server'); From 23a1b1925f6d49e9028ca90d03ccf78d6d9d7a1d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 17 Jul 2024 07:59:12 +0200 Subject: [PATCH 4/7] fix: tag deployments --- app/Livewire/Tags/Index.php | 6 +++--- app/Livewire/Tags/Show.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Livewire/Tags/Index.php b/app/Livewire/Tags/Index.php index 91e15835f1..2e3fbd8e04 100644 --- a/app/Livewire/Tags/Index.php +++ b/app/Livewire/Tags/Index.php @@ -2,7 +2,7 @@ namespace App\Livewire\Tags; -use App\Http\Controllers\Api\Deploy; +use App\Http\Controllers\Api\DeployController; use App\Models\Tag; use Illuminate\Support\Collection; use Livewire\Attributes\Url; @@ -51,11 +51,11 @@ public function redeploy_all() { try { $this->applications->each(function ($resource) { - $deploy = new Deploy(); + $deploy = new DeployController(); $deploy->deploy_resource($resource); }); $this->services->each(function ($resource) { - $deploy = new Deploy(); + $deploy = new DeployController(); $deploy->deploy_resource($resource); }); $this->dispatch('success', 'Mass deployment started.'); diff --git a/app/Livewire/Tags/Show.php b/app/Livewire/Tags/Show.php index f4ecc67a00..ccd190c16f 100644 --- a/app/Livewire/Tags/Show.php +++ b/app/Livewire/Tags/Show.php @@ -2,7 +2,7 @@ namespace App\Livewire\Tags; -use App\Http\Controllers\Api\Deploy; +use App\Http\Controllers\Api\DeployController; use App\Models\ApplicationDeploymentQueue; use App\Models\Tag; use Livewire\Component; @@ -59,11 +59,11 @@ public function redeploy_all() try { $message = collect([]); $this->applications->each(function ($resource) use ($message) { - $deploy = new Deploy(); + $deploy = new DeployController(); $message->push($deploy->deploy_resource($resource)); }); $this->services->each(function ($resource) use ($message) { - $deploy = new Deploy(); + $deploy = new DeployController(); $message->push($deploy->deploy_resource($resource)); }); $this->dispatch('success', 'Mass deployment started.'); From 19cfe4e51455d1097ca56824ab14968fe79cf4a3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 17 Jul 2024 08:09:33 +0200 Subject: [PATCH 5/7] fix: new docker compose parsing --- bootstrap/helpers/shared.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 4480c65f45..e3c8d5218d 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -1688,7 +1688,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal $read_only = data_get($volume, 'read_only'); if ($source && $target) { $uuid = $resource->uuid; - if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) { + if ((str($source)->startsWith('.') || str($source)->startsWith('~') || str($source)->startsWith('/'))) { $dir = base_configuration_dir().'/applications/'.$resource->uuid; if (str($source, '.')) { $source = str($source)->replaceFirst('.', $dir); @@ -1696,11 +1696,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal if (str($source, '~')) { $source = str($source)->replaceFirst('~', $dir); } - if ($pull_request_id === 0) { - $source = $uuid."-$source"; - } else { - $source = $uuid."-$source-pr-$pull_request_id"; - } if ($read_only) { data_set($volume, 'source', $source.':'.$target.':ro'); } else { From 85e1cbad53e628f34c0f0e3f064e20778671bf2b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 17 Jul 2024 09:17:02 +0200 Subject: [PATCH 6/7] chore: Update version to 4.0.0-beta.316 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index 33c7a4795e..f65c897609 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.315', + 'release' => '4.0.0-beta.316', // 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 76a71a7164..8821278c1d 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Wed, 17 Jul 2024 14:52:40 +0200 Subject: [PATCH 7/7] feat: add readonly labels --- .../Api/ApplicationsController.php | 36 ++++++++++++------- app/Jobs/ApplicationDeploymentJob.php | 4 ++- app/Livewire/Project/Application/General.php | 9 +++-- app/Models/Service.php | 1 + ...23828_add_is_container_labels_readonly.php | 28 +++++++++++++++ .../project/application/general.blade.php | 8 ++++- .../project/service/edit-compose.blade.php | 11 +++--- 7 files changed, 76 insertions(+), 21 deletions(-) create mode 100644 database/migrations/2024_07_17_123828_add_is_container_labels_readonly.php diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php index d8175ffe90..bb8c440500 100644 --- a/app/Http/Controllers/Api/ApplicationsController.php +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -732,8 +732,10 @@ private function create_application(Request $request, $type) $application->environment_id = $environment->id; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -826,8 +828,10 @@ private function create_application(Request $request, $type) $application->source_id = $githubApp->id; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -916,8 +920,10 @@ private function create_application(Request $request, $type) $application->environment_id = $environment->id; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -996,8 +1002,10 @@ private function create_application(Request $request, $type) $application->git_branch = 'main'; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -1052,8 +1060,10 @@ private function create_application(Request $request, $type) $application->git_branch = 'main'; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -1494,8 +1504,10 @@ public function update_by_uuid(Request $request) $fqdn = str($fqdn)->replaceEnd(',', '')->trim(); $fqdn = str($fqdn)->replaceStart(',', '')->trim(); $application->fqdn = $fqdn; - $customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->custom_labels = base64_encode($customLabels); + if (! $application->settings->is_container_label_readonly_enabled) { + $customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->custom_labels = base64_encode($customLabels); + } $request->offsetUnset('domains'); } diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index ac48945f5f..ba9eb005e4 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1523,7 +1523,9 @@ private function generate_compose_file() $this->application->custom_labels = base64_encode($labels->implode("\n")); $this->application->save(); } else { - $labels = collect(generateLabelsApplication($this->application, $this->preview)); + if (! $this->application->settings->is_container_label_readonly_enabled) { + $labels = collect(generateLabelsApplication($this->application, $this->preview)); + } } if ($this->pull_request_id !== 0) { $labels = collect(generateLabelsApplication($this->application, $this->preview)); diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 91828d42c7..ac603f331c 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -84,6 +84,7 @@ class General extends Component 'application.settings.is_static' => 'boolean|required', 'application.settings.is_build_server_enabled' => 'boolean|required', 'application.settings.is_container_label_escape_enabled' => 'boolean|required', + 'application.settings.is_container_label_readonly_enabled' => 'boolean|required', 'application.watch_paths' => 'nullable', 'application.redirect' => 'string|required', ]; @@ -119,6 +120,7 @@ class General extends Component 'application.settings.is_static' => 'Is static', 'application.settings.is_build_server_enabled' => 'Is build server enabled', 'application.settings.is_container_label_escape_enabled' => 'Is container label escape enabled', + 'application.settings.is_container_label_readonly_enabled' => 'Is container label readonly', 'application.watch_paths' => 'Watch paths', 'application.redirect' => 'Redirect', ]; @@ -143,7 +145,7 @@ public function mount() $this->ports_exposes = $this->application->ports_exposes; $this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled; $this->customLabels = $this->application->parseContainerLabels(); - if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') { + if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE' && ! $this->application->settings->is_container_label_readonly_enabled) { $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n"); $this->application->custom_labels = base64_encode($this->customLabels); $this->application->save(); @@ -290,6 +292,9 @@ public function getWildcardDomain() public function resetDefaultLabels() { + if ($this->application->settings->is_container_label_readonly_enabled) { + return; + } $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n"); $this->ports_exposes = $this->application->ports_exposes; $this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled; @@ -350,7 +355,7 @@ public function submit($showToaster = true) $this->checkFqdns(); $this->application->save(); - if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') { + if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE' && ! $this->application->settings->is_container_label_readonly_enabled) { $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n"); $this->application->custom_labels = base64_encode($this->customLabels); $this->application->save(); diff --git a/app/Models/Service.php b/app/Models/Service.php index 2fc0778e6f..8336b90c83 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -24,6 +24,7 @@ 'destination_id' => ['type' => 'integer', 'description' => 'The unique identifier of the destination where the service is running.'], 'connect_to_docker_network' => ['type' => 'boolean', 'description' => 'The flag to connect the service to the predefined Docker network.'], 'is_container_label_escape_enabled' => ['type' => 'boolean', 'description' => 'The flag to enable the container label escape.'], + 'is_container_label_readonly_enabled' => ['type' => 'boolean', 'description' => 'The flag to enable the container label readonly.'], 'config_hash' => ['type' => 'string', 'description' => 'The hash of the service configuration.'], 'service_type' => ['type' => 'string', 'description' => 'The type of the service.'], 'created_at' => ['type' => 'string', 'description' => 'The date and time when the service was created.'], diff --git a/database/migrations/2024_07_17_123828_add_is_container_labels_readonly.php b/database/migrations/2024_07_17_123828_add_is_container_labels_readonly.php new file mode 100644 index 0000000000..eb36946a48 --- /dev/null +++ b/database/migrations/2024_07_17_123828_add_is_container_labels_readonly.php @@ -0,0 +1,28 @@ +boolean('is_container_label_readonly_enabled')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('application_settings', function (Blueprint $table) { + $table->dropColumn('is_container_label_readonly_enabled'); + }); + } +}; diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 42742a863f..86c23a1d51 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -239,6 +239,9 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry" + @endif @@ -264,10 +267,13 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry" -
+
+
diff --git a/resources/views/livewire/project/service/edit-compose.blade.php b/resources/views/livewire/project/service/edit-compose.blade.php index 2632fc0eab..3b1e1a3bc6 100644 --- a/resources/views/livewire/project/service/edit-compose.blade.php +++ b/resources/views/livewire/project/service/edit-compose.blade.php @@ -3,11 +3,7 @@ prevent name collision.
To see the actual volume names, check the Deployable Compose file, or go to Storage menu.
-
- -
+
@@ -17,6 +13,11 @@
+
+ +