mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-12 12:13:41 +00:00
feat(resources): add cross-server resource migration (dev-only) (#11165)
This commit is contained in:
1 parent
d83ba627cd
commit
c15e3b35fd
15 files changed
+1354
-7
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user