-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (83 loc) · 3.29 KB
/
Makefile
File metadata and controls
95 lines (83 loc) · 3.29 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Makefile for managing local development environment
# Variables
COSMOS_NS=cosmos-fullnode-testnet
MONIT_HELM_RELEASE=monitoring
MONIT_NS=monitoring
GRAFANA_PORT=3000
PROMETHEUS_PORT=9090
GAIA_IMAGE=ghcr.io/pudimlabs/gaia:v23.0.0-rc2
# Targets
.PHONY: help install deploy-cosmos monit stack-forward check-cosmos delete-cosmos deploy-delete destroy
run: deploy
install: check-reqs deploy stack-forward
help:
@echo " 📜 Available commands:\n"
@echo " 👋 help - Show this help message"
@echo " 🚧 install - Build the project, install deps and deploy!"
@echo " 🔍 check-reqs - Check all prerequisites are installed"
@echo " 🚢 kind-create - Create the kind cluster locally"
@echo " 🔧 deploy - Create the deployment into cluster"
@echo " 🔮 deploy-cosmos - Deploy the Cosmos node"
@echo " 📊 monit - Deploy the monitoring stack"
@echo " 🔄 stack-forward - Forward the monitoring stack to localhost"
@echo " 🌌 check-cosmos - Check the Cosmos node status"
@echo " ❌ delete-cosmos - Delete the Cosmos node"
@echo " ❌ deploy-delete - Delete the deployment"
@echo " 🏁 destroy - Delete the kind cluster and all deployments\n"
@echo " NOTE: The commands can take a while to finish"
check-reqs:
@echo "🔍 Checking prerequisites..."
@if ! [ -x "$$(command -v docker)" ]; then \
echo "🐳 Docker is not installed. Please install Docker before proceeding."; \
exit 1; \
fi
@if ! [ -x "$$(command -v kind)" ]; then \
echo "📦 Kind is not installed. Please install Kind before proceeding."; \
exit 1; \
fi
@if ! [ -x "$$(command -v go)" ]; then \
echo "🐹 Go is not installed. Please install Go before proceeding."; \
exit 1; \
fi
@echo "🚢 Requirements are installed - All prerequisites are met!";
deploy:
@echo "🛠️ Deploying the stack via Kustomize..."
@./scripts/cluster/install.sh all;
deploy-cosmos:
@echo "🔮 Deploying the Cosmos node via Kustomize..."
@./scripts/cluster/install.sh cosmos;
monit:
@echo "🔍 Grafana Stack Monitoring:\n";
@./scripts/cluster/install.sh monitoring;
stack-forward:
@echo "🔍 Forwarding Stack: Grafana and Prometheus...";
@./scripts/tools/svc-port-forward.sh;
check-cosmos:
@echo "🔍 Checking Cosmos Node Status...\n";
@./scripts/tools/node-status.sh;
delete-cosmos:
@echo "❌ Deleting the Cosmos node..."
@kubectl delete ns ${COSMOS_NS};
deploy-delete:
@echo "❌ Deleting the deployment..."
@read -p "❓Are you sure you want to delete the deployment? [y/N] " confirm && \
if [ "$$confirm" = "y" ]; then \
kubectl delete ns ${COSMOS_NS}; \
kubectl delete ns ${MONIT_NS}; \
else \
echo "Operation cancelled."; \
fi
destroy:
@read -p "❓Are you sure you want to delete the kind cluster and all deployments? [y/N] " confirm && \
if [ "$$confirm" = "y" ]; then \
echo "🧹 Cleaning up any existing port forwards..."; \
kill -f "kubectl port-forward.*${GRAFANA_PORT}" 2>/dev/null || true; \
kill -f "kubectl port-forward.*${PROMETHEUS_PORT}" 2>/dev/null || true; \
echo "🧹 Removing Gaia image..."; \
docker image rm ${GAIA_IMAGE} 2>/dev/null || true; \
echo "🧹 Deleting kind cluster..."; \
kind delete cluster --name cosmos-cluster; \
echo "🏁 Kind cluster deleted successfully!"; \
else \
echo "Operation cancelled."; \
fi