Files
vpn-dns-gateway/delivery/bootstrap/start-agent.ps1
T
vsun1 ed0a862657
vpn-dns-gateway/pipeline/pr-main This commit looks good
Move CI runners to Droplet and enable application HTTPS
2026-11-15 12:49:06 -05:00

29 lines
1.7 KiB
PowerShell

param(
[switch]$AllowLaptopFallback,
[string]$Droplet = '147.182.178.136',
[string]$IdentityFile = (Join-Path $env:USERPROFILE '.ssh/digitalocean')
)
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
if (-not $AllowLaptopFallback) {
throw 'The delivery node now runs on The-Ocean. Start a laptop fallback only after stopping the remote copy, then pass -AllowLaptopFallback. Never connect both copies of the same node.'
}
$repoPath = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
$sshArguments = @('-i', $IdentityFile, '-o', 'IdentitiesOnly=yes', '-o', 'BatchMode=yes',
'-o', 'StrictHostKeyChecking=yes', '-o', 'ConnectTimeout=10', "root@$Droplet")
& ssh @sshArguments 'docker exec -u jenkins gitea-jenkins-1 test -f /var/jenkins_home/delivery-bootstrap/configured.json'
& docker volume create ssw590-delivery-identity | Out-Null
# The generated identity flows directly from pinned administrator SSH into a
# protected Docker volume. No secret enters command arguments, output or Git.
& ssh @sshArguments 'docker exec -u jenkins gitea-jenkins-1 cat /var/jenkins_home/delivery-bootstrap/agent-secret' |
& docker run --rm -i --network none --user 0:0 --entrypoint sh `
--mount 'type=volume,source=ssw590-delivery-identity,target=/identity' `
ssw590-delivery-agent:20261114 -c 'set -eu; umask 077; cat > /identity/agent-secret; test -s /identity/agent-secret; chown 1000:1000 /identity /identity/agent-secret; chmod 700 /identity; chmod 400 /identity/agent-secret'
Push-Location $repoPath
try {
& docker compose -f delivery/agent/compose.yaml up -d
& docker compose -f delivery/agent/compose.yaml ps
} finally {
Pop-Location
}