-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (60 loc) · 2.26 KB
/
Copy pathMakefile
File metadata and controls
74 lines (60 loc) · 2.26 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
.PHONY: help setup deploy-loki deploy-app deploy-all test-api clean-app clean-loki clean-cluster clean-all
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
setup: ## Create the Kind cluster
./scripts/setup.sh
deploy-loki: ## Deploy Loki stack (Loki + Promtail + Grafana)
./scripts/deploy-loki.sh
deploy-app: ## Build and deploy the sample Go application
./scripts/deploy-app.sh
deploy-all: setup deploy-loki deploy-app ## Setup cluster and deploy everything
test-api: ## Test the API endpoints
@echo "Testing API endpoints..."
@echo ""
@echo "1. Home endpoint:"
@curl -s http://localhost:30080/ | jq '.'
@echo ""
@echo "2. Health endpoint:"
@curl -s http://localhost:30080/health | jq '.'
@echo ""
@echo "3. Users endpoint:"
@curl -s http://localhost:30080/api/users | jq '.'
@echo ""
@echo "4. Data endpoint:"
@curl -s http://localhost:30080/api/data | jq '.'
@echo ""
@echo "5. Random endpoint (generates logs):"
@curl -s http://localhost:30080/api/random | jq '.'
logs: ## Follow application logs
kubectl logs -f deployment/sample-api -n default
status: ## Show cluster and application status
@echo "=== Cluster Info ==="
@kubectl cluster-info
@echo ""
@echo "=== Nodes ==="
@kubectl get nodes
@echo ""
@echo "=== Pods ==="
@kubectl get pods -A
@echo ""
@echo "=== Services ==="
@kubectl get svc -A
clean-app: ## Delete the sample application
kubectl delete -f k8s/app/ || true
clean-loki: ## Uninstall Loki stack
helm uninstall loki-stack -n default || true
clean-cluster: ## Delete the Kind cluster
kind delete cluster --name local-stack
clean-all: clean-loki clean-cluster ## Clean everything (Loki + cluster)
@echo "Cleanup complete!"
grafana: ## Open Grafana in browser
@echo "Opening Grafana at http://localhost:30000"
@echo "Username: admin"
@echo "Password: admin"
@open http://localhost:30000 || xdg-open http://localhost:30000 || echo "Please open http://localhost:30000 in your browser"
api: ## Open API in browser
@echo "Opening API at http://localhost:30080"
@open http://localhost:30080 || xdg-open http://localhost:30080 || echo "Please open http://localhost:30080 in your browser"