Files
infrastructure/event-bus/nats/install.sh
2026-02-09 21:51:46 -08:00

31 lines
800 B
Bash
Executable File

#!/bin/bash
# Install NATS Event Bus
set -e
NAMESPACE="event-bus"
echo "📡 Installing NATS Event Bus..."
# Check prerequisites
command -v kubectl >/dev/null 2>&1 || { echo "❌ kubectl not found"; exit 1; }
# Create namespace
echo "📦 Creating namespace: $NAMESPACE"
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
# Apply deployment
echo "🚀 Deploying NATS..."
kubectl apply -f k8s-deployment.yaml
# Wait for StatefulSet
echo "⏳ Waiting for NATS to be ready..."
kubectl wait --for=condition=ready --timeout=300s pod -l app=nats -n "$NAMESPACE"
echo "✅ NATS Event Bus installed successfully!"
echo ""
echo "📝 Access NATS monitoring:"
echo " kubectl port-forward -n $NAMESPACE svc/nats 8222:8222"
echo " Then visit: http://localhost:8222"