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.

fix: remove custom port from git repo url

Andras Bacsai2ad7c2b1ce3a
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 2586510352..3091bc339a 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -75,6 +75,8 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
private string $serverUserHomeDir = '/root';
private string $dockerConfigFileExists = 'NOK';
+ private int $customPort = 22;
+
public $tries = 1;
public function __construct(int $application_deployment_queue_id)
{
@@ -167,6 +169,15 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
// Get user home directory
$this->serverUserHomeDir = instant_remote_process(["echo \$HOME"], $this->server);
$this->dockerConfigFileExists = instant_remote_process(["test -f {$this->serverUserHomeDir}/.docker/config.json && echo 'OK' || echo 'NOK'"], $this->server);
+
+ // Check custom port
+ preg_match('/(?<=:)\d+(?=\/)/', $this->application->git_repository, $matches);
+ if (count($matches) === 1) {
+ $this->customPort = $matches[0];
+ $gitHost = str($this->application->git_repository)->before(':');
+ $gitRepo = str($this->application->git_repository)->after('/');
+ $this->application->git_repository = "$gitHost:$gitRepo";
+ }
try {
if ($this->application->dockerfile) {
$this->deploy_simple_dockerfile();
@@ -549,13 +560,8 @@ 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 ConnectTimeout=30 -p $port -o Port=$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 = "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -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"),