Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

chore: switch up readonly lables to make more sense

peaklabs-dev3d4e8b986735
diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php
index 4df187c198..5265fbb379 100644
--- a/app/Http/Controllers/Api/ApplicationsController.php
+++ b/app/Http/Controllers/Api/ApplicationsController.php
@@ -863,7 +863,7 @@ class ApplicationsController extends Controller
$application->settings->save();
}
$application->refresh();
- if (! $application->settings->is_container_label_readonly_enabled) {
+ if ($application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
}
@@ -964,7 +964,7 @@ class ApplicationsController extends Controller
$application->settings->is_build_server_enabled = $useBuildServer;
$application->settings->save();
}
- if (! $application->settings->is_container_label_readonly_enabled) {
+ if ($application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
}
@@ -1061,7 +1061,7 @@ class ApplicationsController extends Controller
$application->settings->is_build_server_enabled = $useBuildServer;
$application->settings->save();
}
- if (! $application->settings->is_container_label_readonly_enabled) {
+ if ($application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
}
@@ -1150,7 +1150,7 @@ class ApplicationsController extends Controller
$application->settings->is_build_server_enabled = $useBuildServer;
$application->settings->save();
}
- if (! $application->settings->is_container_label_readonly_enabled) {
+ if ($application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
}
@@ -1214,7 +1214,7 @@ class ApplicationsController extends Controller
$application->settings->is_build_server_enabled = $useBuildServer;
$application->settings->save();
}
- if (! $application->settings->is_container_label_readonly_enabled) {
+ if ($application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
}
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index addaf436ae..4308f0f680 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -1683,7 +1683,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$this->application->custom_labels = base64_encode($labels->implode("\n"));
$this->application->save();
} else {
- if (! $this->application->settings->is_container_label_readonly_enabled) {
+ if ($this->application->settings->is_container_label_readonly_enabled) {
$labels = collect(generateLabelsApplication($this->application, $this->preview));
}
}
diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php
index d1cc3476cd..576f878017 100644
--- a/app/Livewire/Project/Application/General.php
+++ b/app/Livewire/Project/Application/General.php
@@ -153,7 +153,7 @@ class General extends Component
$this->is_preserve_repository_enabled = $this->application->settings->is_preserve_repository_enabled;
$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' && ! $this->application->settings->is_container_label_readonly_enabled) {
+ if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE' && $this->application->settings->is_container_label_readonly_enabled === true) {
$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/database/migrations/2025_01_08_154008_switch_up_readonly_labels.php b/database/migrations/2025_01_08_154008_switch_up_readonly_labels.php
new file mode 100644
index 0000000000..aae089d9e5
--- /dev/null
+++ b/database/migrations/2025_01_08_154008_switch_up_readonly_labels.php
@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ DB::table('application_settings')
+ ->update([
+ 'is_container_label_readonly_enabled' => DB::raw('NOT is_container_label_readonly_enabled'),
+ ]);
+
+ Schema::table('application_settings', function (Blueprint $table) {
+ $table->boolean('is_container_label_readonly_enabled')->default(true)->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ DB::table('application_settings')
+ ->update([
+ 'is_container_label_readonly_enabled' => DB::raw('NOT is_container_label_readonly_enabled'),
+ ]);
+
+ Schema::table('application_settings', function (Blueprint $table) {
+ $table->boolean('is_container_label_readonly_enabled')->default(false)->change();
+ });
+ }
+};
diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php
index bdcde8deb1..38fe8dbeb8 100644
--- a/resources/views/livewire/project/application/general.blade.php
+++ b/resources/views/livewire/project/application/general.blade.php
@@ -284,7 +284,7 @@
helper="By default, $ (and other chars) is escaped. So if you write $ in the labels, it will be saved as $$.<br><br>If you want to use env variables inside the labels, turn this off."
id="application.settings.is_container_label_escape_enabled" instantSave></x-forms.checkbox>
<x-forms.checkbox label="Readonly labels"
- helper="If you know what are you doing, you can enable this to edit the labels directly. Coolify won't update labels automatically. <br><br>Be careful, it could break the proxy configuration after you restart the container."
+ helper="Labels are readonly by default. Readonly means that edits you do to the labels could be lost and Coolify will autogenrate the labels for you. If you want to edit the labels directly, disable this option. <br><br>Be careful, it could break the proxy configuration after you restart the container as Coolify will now NOT autogenrate the labels for you (ofc you can alway reset the labels to the coolify defaults manually)."
id="application.settings.is_container_label_readonly_enabled" instantSave></x-forms.checkbox>
</div>
@endif
@@ -315,7 +315,7 @@
helper="By default, $ (and other chars) is escaped. So if you write $ in the labels, it will be saved as $$.<br><br>If you want to use env variables inside the labels, turn this off."
id="application.settings.is_container_label_escape_enabled" instantSave></x-forms.checkbox>
<x-forms.checkbox label="Readonly labels"
- helper="If you know what are you doing, you can enable this to edit the labels directly. Coolify won't update labels automatically. <br><br>Be careful, it could break the proxy configuration after you restart the container."
+ helper="Labels are readonly by default. Readonly means that edits you do to the labels could be lost and Coolify will autogenrate the labels for you. If you want to edit the labels directly, disable this option. <br><br>Be careful, it could break the proxy configuration after you restart the container as Coolify will now NOT autogenrate the labels for you (ofc you can alway reset the labels to the coolify defaults manually)."
id="application.settings.is_container_label_readonly_enabled" instantSave></x-forms.checkbox>
</div>
<x-modal-confirmation title="Confirm Labels Reset to Coolify Defaults?"