forked from Xpd1/LegacyPlayersV4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfull_deploy.sh
More file actions
65 lines (51 loc) · 1.95 KB
/
full_deploy.sh
File metadata and controls
65 lines (51 loc) · 1.95 KB
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
#!/bin/bash
set -e
NAMESPACE="rpll-namespace"
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Install Minikube if not installed
if ! command_exists minikube; then
echo "Installing Minikube..."
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/
fi
# Start Minikube
echo "Starting Minikube..."
minikube start --force
# Set kubectl context to minikube
kubectl config use-context minikube
# Check for required tools
if ! command_exists kompose; then
echo "kompose is not installed. Installing..."
curl -L https://github.com/kubernetes/kompose/releases/download/v1.22.0/kompose-linux-amd64 -o kompose
chmod +x kompose
sudo mv kompose /usr/local/bin/
fi
# Convert Docker-Compose to Kubernetes Manifests
echo "Converting docker-compose.yml to Kubernetes manifests..."
kompose convert -f docker-compose.yml
# Create a Namespace
echo "Creating namespace: $NAMESPACE..."
kubectl create namespace $NAMESPACE || echo "Namespace $NAMESPACE already exists."
# Deploy to Kubernetes
echo "Deploying to Kubernetes..."
kubectl apply -f . -n $NAMESPACE
# Verify Deployment
echo "Verifying deployments..."
kubectl get deployments -n $NAMESPACE
echo "Verifying services..."
kubectl get svc -n $NAMESPACE
# Handle Persistent Storage
PVC_STATUS=$(kubectl get pvc -n $NAMESPACE -o=jsonpath='{.items[*].status.phase}')
if [[ $PVC_STATUS != "Bound" ]]; then
echo "Warning: Some PersistentVolumeClaims are not bound. Please ensure storage is provisioned."
fi
# Adjust Configurations
REVERSE_PROXY_SERVICE=$(kubectl get svc reverse-proxy -n $NAMESPACE -o=jsonpath='{.spec.ports[?(@.port==1234)].targetPort}')
if [[ $REVERSE_PROXY_SERVICE != "80" ]]; then
echo "Warning: reverse-proxy service port mapping might be incorrect. Please check."
fi
echo "Deployment completed! Please review the resources and configurations in the $NAMESPACE namespace."