2023-03-20 12:04:22 +00:00
|
|
|
<?php
|
|
|
|
|
2023-03-21 09:56:49 +00:00
|
|
|
use App\Actions\RemoteProcess\DispatchRemoteProcess;
|
2023-03-20 12:04:22 +00:00
|
|
|
use Spatie\Activitylog\Contracts\Activity;
|
|
|
|
|
2023-03-21 09:31:16 +00:00
|
|
|
if (! function_exists('remoteProcess')) {
|
2023-03-20 12:04:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Run a Coolify Process, which SSH's into a machine to run the command(s).
|
|
|
|
*
|
|
|
|
*/
|
2023-03-21 09:31:16 +00:00
|
|
|
function remoteProcess($command, $destination): Activity
|
2023-03-20 12:04:22 +00:00
|
|
|
{
|
2023-03-21 09:56:49 +00:00
|
|
|
return resolve(DispatchRemoteProcess::class, [
|
2023-03-20 12:04:22 +00:00
|
|
|
'destination' => $destination,
|
|
|
|
'command' => $command,
|
2023-03-21 09:31:16 +00:00
|
|
|
])();
|
2023-03-20 12:04:22 +00:00
|
|
|
}
|
|
|
|
}
|