From e4854aaa1bcd424ceea99458b8e2855803f5b57e Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 14:41:04 +0200 Subject: [PATCH] Refactor muxFilename method to use UUID instead of IP, port, and user --- app/Models/Server.php | 2 +- bootstrap/helpers/remoteProcess.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Models/Server.php b/app/Models/Server.php index 3a1c0eabe..c72c7cc95 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -880,7 +880,7 @@ $schema://$host { public function muxFilename() { - return "{$this->ip}_{$this->port}_{$this->user}"; + return $this->uuid; } public function team() diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index cccc41e71..3f5cdfae2 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -146,7 +146,7 @@ function generateSshCommand(Server $server, string $command) $ssh_command = "timeout $timeout ssh "; if (config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false) { - $ssh_command .= "-o ControlMaster=auto -o ControlPersist={$muxPersistTime} -o ControlPath=/var/www/html/storage/app/ssh/mux/%h_%p_%r "; + $ssh_command .= "-o ControlMaster=auto -o ControlPersist={$muxPersistTime} -o ControlPath=/var/www/html/storage/app/ssh/mux/{$server->muxFilename()} "; } if (data_get($server, 'settings.is_cloudflare_tunnel')) { $ssh_command .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" '; @@ -167,7 +167,6 @@ function generateSshCommand(Server $server, string $command) .$command.PHP_EOL .$delimiter; - // ray($ssh_command); return $ssh_command; } function instant_remote_process(Collection|array $command, Server $server, bool $throwError = true, bool $no_sudo = false): ?string