warbler-cda / k8s /simple-deploy.ps1
Bellok's picture
Upload folder using huggingface_hub
0ccf2f0 verified
# 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"