Skip to content

Commit a95ebb4

Browse files
authored
Merge branch 'next' into fix-ssh-multiplexing-docker-desktop-windows
2 parents 4aeb8ff + 75f266f commit a95ebb4

File tree

15 files changed

+209
-346
lines changed

15 files changed

+209
-346
lines changed

.env.development.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ APP_KEY=
66
APP_URL=http://localhost
77
APP_PORT=8000
88
APP_DEBUG=true
9-
MUX_ENABLED=false
9+
SSH_MUX_ENABLED=false
1010

1111
# PostgreSQL Database Configuration
1212
DB_DATABASE=coolify

app/Livewire/Boarding/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function installServer()
282282
public function validateServer()
283283
{
284284
try {
285-
config()->set('coolify.mux_enabled', false);
285+
config()->set('constants.ssh.mux_enabled', false);
286286

287287
// EC2 does not have `uptime` command, lol
288288
instant_remote_process(['ls /'], $this->createdServer, true);

app/Models/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ public function isSwarmWorker()
967967

968968
public function validateConnection()
969969
{
970-
config()->set('coolify.mux_enabled', false);
970+
config()->set('constants.ssh.mux_enabled', false);
971971

972972
$server = Server::find($this->id);
973973
if (! $server) {

app/Models/Service.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ public function extraFields()
667667
}
668668
$data = $data->merge([
669669
'Root User' => [
670-
'key' => 'N/A',
670+
'key' => 'GITLAB_ROOT_USER',
671671
'value' => 'root',
672672
'rules' => 'required',
673673
'isPassword' => true,

bootstrap/helpers/proxy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ function generate_default_proxy_configuration(Server $server)
137137
'external' => true,
138138
];
139139
});
140+
// TODO: This should not be null on new servers, but it is.
141+
ray($proxy_type);
140142
if ($proxy_type === ProxyTypes::TRAEFIK->value) {
141143
$labels = [
142144
'traefik.enable=true',

bootstrap/helpers/remoteProcess.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ function generateSshCommand(Server $server, string $command)
161161

162162
$ssh_command = "timeout $timeout ssh ";
163163

164-
$muxEnabled = config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false;
165-
164+
$muxEnabled = config('constants.ssh.mux_enabled') && config('coolify.is_windows_docker_desktop') == false;
165+
// ray('SSH Multiplexing Enabled:', $muxEnabled)->blue();
166166
if ($muxEnabled) {
167167
// Always use multiplexing when enabled
168168
$muxSocket = "/var/www/html/storage/app/ssh/mux/{$server->muxFilename()}";
@@ -212,7 +212,11 @@ function ensureMultiplexedConnection(Server $server)
212212
}
213213

214214
$muxSocket = "/var/www/html/storage/app/ssh/mux/{$server->muxFilename()}";
215-
$checkCommand = "ssh -O check -o ControlPath=$muxSocket {$server->user}@{$server->ip} 2>/dev/null";
215+
$checkCommand = "ssh -O check -o ControlPath=$muxSocket ";
216+
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
217+
$checkCommand .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" ';
218+
}
219+
$checkCommand .= " {$server->user}@{$server->ip}";
216220

217221
$process = Process::run($checkCommand);
218222

@@ -233,8 +237,12 @@ function ensureMultiplexedConnection(Server $server)
233237
$serverInterval = config('constants.ssh.server_interval');
234238
$muxPersistTime = config('constants.ssh.mux_persist_time');
235239

236-
$establishCommand = "ssh -fNM -o ControlMaster=auto -o ControlPath=$muxSocket -o ControlPersist={$muxPersistTime} "
237-
."-i {$privateKeyLocation} "
240+
$establishCommand = "ssh -fNM -o ControlMaster=auto -o ControlPath=$muxSocket -o ControlPersist={$muxPersistTime} ";
241+
242+
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
243+
$establishCommand .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" ';
244+
}
245+
$establishCommand .= "-i {$privateKeyLocation} "
238246
.'-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
239247
.'-o PasswordAuthentication=no '
240248
."-o ConnectTimeout=$connectionTimeout "
@@ -313,7 +321,7 @@ function instant_remote_process(Collection|array $command, Server $server, bool
313321
$end_time = microtime(true);
314322

315323
$execution_time = ($end_time - $start_time) * 1000; // Convert to milliseconds
316-
// ray('SSH command execution time:', $execution_time.' ms')->orange();
324+
ray('SSH command execution time:', $execution_time.' ms')->orange();
317325

318326
$output = trim($process->output());
319327
$exitCode = $process->exitCode();

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"zircote/swagger-php": "^4.10"
4949
},
5050
"require-dev": {
51-
"itsgoingd/clockwork": "^5.2",
5251
"fakerphp/faker": "^v1.21.0",
5352
"laravel/dusk": "^v8.0",
5453
"laravel/pint": "^1.16",

0 commit comments

Comments
 (0)