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'); 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/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.'); 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/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 6dabdd76a2..bc005fea97 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -1694,7 +1694,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); @@ -1702,11 +1702,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 { diff --git a/config/sentry.php b/config/sentry.php index c4301f2b1c..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.314', + '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 ccda21c323..8821278c1d 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ 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 @@
+
+ +
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} diff --git a/versions.json b/versions.json index f2051a9d3d..fe6b300226 100644 --- a/versions.json +++ b/versions.json @@ -1,7 +1,7 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.314" + "version": "4.0.0-beta.316" } } }