From c422b4dbcf2a8a93c5dfb5302e1fcc6ef52ad7ae Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 12 Oct 2023 11:36:44 +0200 Subject: [PATCH 1/5] fix: isCloud in production seeder --- config/sentry.php | 2 +- config/version.php | 2 +- database/seeders/ProductionSeeder.php | 2 +- versions.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index dce75c07d..b1e4266f8 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // 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.80', + 'release' => '4.0.0-beta.81', // 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 62840667b..a85ede531 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ get("{$coolify_key_name}"); diff --git a/versions.json b/versions.json index d99553506..0014105e1 100644 --- a/versions.json +++ b/versions.json @@ -4,7 +4,7 @@ "version": "3.12.36" }, "v4": { - "version": "4.0.0-beta.80" + "version": "4.0.0-beta.81" } } } From 83d00bbe3cd487fb2469b4492055356110f30a41 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 12 Oct 2023 11:41:37 +0200 Subject: [PATCH 2/5] fix: make sure to use IP address --- app/Http/Livewire/Server/Form.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.php index d053ca4bd..f773155d5 100644 --- a/app/Http/Livewire/Server/Form.php +++ b/app/Http/Livewire/Server/Form.php @@ -21,7 +21,7 @@ class Form extends Component protected $rules = [ 'server.name' => 'required|min:6', 'server.description' => 'nullable', - 'server.ip' => 'required', + 'server.ip' => 'required|ip', 'server.user' => 'required', 'server.port' => 'required', 'server.settings.is_cloudflare_tunnel' => 'required', @@ -30,11 +30,11 @@ class Form extends Component 'wildcard_domain' => 'nullable|url', ]; protected $validationAttributes = [ - 'server.name' => 'name', - 'server.description' => 'description', - 'server.ip' => 'ip', - 'server.user' => 'user', - 'server.port' => 'port', + 'server.name' => 'Name', + 'server.description' => 'Description', + 'server.ip' => 'IP address', + 'server.user' => 'User', + 'server.port' => 'Port', 'server.settings.is_cloudflare_tunnel' => 'Cloudflare Tunnel', 'server.settings.is_reachable' => 'is reachable', 'server.settings.is_part_of_swarm' => 'is part of swarm' From 1d0ad51fdff87d789e2f59fae308c1690260fa6d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 12 Oct 2023 12:01:09 +0200 Subject: [PATCH 3/5] fix: dockerfile location feature --- app/Jobs/ApplicationDeploymentJob.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 2993a4630..dc1607234 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -142,14 +142,14 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted if ($this->application->dockerfile) { $this->deploy_simple_dockerfile(); } else if ($this->application->build_pack === 'dockerimage') { - $this->deploy_dockerimage(); + $this->deploy_dockerimage_buildpack(); } else if ($this->application->build_pack === 'dockerfile') { - $this->deploy_dockerfile(); + $this->deploy_dockerfile_buildpack(); } else { if ($this->pull_request_id !== 0) { $this->deploy_pull_request(); } else { - $this->deploy(); + $this->deploy_nixpacks_buildpack(); } } if ($this->server->isProxyShouldRun()) { @@ -257,7 +257,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted $this->rolling_update(); } - private function deploy_dockerimage() + private function deploy_dockerimage_buildpack() { $this->dockerImage = $this->application->docker_registry_image_name; $this->dockerImageTag = $this->application->docker_registry_image_tag; @@ -273,7 +273,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted $this->rolling_update(); } - private function deploy_dockerfile() + private function deploy_dockerfile_buildpack() { if (data_get($this->application, 'dockerfile_location')) { $this->dockerfile_location = $this->application->dockerfile_location; @@ -301,7 +301,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted // $this->build_image(); $this->rolling_update(); } - private function deploy() + private function deploy_nixpacks_buildpack() { $this->execute_remote_command( [ @@ -334,9 +334,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted } } $this->cleanup_git(); - if ($this->application->build_pack === 'nixpacks') { - $this->generate_nixpacks_confs(); - } + $this->generate_nixpacks_confs(); $this->generate_compose_file(); $this->generate_build_env_variables(); $this->add_build_env_variables_to_dockerfile(); @@ -763,7 +761,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted if ($this->application->settings->is_static) { $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "docker build --network host -f {$this->workdir}/Dockerfile {$this->build_args} --progress plain -t $this->build_image_name {$this->workdir}"), "hidden" => true + executeInDocker($this->deployment_uuid, "docker build --network host -f {$this->workdir}/{$this->dockerfile_location} {$this->build_args} --progress plain -t $this->build_image_name {$this->workdir}"), "hidden" => true ]); $dockerfile = base64_encode("FROM {$this->application->static_image} @@ -850,7 +848,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); private function add_build_env_variables_to_dockerfile() { $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "cat {$this->workdir}/Dockerfile"), "hidden" => true, "save" => 'dockerfile' + executeInDocker($this->deployment_uuid, "cat {$this->workdir}/{$this->dockerfile_location}"), "hidden" => true, "save" => 'dockerfile' ]); $dockerfile = collect(Str::of($this->saved_outputs->get('dockerfile'))->trim()->explode("\n")); @@ -859,7 +857,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } $dockerfile_base64 = base64_encode($dockerfile->implode("\n")); $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "echo '{$dockerfile_base64}' | base64 -d > {$this->workdir}/Dockerfile"), + executeInDocker($this->deployment_uuid, "echo '{$dockerfile_base64}' | base64 -d > {$this->workdir}/{$this->dockerfile_location}"), "hidden" => true ]); } From 1d733b2282c6bf802408f429e2bbacad1f3813ff Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 12 Oct 2023 12:11:54 +0200 Subject: [PATCH 4/5] seeder --- database/seeders/ProductionSeeder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 248c90f0e..85ff789a1 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -61,6 +61,7 @@ class ProductionSeeder extends Seeder } if (!isCloud()) { + echo "Running in self-hosted mode.\n"; // Save SSH Keys for the Coolify Host $coolify_key_name = "id.root@host.docker.internal"; $coolify_key = Storage::disk('ssh-keys')->get("{$coolify_key_name}"); From 63de5388792fce46548d1a15dd3b6877c798d3bb Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 12 Oct 2023 12:18:26 +0200 Subject: [PATCH 5/5] seeder update --- database/seeders/ProductionSeeder.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 85ff789a1..aaf07bb7a 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -13,8 +13,8 @@ use App\Models\Server; use App\Models\StandaloneDocker; use App\Models\Team; use App\Models\User; -use DB; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Process; use Illuminate\Support\Facades\Storage; @@ -22,6 +22,12 @@ class ProductionSeeder extends Seeder { public function run(): void { + if (isCloud()) { + echo "Running in cloud mode.\n"; + } else { + echo "Running in self-hosted mode.\n"; + } + // Fix for 4.0.0-beta.37 if (User::find(0) !== null && Team::find(0) !== null) { if (DB::table('team_user')->where('user_id', 0)->first() === null) { @@ -61,7 +67,6 @@ class ProductionSeeder extends Seeder } if (!isCloud()) { - echo "Running in self-hosted mode.\n"; // Save SSH Keys for the Coolify Host $coolify_key_name = "id.root@host.docker.internal"; $coolify_key = Storage::disk('ssh-keys')->get("{$coolify_key_name}");