From 0964c7a3387bd6790d20456bebaa2f0dd4c8f7e8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 25 Jun 2024 21:22:14 +0200 Subject: [PATCH] remove unnecessary things from application table --- app/Livewire/Project/Application/General.php | 11 +------ app/Models/Application.php | 5 --- ..._06_25_184323_remove_docker_compose_pr.php | 32 +++++++++++++++++++ .../project/application/general.blade.php | 5 --- 4 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 database/migrations/2024_06_25_184323_remove_docker_compose_pr.php diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 38eb4dce8..48be89714 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -40,8 +40,6 @@ class General extends Component public ?string $initialDockerComposeLocation = null; - public ?string $initialDockerComposePrLocation = null; - public ?Collection $parsedServices; public $parsedServiceDomains = []; @@ -72,11 +70,8 @@ class General extends Component 'application.docker_registry_image_tag' => 'nullable', 'application.dockerfile_location' => 'nullable', 'application.docker_compose_location' => 'nullable', - 'application.docker_compose_pr_location' => 'nullable', 'application.docker_compose' => 'nullable', - 'application.docker_compose_pr' => 'nullable', 'application.docker_compose_raw' => 'nullable', - 'application.docker_compose_pr_raw' => 'nullable', 'application.dockerfile_target_build' => 'nullable', 'application.docker_compose_custom_start_command' => 'nullable', 'application.docker_compose_custom_build_command' => 'nullable', @@ -114,11 +109,8 @@ class General extends Component 'application.docker_registry_image_tag' => 'Docker registry image tag', 'application.dockerfile_location' => 'Dockerfile location', 'application.docker_compose_location' => 'Docker compose location', - 'application.docker_compose_pr_location' => 'Docker compose location', 'application.docker_compose' => 'Docker compose', - 'application.docker_compose_pr' => 'Docker compose', 'application.docker_compose_raw' => 'Docker compose raw', - 'application.docker_compose_pr_raw' => 'Docker compose raw', 'application.custom_labels' => 'Custom labels', 'application.dockerfile_target_build' => 'Dockerfile target build', 'application.custom_docker_run_options' => 'Custom docker run commands', @@ -183,7 +175,7 @@ public function loadComposeFile($isInit = false) if ($isInit && $this->application->docker_compose_raw) { return; } - ['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation, 'initialDockerComposePrLocation' => $this->initialDockerComposePrLocation] = $this->application->loadComposeFile($isInit); + ['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation] = $this->application->loadComposeFile($isInit); if (is_null($this->parsedServices)) { $this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.'); @@ -222,7 +214,6 @@ public function loadComposeFile($isInit = false) $this->dispatch('refreshEnvs'); } catch (\Throwable $e) { $this->application->docker_compose_location = $this->initialDockerComposeLocation; - $this->application->docker_compose_pr_location = $this->initialDockerComposePrLocation; $this->application->save(); return handleError($e, $this); diff --git a/app/Models/Application.php b/app/Models/Application.php index 9c27fc938..98b79549f 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -964,11 +964,7 @@ public function loadComposeFile($isInit = false) ['commands' => $cloneCommand] = $this->generateGitImportCommands(deployment_uuid: $uuid, only_checkout: true, exec_in_docker: false, custom_base_dir: '.'); $workdir = rtrim($this->base_directory, '/'); $composeFile = $this->docker_compose_location; - // $prComposeFile = $this->docker_compose_pr_location; $fileList = collect([".$workdir$composeFile"]); - // if ($composeFile !== $prComposeFile) { - // $fileList->push(".$prComposeFile"); - // } $commands = collect([ "rm -rf /tmp/{$uuid}", "mkdir -p /tmp/{$uuid}", @@ -1017,7 +1013,6 @@ public function loadComposeFile($isInit = false) return [ 'parsedServices' => $parsedServices, 'initialDockerComposeLocation' => $this->docker_compose_location, - 'initialDockerComposePrLocation' => $this->docker_compose_pr_location, ]; } diff --git a/database/migrations/2024_06_25_184323_remove_docker_compose_pr.php b/database/migrations/2024_06_25_184323_remove_docker_compose_pr.php new file mode 100644 index 000000000..819a3b3f5 --- /dev/null +++ b/database/migrations/2024_06_25_184323_remove_docker_compose_pr.php @@ -0,0 +1,32 @@ +dropColumn('docker_compose_pr_location'); + $table->dropColumn('docker_compose_pr'); + $table->dropColumn('docker_compose_pr_raw'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('applications', function (Blueprint $table) { + $table->string('docker_compose_pr_location')->nullable()->default('/docker-compose.yaml')->after('docker_compose_location'); + $table->longText('docker_compose_pr')->nullable()->after('docker_compose_location'); + $table->longText('docker_compose_pr_raw')->nullable()->after('docker_compose'); + }); + } +}; diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index c19a9c7e8..42742a863 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -178,9 +178,6 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry" id="application.docker_compose_custom_start_command" helper="If you use this, you need to specify paths relatively and should use the same compose file in the custom command, otherwise the automatically configured labels / etc won't work.

So in your case, use: docker compose -f .{{ Str::start($application->base_directory . $application->docker_compose_location, '/') }} up -d" label="Custom Start Command" /> - {{-- --}} @else @@ -243,8 +240,6 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry" 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 @if ($application->dockerfile)