Spaces:
Sleeping
Sleeping
File size: 2,480 Bytes
bab1185 | 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 | #!/bin/bash
# QCrypt RNG Deployment Script
# Automates the deployment of QCrypt RNG to Kubernetes
set -e # Exit on any error
echo "π Starting QCrypt RNG deployment..."
# Check if kubectl is installed
if ! command -v kubectl &> /dev/null; then
echo "β kubectl is not installed. Please install kubectl first."
exit 1
fi
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "β Docker is not installed. Please install Docker first."
exit 1
fi
# Build the Docker image
echo "π³ Building Docker image..."
docker build -t qcrypt-rng:latest .
# Create namespace
echo "π Creating namespace..."
kubectl apply -f k8s/namespace.yaml
# Create secrets
echo "π Creating secrets..."
kubectl apply -f k8s/secrets.yaml
# Deploy PostgreSQL
echo "π Deploying PostgreSQL..."
kubectl apply -f k8s/postgres-pvc.yaml
kubectl apply -f k8s/postgres-deployment.yaml
# Deploy Redis
echo ".Redis Deploying Redis..."
kubectl apply -f k8s/redis-deployment.yaml
# Wait for databases to be ready
echo "β³ Waiting for databases to be ready..."
kubectl wait --for=condition=ready pod -l app=postgres -n qcrypt-rng --timeout=120s
kubectl wait --for=condition=ready pod -l app=redis -n qcrypt-rng --timeout=120s
# Deploy API
echo "π‘ Deploying API..."
kubectl apply -f k8s/api-deployment.yaml
# Deploy Dashboard
echo "π Deploying Dashboard..."
kubectl apply -f k8s/dashboard-deployment.yaml
# Wait for deployments to be ready
echo "β³ Waiting for deployments to be ready..."
kubectl wait --for=condition=ready pod -l app=qcrypt-api -n qcrypt-rng --timeout=180s
kubectl wait --for=condition=ready pod -l app=qcrypt-dashboard -n qcrypt-rng --timeout=180s
# Get external IPs
echo "π Getting service endpoints..."
API_IP=$(kubectl get svc qcrypt-api-service -n qcrypt-rng -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
DASHBOARD_IP=$(kubectl get svc qcrypt-dashboard-service -n qcrypt-rng -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo ""
echo "π QCrypt RNG deployment completed successfully!"
echo ""
echo "π API Endpoint: http://$API_IP"
echo "π Dashboard: http://$DASHBOARD_IP"
echo ""
echo "π Next steps:"
echo " 1. Configure your DNS to point to the external IPs"
echo " 2. Set up SSL certificates for HTTPS"
echo " 3. Configure API keys for production use"
echo " 4. Set up monitoring and alerting"
echo ""
# Show deployment status
echo "π Deployment status:"
kubectl get pods -n qcrypt-rng |