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.

Add ssh multiplexing

Andras Bacsaie7592949f742
diff --git a/app/Actions/RemoteProcess/RunRemoteProcess.php b/app/Actions/RemoteProcess/RunRemoteProcess.php
index 731eea5333..9b4089970c 100644
--- a/app/Actions/RemoteProcess/RunRemoteProcess.php
+++ b/app/Actions/RemoteProcess/RunRemoteProcess.php
@@ -7,6 +7,7 @@ use App\Enums\ProcessStatus;
use Illuminate\Process\ProcessResult;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Process;
+use Illuminate\Support\Facades\Storage;
use Spatie\Activitylog\Models\Activity;
class RunRemoteProcess
@@ -69,13 +70,15 @@ class RunRemoteProcess
$command = $this->activity->getExtraProperty('command');
$delimiter = 'EOF-COOLIFY-SSH';
+ Storage::disk('local')->makeDirectory('.ssh');
$ssh_command = "ssh "
. "-i {$private_key_location} "
. '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
. '-o PasswordAuthentication=no '
. '-o RequestTTY=no '
- . "-o LogLevel=ERROR "
+ . '-o LogLevel=ERROR '
+ . '-o ControlMaster=auto -o ControlPersist=yes -o ControlPath=/var/www/html/storage/app/.ssh/ssh_mux_%h_%p_%r '
. "-p {$port} "
. "{$user}@{$destination} "
. " 'bash -se' << \\$delimiter" . PHP_EOL
diff --git a/bootstrap/helpers.php b/bootstrap/helpers.php
index 6f9b04cad7..494bb64702 100644
--- a/bootstrap/helpers.php
+++ b/bootstrap/helpers.php
@@ -20,7 +20,7 @@ if (!function_exists('remoteProcess')) {
checkTeam($found_server->team_id);
$temp_file = 'id.rsa_'.'root'.'@'.$found_server->ip;
- Storage::disk('local')->put($temp_file, $found_server->privateKeys->first()->private_key, 'private');
+ Storage::disk('local')->put($temp_file, $found_server->privateKey->private_key, 'private');
$private_key_location = '/var/www/html/storage/app/'.$temp_file;
return resolve(DispatchRemoteProcess::class, [