From 933e395945d4e15ef4b52ef5c5f92ac074adb6eb Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 12 Apr 2024 23:50:23 +0200 Subject: [PATCH] feat: dynamic mux time --- bootstrap/helpers/remoteProcess.php | 4 +++- config/constants.php | 1 + docker-compose.prod.yml | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index 6365a6e45..67bdb0bf9 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -133,12 +133,14 @@ function generateSshCommand(Server $server, string $command) $timeout = config('constants.ssh.command_timeout'); $connectionTimeout = config('constants.ssh.connection_timeout'); $serverInterval = config('constants.ssh.server_interval'); + $muxPersistTime = config('constants.ssh.mux_persist_time'); $ssh_command = "timeout $timeout ssh "; if (config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false) { - $ssh_command .= '-o ControlMaster=auto -o ControlPersist=1m -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/%h_%p_%r "; } + ray($ssh_command); if (data_get($server, 'settings.is_cloudflare_tunnel')) { $ssh_command .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" '; } diff --git a/config/constants.php b/config/constants.php index 54c451310..091c60996 100644 --- a/config/constants.php +++ b/config/constants.php @@ -5,6 +5,7 @@ return [ 'contact' => 'https://coolify.io/docs/contact', ], 'ssh' => [ + 'mux_persist_time' => env('SSH_MUX_PERSIST_TIME', "1m"), 'connection_timeout' => 10, 'server_interval' => 20, 'command_timeout' => 7200, diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 4e85836d2..3db8178e5 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -47,6 +47,7 @@ services: - PUSHER_APP_SECRET - AUTOUPDATE - SELF_HOSTED + - SSH_MUX_PERSIST_TIME - FEEDBACK_DISCORD_WEBHOOK - WAITLIST - SUBSCRIPTION_PROVIDER