Files
mines/rin/miner/setup-remote-docker-windows.ps1
2025-09-08 08:59:24 +03:00

126 lines
5.0 KiB
PowerShell

# PowerShell Remote Docker Setup for RinHash Miner
# Windows 11 helper script for setting up remote Docker access
Write-Host ""
Write-Host "🐳 Windows 11 Remote Docker Setup" -ForegroundColor Cyan
Write-Host "==================================" -ForegroundColor Cyan
Write-Host ""
# Check Docker Desktop
try {
$dockerVersion = docker --version 2>$null
Write-Host "✅ Docker Desktop found: $dockerVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Error: Docker Desktop is not installed or not in PATH" -ForegroundColor Red
Write-Host ""
Write-Host "Please install Docker Desktop for Windows:" -ForegroundColor Yellow
Write-Host "1. Download from: https://www.docker.com/products/docker-desktop" -ForegroundColor White
Write-Host "2. Enable WSL 2 integration during installation" -ForegroundColor White
Write-Host "3. Restart PowerShell and run this script again" -ForegroundColor White
Read-Host "Press Enter to exit"
exit 1
}
# Check SSH
try {
$sshVersion = ssh -V 2>$null
Write-Host "✅ OpenSSH Client available" -ForegroundColor Green
} catch {
Write-Host "❌ Error: OpenSSH Client is not available" -ForegroundColor Red
Write-Host ""
Write-Host "Please enable OpenSSH Client:" -ForegroundColor Yellow
Write-Host "Settings → Apps → Optional features → Add 'OpenSSH Client'" -ForegroundColor White
Read-Host "Press Enter to exit"
exit 1
}
Write-Host ""
Write-Host "📋 Setup Instructions:" -ForegroundColor Magenta
Write-Host ""
Write-Host "1. On your Linux build machine, run:" -ForegroundColor Yellow
Write-Host " cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner" -ForegroundColor White
Write-Host " ./setup-remote-docker.sh" -ForegroundColor White
Write-Host ""
$linuxIP = Read-Host "2. Enter your Linux build machine IP address"
$userName = Read-Host "3. Enter your Linux username"
Write-Host ""
Write-Host "4. Set up SSH port forwarding:" -ForegroundColor Yellow
Write-Host " In a NEW PowerShell window, run:" -ForegroundColor White
Write-Host " ssh -L localhost:2375:/var/run/docker.sock ${userName}@${linuxIP}" -ForegroundColor Cyan
Write-Host ""
Write-Host "5. In ANOTHER PowerShell window, run these commands:" -ForegroundColor Yellow
Write-Host " # Set Docker to use remote host" -ForegroundColor Gray
Write-Host " `$env:DOCKER_HOST = 'tcp://localhost:2375'" -ForegroundColor Cyan
Write-Host ""
Write-Host " # Test connection" -ForegroundColor Gray
Write-Host " docker ps" -ForegroundColor Cyan
Write-Host ""
Write-Host " # Test RinHash build container" -ForegroundColor Gray
Write-Host " docker run --rm cpuminer-windows-builder echo 'Build container ready!'" -ForegroundColor Cyan
Write-Host ""
Write-Host "6. Build the RinHash miner:" -ForegroundColor Yellow
Write-Host " # Smart build (recommended)" -ForegroundColor Gray
Write-Host " docker run --rm -v `"`${PWD}:/work`" -v `"`${PWD}/build/win:/output`" cpuminer-windows-builder bash -c `"cd /work && ./build-windows-smart.sh`"" -ForegroundColor Cyan
Write-Host ""
Write-Host "📖 For detailed instructions, see:" -ForegroundColor Magenta
Write-Host " REMOTE_DOCKER_README.md" -ForegroundColor White
Write-Host " BUILD_GUIDE.md" -ForegroundColor White
Write-Host ""
Write-Host "🎉 Ready for remote building from Windows 11!" -ForegroundColor Green
Write-Host ""
# Create a helper script for easy connection
$helperScript = @"
# RinHash Remote Docker Helper
# Run this in PowerShell after setting up SSH port forwarding
# Set environment
`$env:DOCKER_HOST = "tcp://localhost:2375"
Write-Host "🔗 Connected to remote Docker daemon" -ForegroundColor Green
Write-Host ""
# Function to build RinHash
function Build-RinHash {
param([string]`$buildType = "smart")
switch (`$buildType) {
"smart" {
docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows-smart.sh"
}
"manual" {
docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows.sh"
}
"clean" {
docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean"
}
}
}
# Export functions
Export-ModuleMember -Function Build-RinHash
Write-Host "Available commands:" -ForegroundColor Yellow
Write-Host " Build-RinHash smart # Smart build (recommended)" -ForegroundColor White
Write-Host " Build-RinHash manual # Manual build" -ForegroundColor White
Write-Host " Build-RinHash clean # Clean build" -ForegroundColor White
"@
$helperScript | Out-File -FilePath "rinhash-remote-helper.ps1" -Encoding UTF8
Write-Host "✅ Created helper script: rinhash-remote-helper.ps1" -ForegroundColor Green
Write-Host ""
Write-Host "To use the helper script:" -ForegroundColor Yellow
Write-Host " . .\rinhash-remote-helper.ps1" -ForegroundColor White
Write-Host " Build-RinHash smart" -ForegroundColor White
Write-Host ""
Read-Host "Press Enter to continue"