From 52d78413347dc0c7822e16ce65ff07e71ed32a99 Mon Sep 17 00:00:00 2001 From: Koby Wood Date: Sat, 6 Jul 2024 19:33:11 -0400 Subject: [PATCH 1/6] fix: prevent instance fqdn persisting to other servers dynamic proxy configs fixes: 2650 --- app/Models/Server.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Server.php b/app/Models/Server.php index ea487fee7..58bd1c535 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -238,7 +238,7 @@ respond 404 $dynamic_config_path = $this->proxyPath().'/dynamic'; if ($this->proxyType() === 'TRAEFIK_V2') { $file = "$dynamic_config_path/coolify.yaml"; - if (empty($settings->fqdn) || (isCloud() && $this->id !== 0)) { + if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || !$this->isLocalhost()) { instant_remote_process([ "rm -f $file", ], $this); @@ -344,7 +344,7 @@ respond 404 } } elseif ($this->proxyType() === 'CADDY') { $file = "$dynamic_config_path/coolify.caddy"; - if (empty($settings->fqdn) || (isCloud() && $this->id !== 0)) { + if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || !$this->isLocalhost()) { instant_remote_process([ "rm -f $file", ], $this); From f71861300a9c696abe076c61b0e137011f7f94bb Mon Sep 17 00:00:00 2001 From: Tom Ferriere Date: Sun, 7 Jul 2024 10:01:11 +0200 Subject: [PATCH 2/6] fix: gitea pr previews --- app/Models/Application.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Models/Application.php b/app/Models/Application.php index 9c27fc938..7997d671f 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -817,6 +817,14 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); + } elseif ($git_type === 'gitea') { + $branch = "pulls/{$pull_request_id}/head:$pr_branch_name"; + if ($exec_in_docker) { + $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); + } else { + $commands->push("echo 'Checking out $branch'"); + } + $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); } elseif ($git_type === 'bitbucket') { if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); @@ -861,6 +869,14 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); + } elseif ($git_type === 'gitea') { + $branch = "pulls/{$pull_request_id}/head:$pr_branch_name"; + if ($exec_in_docker) { + $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); + } else { + $commands->push("echo 'Checking out $branch'"); + } + $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); } elseif ($git_type === 'bitbucket') { if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); From 2dfe43fc3c405650ce9d2fd50ca949443abf78b6 Mon Sep 17 00:00:00 2001 From: Xiloe Date: Sun, 7 Jul 2024 08:02:36 +0000 Subject: [PATCH 3/6] Fix styling --- app/Models/Application.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Application.php b/app/Models/Application.php index 7997d671f..85e5bb1ba 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -817,7 +817,7 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); - } elseif ($git_type === 'gitea') { + } elseif ($git_type === 'gitea') { $branch = "pulls/{$pull_request_id}/head:$pr_branch_name"; if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); @@ -869,7 +869,7 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); - } elseif ($git_type === 'gitea') { + } elseif ($git_type === 'gitea') { $branch = "pulls/{$pull_request_id}/head:$pr_branch_name"; if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); From 01abc2631684da53645cecdfb7abb29a89a3b6a9 Mon Sep 17 00:00:00 2001 From: Tom Ferriere Date: Sun, 7 Jul 2024 10:40:05 +0200 Subject: [PATCH 4/6] removed redundant if statement --- app/Models/Application.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/app/Models/Application.php b/app/Models/Application.php index 85e5bb1ba..84489ae7b 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -809,7 +809,7 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); - } elseif ($git_type === 'github') { + } elseif ($git_type === 'github' || $git_type === 'gitea') { $branch = "pull/{$pull_request_id}/head:$pr_branch_name"; if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); @@ -817,14 +817,6 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); - } elseif ($git_type === 'gitea') { - $branch = "pulls/{$pull_request_id}/head:$pr_branch_name"; - if ($exec_in_docker) { - $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); - } else { - $commands->push("echo 'Checking out $branch'"); - } - $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); } elseif ($git_type === 'bitbucket') { if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); @@ -861,7 +853,7 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); - } elseif ($git_type === 'github') { + } elseif ($git_type === 'github' || $git_type === 'gitea') { $branch = "pull/{$pull_request_id}/head:$pr_branch_name"; if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); @@ -869,14 +861,6 @@ class Application extends BaseModel $commands->push("echo 'Checking out $branch'"); } $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); - } elseif ($git_type === 'gitea') { - $branch = "pulls/{$pull_request_id}/head:$pr_branch_name"; - if ($exec_in_docker) { - $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); - } else { - $commands->push("echo 'Checking out $branch'"); - } - $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); } elseif ($git_type === 'bitbucket') { if ($exec_in_docker) { $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); From 2c45e7146b15e632306dbb234e1b8ea0c29fa802 Mon Sep 17 00:00:00 2001 From: Alexzvn Date: Thu, 11 Jul 2024 02:56:31 +0000 Subject: [PATCH 5/6] feat: display time interval for rollback images --- .../views/livewire/project/application/rollback.blade.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/views/livewire/project/application/rollback.blade.php b/resources/views/livewire/project/application/rollback.blade.php index 6501155da..2807f2c18 100644 --- a/resources/views/livewire/project/application/rollback.blade.php +++ b/resources/views/livewire/project/application/rollback.blade.php @@ -18,7 +18,12 @@ @endif SHA: {{ data_get($image, 'tag') }} -
{{ data_get($image, 'created_at') }}
+ @php + $date = data_get($image, 'created_at'); + $interval = \Illuminate\Support\Carbon::parse($date); + @endphp +
{{ $interval->diffForHumans() }}
+
{{ $date }}
@if (data_get($image, 'is_current')) From c6658e1ac7c45df0fc0122c608c1aae1d0b5f8e5 Mon Sep 17 00:00:00 2001 From: andrasbacsai Date: Thu, 11 Jul 2024 09:20:09 +0000 Subject: [PATCH 6/6] Fix styling --- app/Models/Server.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Server.php b/app/Models/Server.php index 8224cfaa2..2efc9907b 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -322,7 +322,7 @@ respond 404 $dynamic_config_path = $this->proxyPath().'/dynamic'; if ($this->proxyType() === 'TRAEFIK_V2') { $file = "$dynamic_config_path/coolify.yaml"; - if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || !$this->isLocalhost()) { + if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || ! $this->isLocalhost()) { instant_remote_process([ "rm -f $file", ], $this); @@ -428,7 +428,7 @@ respond 404 } } elseif ($this->proxyType() === 'CADDY') { $file = "$dynamic_config_path/coolify.caddy"; - if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || !$this->isLocalhost()) { + if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || ! $this->isLocalhost()) { instant_remote_process([ "rm -f $file", ], $this);