From 8f8f5878ddd7564e1a30d0686c4b55e12560ded5 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 13 Oct 2023 22:34:46 +0530 Subject: [PATCH 1/4] fix: docker hub URL --- .../views/livewire/project/database/redis/general.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/project/database/redis/general.blade.php b/resources/views/livewire/project/database/redis/general.blade.php index 535ec1807..17f440fbb 100644 --- a/resources/views/livewire/project/database/redis/general.blade.php +++ b/resources/views/livewire/project/database/redis/general.blade.php @@ -10,7 +10,7 @@ + helper="For all available images, check here:

https://hub.docker.com/_/redis" />

Network

From 1c97d47ea0aae2b961961b50d3b1aaf5087fadf7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 13 Oct 2023 21:08:59 +0200 Subject: [PATCH 2/4] fix: turn off static deployment if you switch buildpacks --- app/Http/Livewire/Project/Application/General.php | 4 ++++ config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/Application/General.php b/app/Http/Livewire/Project/Application/General.php index acc377094..dc3bd8db6 100644 --- a/app/Http/Livewire/Project/Application/General.php +++ b/app/Http/Livewire/Project/Application/General.php @@ -77,6 +77,10 @@ class General extends Component ]; public function updatedApplicationBuildPack(){ + if ($this->application->build_pack !== 'nixpacks') { + $this->application->settings->is_static = $this->is_static = false; + $this->application->settings->save(); + } $this->submit(); } public function instantSave() diff --git a/config/sentry.php b/config/sentry.php index 7a6e8e5d2..3e1d76d3f 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.82', + 'release' => '4.0.0-beta.83', // 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 7e5447038..ce833230d 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Fri, 13 Oct 2023 21:39:49 +0200 Subject: [PATCH 3/4] fix: custom dockerfile location for dockerfile buildpack fix: able to use custom port for git cloning --- .../Project/New/GithubPrivateRepositoryDeployKey.php | 4 ++-- app/Jobs/ApplicationDeploymentJob.php | 9 +++++++-- .../2023_03_27_081716_create_applications_table.php | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php index 522eb8845..e8974436a 100644 --- a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php +++ b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php @@ -98,7 +98,6 @@ class GithubPrivateRepositoryDeployKey extends Component 'name' => generate_random_name(), 'git_repository' => $this->git_repository, 'git_branch' => $this->branch, - 'git_full_url' => $this->git_repository, 'build_pack' => 'nixpacks', 'ports_exposes' => $this->port, 'publish_directory' => $this->publish_directory, @@ -112,7 +111,6 @@ class GithubPrivateRepositoryDeployKey extends Component 'name' => generate_random_name(), 'git_repository' => $this->git_repository, 'git_branch' => $this->branch, - 'git_full_url' => "git@$this->git_host:$this->git_repository.git", 'build_pack' => 'nixpacks', 'ports_exposes' => $this->port, 'publish_directory' => $this->publish_directory, @@ -158,6 +156,8 @@ class GithubPrivateRepositoryDeployKey extends Component $this->git_host = $this->repository_url_parsed->getHost(); $this->git_repository = $this->repository_url_parsed->getSegment(1) . '/' . $this->repository_url_parsed->getSegment(2); $this->git_repository = Str::finish("git@$this->git_host:$this->git_repository", '.git'); + } else { + $this->git_repository = $this->repository_url; } $this->git_source = 'other'; } diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index dc1607234..f8197d41d 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -510,8 +510,13 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted } } if ($this->application->deploymentType() === 'deploy_key') { + $port = 22; + preg_match('/(?<=:)\d+(?=\/)/', $this->application->git_repository, $matches); + if (count($matches) === 1) { + $port = $matches[0]; + } $private_key = base64_encode($this->application->private_key->private_key); - $git_clone_command = "GIT_SSH_COMMAND=\"ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" {$git_clone_command} {$this->application->git_full_url} {$this->basedir}"; + $git_clone_command = "GIT_SSH_COMMAND=\"ssh -p $port -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" {$git_clone_command} {$this->application->git_repository} {$this->basedir}"; $git_clone_command = $this->set_git_import_settings($git_clone_command); $commands = collect([ executeInDocker($this->deployment_uuid, "mkdir -p /root/.ssh"), @@ -799,7 +804,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); ); } else { $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "docker build --network host -f {$this->workdir}/Dockerfile {$this->build_args} --progress plain -t $this->production_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->production_image_name {$this->workdir}"), "hidden" => true ]); } } diff --git a/database/migrations/2023_03_27_081716_create_applications_table.php b/database/migrations/2023_03_27_081716_create_applications_table.php index ec91f0737..5e298986f 100644 --- a/database/migrations/2023_03_27_081716_create_applications_table.php +++ b/database/migrations/2023_03_27_081716_create_applications_table.php @@ -23,6 +23,7 @@ return new class extends Migration $table->string('git_repository'); $table->string('git_branch'); $table->string('git_commit_sha')->default('HEAD'); + // TODO: remove this column, it is not used $table->string('git_full_url')->nullable(); $table->string('docker_registry_image_name')->nullable(); From a2008fe9d1dd4d885b261785e5551bc6879d1298 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 13 Oct 2023 21:44:04 +0200 Subject: [PATCH 4/4] typo --- resources/views/livewire/project/application/source.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/project/application/source.blade.php b/resources/views/livewire/project/application/source.blade.php index f600be035..699880321 100644 --- a/resources/views/livewire/project/application/source.blade.php +++ b/resources/views/livewire/project/application/source.blade.php @@ -36,7 +36,7 @@
@isset($application->private_key_id)

Deploy Key

-
Currently attache Private Key: Currently attached Private Key: {{ $application->private_key->name }}