Spaces:
Running
on
Zero
Running
on
Zero
File size: 3,168 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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# Windows PowerShell script to deploy directly to Docker Desktop K8s
Write-Host "π§ Deploying Warbler CDA to Docker Desktop Kubernetes (Windows)" -ForegroundColor Green
Write-Host "============================================================" -ForegroundColor Green
Write-Host ""
# Check Docker
try {
& docker info 2>&1 | Out-Null
Write-Host "β
Docker is running" -ForegroundColor Green
} catch {
Write-Host "β Docker is not running. Please start Docker Desktop." -ForegroundColor Red
exit 1
}
# Check kubectl connectivity
try {
& kubectl cluster-info 2>&1 | Out-Null
Write-Host "β
Kubernetes is accessible" -ForegroundColor Green
} catch {
Write-Host "β Cannot connect to Kubernetes cluster." -ForegroundColor Red
Write-Host " Enable Kubernetes in Docker Desktop Settings β Kubernetes" -ForegroundColor Yellow
exit 1
}
# Build Docker image
Write-Host ""
Write-Host "π¨ Building Docker image..." -ForegroundColor Cyan
$currentDir = Get-Location
$projectDir = Split-Path $currentDir -Parent
Write-Host " Building from: $projectDir" -ForegroundColor Gray
Set-Location $projectDir
try {
& docker build -t warbler-cda:latest .
Write-Host "β
Image built successfully" -ForegroundColor Green
} catch {
Write-Host "β Failed to build Docker image" -ForegroundColor Red
exit 1
}
Set-Location $currentDir
# Apply Kubernetes manifests
Write-Host ""
Write-Host "π Deploying to Kubernetes..." -ForegroundColor Cyan
# Create namespace first
Write-Host " Creating namespace..." -ForegroundColor Gray
try {
& kubectl apply -f namespace.yaml
Write-Host " β
Namespace created" -ForegroundColor Green
} catch {
Write-Host " β Failed to create namespace" -ForegroundColor Red
exit 1
}
# Apply configs
Write-Host " Applying ConfigMap..." -ForegroundColor Gray
& kubectl apply -f configmap.yaml
Write-Host " Creating PVC..." -ForegroundColor Gray
& kubectl apply -f pvc.yaml
Write-Host " Deploying application..." -ForegroundColor Gray
& kubectl apply -f deployment.yaml
Write-Host " Creating service..." -ForegroundColor Gray
& kubectl apply -f service.yaml
Write-Host " Creating ingress..." -ForegroundColor Gray
& kubectl apply -f ingress.yaml
# Wait for pod to be ready
Write-Host ""
Write-Host "β³ Waiting for pod to start..." -ForegroundColor Yellow
Start-Sleep -Seconds 10
# Check status
Write-Host ""
Write-Host "π Deployment Status:" -ForegroundColor Cyan
& kubectl get pods -n warbler-cda
Write-Host ""
& kubectl get svc -n warbler-cda
Write-Host ""
Write-Host "π Deployment complete!" -ForegroundColor Green
Write-Host ""
Write-Host "π Access your application:" -ForegroundColor Cyan
Write-Host " Run this in a new terminal:"
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 "π Monitor:"
Write-Host " kubectl logs -f deployment/warbler-cda -n warbler-cda"
|