From 6a35faaa52798c2e4d3fd9273312413bcefeb8a7 Mon Sep 17 00:00:00 2001 From: Brad Tipper Date: Thu, 23 Nov 2023 09:34:13 +1300 Subject: [PATCH 1/2] Adding WIP config --- ps_silverstripe.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ps_silverstripe.php b/ps_silverstripe.php index 2bb060f..a5d7c53 100644 --- a/ps_silverstripe.php +++ b/ps_silverstripe.php @@ -55,6 +55,28 @@ 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 -T $remoteUser@$hostname"; + runLocally($sshCommand, ['tty' => true]); +}); + + + /** * Sitehost - Roll back to old .env */ @@ -243,6 +265,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 */ From 34f0c82aa82f3ecd322d62d7bda6f62d8157a1c8 Mon Sep 17 00:00:00 2001 From: Brad Tipper Date: Mon, 4 Dec 2023 09:54:35 +1300 Subject: [PATCH 2/2] Trial another fix --- ps_silverstripe.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ps_silverstripe.php b/ps_silverstripe.php index a5d7c53..cd7f315 100644 --- a/ps_silverstripe.php +++ b/ps_silverstripe.php @@ -71,7 +71,9 @@ throw new \RuntimeException("Remote user not set for host."); } - $sshCommand = "ssh -t -T $remoteUser@$hostname"; + // $sshCommand = "ssh -T $remoteUser@$hostname"; + $sshCommand = "script -q -c \"ssh $remoteUser@$hostname\" /dev/null"; + runLocally($sshCommand, ['tty' => true]); });