Spaces:
Running
on
Zero
Running
on
Zero
File size: 2,370 Bytes
0ccf2f0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# Build and deploy script - all in one
Write-Host "π¨ Building Warbler CDA image with full API dependencies..." -ForegroundColor Cyan
$currentDir = Get-Location
$projectDir = $currentDir
# Navigate to project root if in k8s directory
if ($currentDir.Path -match '\\k8s$') {
$projectDir = Split-Path $currentDir -Parent
Set-Location $projectDir
Write-Host " Changed to project directory: $projectDir" -ForegroundColor Gray
}
# Build the image
Write-Host " Building Docker image..." -ForegroundColor Gray
& docker build -t warbler-cda:latest .
if ($LASTEXITCODE -ne 0) {
Write-Host "β Docker build failed!" -ForegroundColor Red
exit 1
}
Write-Host "β
Image built successfully" -ForegroundColor Green
# Deploy to Kubernetes
Set-Location "$currentDir"
Write-Host ""
Write-Host "π Deploying to Kubernetes..." -ForegroundColor Cyan
# Apply manifests
& kubectl apply -f namespace.yaml
& kubectl apply -f configmap.yaml
& kubectl apply -f deployment.yaml
& kubectl apply -f service.yaml
& kubectl apply -f ingress.yaml
Write-Host "β³ Waiting for pod to start..." -ForegroundColor Yellow
Start-Sleep -Seconds 15
# Check status
Write-Host ""
Write-Host "π Status:" -ForegroundColor Cyan
$podStatus = & kubectl get pods -n warbler-cda 2>$null
if ($podStatus) {
Write-Host $podStatus
} else {
Write-Host "β No pods found - check for errors" -ForegroundColor Red
& kubectl get events -n warbler-cda --sort-by=.metadata.creationTimestamp | Select-Object -Last 5
}
# Check if pod is running
$podRunning = & kubectl get pods -n warbler-cda -o jsonpath='{.items[0].status.phase}' 2>$null
if ($podRunning -eq "Running") {
Write-Host ""
Write-Host "π SUCCESS! Your API service is running!" -ForegroundColor Green
Write-Host ""
Write-Host "π Access your application:" -ForegroundColor Cyan
Write-Host " kubectl port-forward svc/warbler-cda-service 8001:80 -n warbler-cda" -ForegroundColor Yellow
Write-Host ""
Write-Host " Then visit: http://localhost:8001/health" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "π Debug commands:" -ForegroundColor Gray
Write-Host " kubectl logs deployment/warbler-cda -n warbler-cda" -ForegroundColor Gray
Write-Host " kubectl describe pod -n warbler-cda" -ForegroundColor Gray
|