feat(resources): add cross-server resource migration (dev-only) (#11165)

This commit is contained in:
Andras Bacsai
2026-08-07 23:01:31 +02:00
committed by GitHub
parent d83ba627cd
commit c15e3b35fd
15 changed files with 1354 additions and 7 deletions
+29
View File
@@ -102,6 +102,35 @@ function instant_scp(string $source, string $dest, Server $server, $throwError =
);
}
/**
* Download a remote file from a managed server onto the Coolify host via SCP.
*/
function instant_scp_from_server(string $remoteSource, string $localDest, Server $server, $throwError = true)
{
return SshRetryHandler::retry(
function () use ($remoteSource, $localDest, $server) {
$scp_command = SshMultiplexingHelper::generateScpDownloadCommand($server, $remoteSource, $localDest);
$process = Process::timeout(config('constants.ssh.command_timeout'))->run($scp_command);
$output = trim($process->output());
$exitCode = $process->exitCode();
if ($exitCode !== 0) {
excludeCertainErrors($process->errorOutput(), $exitCode);
}
return $output === 'null' ? null : $output;
},
[
'server' => $server->ip,
'source' => $remoteSource,
'dest' => $localDest,
'function' => 'instant_scp_from_server',
],
$throwError
);
}
function instant_remote_process_with_timeout(Collection|array $command, Server $server, bool $throwError = true, bool $no_sudo = false): ?string
{
$command = $command instanceof Collection ? $command->toArray() : $command;