apt-layer/scripts/start-testing.ps1

54 lines
No EOL
2.1 KiB
PowerShell

# apt-layer Testing Environment Startup Script (PowerShell)
# Connects to existing apt-cache server
# Get the directory where this script is located
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ProjectDir = Split-Path -Parent $ScriptDir
$DockerDir = Join-Path $ProjectDir "docker"
Write-Host "=== apt-layer Testing Environment ===" -ForegroundColor Green
Write-Host "Project directory: $ProjectDir" -ForegroundColor Cyan
Write-Host "Docker directory: $DockerDir" -ForegroundColor Cyan
Write-Host ""
# Check if we're connected to the existing apt-cache server
Write-Host "Checking apt-cache server connection..." -ForegroundColor Blue
try {
$response = Invoke-WebRequest -Uri "http://localhost:3142/acng-report.html" -UseBasicParsing -TimeoutSec 5
Write-Host "✓ apt-cache server is running on localhost:3142" -ForegroundColor Green
} catch {
Write-Host "⚠ apt-cache server not found on localhost:3142" -ForegroundColor Yellow
Write-Host " Make sure your particleos-builder apt-cacher-ng is running" -ForegroundColor Yellow
Write-Host " You can start it with: docker start apt-cacher-ng" -ForegroundColor Yellow
$continue = Read-Host "Continue anyway? (y/N)"
if ($continue -ne "y" -and $continue -ne "Y") {
exit 1
}
}
# Change to docker directory
Set-Location $DockerDir
Write-Host "✓ Changed to docker directory" -ForegroundColor Green
Write-Host ""
# Build and start the container
Write-Host "Building and starting apt-layer test container..." -ForegroundColor Blue
docker-compose up --build -d
# Wait for container to be ready
Write-Host ""
Write-Host "Waiting for container to be ready..." -ForegroundColor Yellow
Start-Sleep -Seconds 5
# Show container status
Write-Host ""
Write-Host "Container status:" -ForegroundColor Blue
docker-compose ps
# Attach to the container
Write-Host ""
Write-Host "Attaching to container (use Ctrl+P, Ctrl+Q to detach)..." -ForegroundColor Blue
docker-compose exec apt-layer-test /bin/bash
Write-Host ""
Write-Host "Container stopped. To restart: cd $DockerDir && docker-compose up -d" -ForegroundColor Green