Download deploy/pc-runner/start-pc-runner.ps1 from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/deploy/pc-runner/start-pc-runner.ps1
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/deploy/pc-runner/start-pc-runner.ps1
-
curl -L -o start-pc-runner.ps1 https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/deploy/pc-runner/start-pc-runner.ps1
2.23 kB
| <# | |
| Run the browser runner on this Windows PC (fast, real-time live view) and connect it to the runner VM's HTTPS address | |
| through an SSH tunnel. While it runs, the VM's front door (Caddy) sends Astra's browser work here; when it stops, the VM's | |
| own runner takes over again. Nothing is opened on this PC's network: the tunnel goes out to the VM. | |
| Usage (PowerShell): | |
| .\deploy\pc-runner\start-pc-runner.ps1 -VmHost 129.225.117.95 -KeyFile $HOME\.ssh\oci_patchwise -TokenFile $HOME\.oci\runner_token.txt | |
| Needs: Python 3, Node 22+, `npm ci` and `npx playwright install chromium` in automation\, OpenSSH (built into Windows). | |
| Stop it with Ctrl+C or by closing the window. See docs/REMOTE_RUNNER.md "A PC as the runner". | |
| #> | |
| param( | |
| [Parameter(Mandatory = $true)][string]$VmHost, | |
| [Parameter(Mandatory = $true)][string]$KeyFile, | |
| [Parameter(Mandatory = $true)][string]$TokenFile, | |
| [int]$Port = 8898, | |
| [string]$DataDir = (Join-Path $env:LOCALAPPDATA 'astra-runner') | |
| ) | |
| $ErrorActionPreference = 'Stop' | |
| $repo = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path | |
| $env:RUNNER_TOKEN = (Get-Content -Raw $TokenFile).Trim() | |
| $env:RUNNER_PORT = "$Port" | |
| $env:RUNNER_HOME = $DataDir | |
| $env:AUTOMATION_DIR = Join-Path $repo 'automation' | |
| New-Item -ItemType Directory -Force $DataDir | Out-Null | |
| $server = Join-Path $repo 'automation\remote_runner\server.py' | |
| $runner = Start-Process python -ArgumentList '-I', "`"$server`"" -NoNewWindow -PassThru ` | |
| -RedirectStandardOutput (Join-Path $DataDir 'runner.log') -RedirectStandardError (Join-Path $DataDir 'runner.err') | |
| Write-Host "Runner started on 127.0.0.1:$Port (logs in $DataDir). Connecting the tunnel to $VmHost ..." | |
| try { | |
| while (-not $runner.HasExited) { | |
| # the VM's port $Port leads to this PC's runner while the tunnel is up; reconnect after any drop | |
| & ssh -N -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=accept-new ` | |
| -i $KeyFile -R "${Port}:127.0.0.1:${Port}" "ubuntu@$VmHost" | |
| Write-Host "Tunnel closed; reconnecting in 5 s (Ctrl+C to stop)." | |
| Start-Sleep -Seconds 5 | |
| } | |
| } finally { | |
| if (-not $runner.HasExited) { Stop-Process -Id $runner.Id -Force } | |
| Write-Host 'Runner stopped; the VM runner takes over.' | |
| } | |