diff --git a/ps_silverstripe.php b/ps_silverstripe.php index 2bb060f..cd7f315 100644 --- a/ps_silverstripe.php +++ b/ps_silverstripe.php @@ -55,6 +55,30 @@ writeln('Finshed - go test website - if there are issues, rollback using dep sitehost:upgrade-mysql:rollback to swap .env files back'); }); + + +/** + * Sitehost - Open SSH shell to remote server + * https://stackoverflow.com/questions/77532896/starting-remote-ssh-session-from-deployer-inside-docker + */ +task('sitehost:remoteshell', function () { + $host = currentHost(); + + $hostname = $host->getHostname(); + $remoteUser = $host->get('remote_user'); + + if (!$remoteUser) { + throw new \RuntimeException("Remote user not set for host."); + } + + // $sshCommand = "ssh -T $remoteUser@$hostname"; + $sshCommand = "script -q -c \"ssh $remoteUser@$hostname\" /dev/null"; + + runLocally($sshCommand, ['tty' => true]); +}); + + + /** * Sitehost - Roll back to old .env */ @@ -243,6 +267,9 @@ run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build flush=all'); })->desc('Run /dev/build?flush=all'); + + + /** * If deploy to production, then ask to be sure */