Spaces:
Running
on
Zero
Running
on
Zero
| # 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" | |