Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
170 lines (134 loc) · 6.32 KB
/
Copy pathMakefile
File metadata and controls
170 lines (134 loc) · 6.32 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# ─── Vantage Observability Stack - Makefile ────────────────────────────────────
.PHONY: help up down logs ps bootstrap test-python test-node test \
helm-deps helm-install helm-upgrade helm-uninstall \
open-grafana open-kibana open-jaeger open-prometheus
# Default target
help:
@echo ""
@echo " Vantage - Observability Stack"
@echo " ─────────────────────────────────────────────────────────"
@echo " Stack:"
@echo " make up Start the full observability stack"
@echo " make down Stop all containers"
@echo " make down-v Stop and remove all volumes (full reset)"
@echo " make logs Tail logs from all services"
@echo " make ps Show container status"
@echo " make bootstrap Run Elasticsearch ILM + Kibana setup"
@echo ""
@echo " Open UIs:"
@echo " make open-grafana http://localhost:3000 (admin/vantage_grafana)"
@echo " make open-kibana http://localhost:5601"
@echo " make open-jaeger http://localhost:16686"
@echo " make open-prometheus http://localhost:9090"
@echo " make open-alerts http://localhost:9093"
@echo ""
@echo " Tests:"
@echo " make test-python Run Python middleware tests"
@echo " make test-node Run Node.js middleware tests"
@echo " make test Run all tests"
@echo ""
@echo " Helm (Kubernetes):"
@echo " make helm-deps Download Helm chart dependencies"
@echo " make helm-install Deploy Vantage to current kubectl context"
@echo " make helm-upgrade Upgrade existing Vantage deployment"
@echo " make helm-uninstall Remove Vantage from cluster"
@echo ""
# ── Docker Compose ─────────────────────────────────────────────────────────────
up:
@echo "→ Starting Vantage stack..."
@cp -n .env.example .env 2>/dev/null || true
docker compose up -d --build
@echo ""
@echo "✅ Vantage is starting. Services will be ready in ~60 seconds."
@echo " Grafana: http://localhost:3000 (admin / vantage_grafana)"
@echo " Kibana: http://localhost:5601"
@echo " Jaeger: http://localhost:16686"
@echo " Prometheus: http://localhost:9090"
@echo " Python demo: http://localhost:8080"
@echo " Node demo: http://localhost:3001"
down:
docker compose down
down-v:
docker compose down -v
@echo "✓ All volumes removed - fresh start next time."
logs:
docker compose logs -f
logs-%:
docker compose logs -f $*
ps:
docker compose ps
restart-%:
docker compose restart $*
build-%:
docker compose up -d --build $*
# ── Bootstrap ──────────────────────────────────────────────────────────────────
bootstrap:
@echo "→ Running Elasticsearch + Kibana bootstrap..."
@bash infra/elasticsearch/bootstrap.sh
@bash infra/kibana/setup.sh
@echo "✅ Bootstrap complete."
# ── Tests ─────────────────────────────────────────────────────────────────────
test-python:
@echo "→ Running Python middleware tests..."
cd middleware/python && pip install -q -e ".[all]" && pytest tests/ -v
test-node:
@echo "→ Running Node.js middleware tests..."
cd middleware/node && npm install --silent && npm test
test: test-python test-node
@echo "✅ All tests passed."
# ── Open UIs ──────────────────────────────────────────────────────────────────
open-grafana:
@open http://localhost:3000 2>/dev/null || xdg-open http://localhost:3000
open-kibana:
@open http://localhost:5601 2>/dev/null || xdg-open http://localhost:5601
open-jaeger:
@open http://localhost:16686 2>/dev/null || xdg-open http://localhost:16686
open-prometheus:
@open http://localhost:9090 2>/dev/null || xdg-open http://localhost:9090
open-alerts:
@open http://localhost:9093 2>/dev/null || xdg-open http://localhost:9093
open-all: open-grafana open-kibana open-jaeger open-prometheus
# ── Helm ──────────────────────────────────────────────────────────────────────
HELM_RELEASE ?= vantage
HELM_NAMESPACE ?= observability
helm-deps:
cd helm && helm dependency update
helm-install: helm-deps
helm install $(HELM_RELEASE) ./helm \
--namespace $(HELM_NAMESPACE) \
--create-namespace \
--wait \
--timeout 10m
@echo "✅ Vantage deployed to namespace: $(HELM_NAMESPACE)"
helm-upgrade:
helm upgrade $(HELM_RELEASE) ./helm \
--namespace $(HELM_NAMESPACE) \
--wait \
--timeout 10m
helm-uninstall:
helm uninstall $(HELM_RELEASE) --namespace $(HELM_NAMESPACE)
helm-status:
helm status $(HELM_RELEASE) --namespace $(HELM_NAMESPACE)
helm-lint:
helm lint ./helm
helm-template:
helm template $(HELM_RELEASE) ./helm --namespace $(HELM_NAMESPACE)
# ── Load generator (stress test alerts) ───────────────────────────────────────
load-test-python:
@echo "→ Sending 1000 requests to Python demo..."
@for i in $$(seq 1 1000); do \
curl -s http://localhost:8080/orders/order-$$i > /dev/null & \
done; wait
@echo "✅ Load test complete. Check Grafana for metrics."
load-test-node:
@echo "→ Sending 1000 requests to Node.js demo..."
@for i in $$(seq 1 1000); do \
curl -s http://localhost:3001/orders/order-$$i > /dev/null & \
done; wait
@echo "✅ Load test complete. Check Grafana for metrics."
trigger-alerts:
@echo "→ Triggering error rate alert (hitting /error 200 times)..."
@for i in $$(seq 1 200); do curl -s http://localhost:8080/error > /dev/null; done
@echo "→ Triggering latency alert (hitting /slow 50 times)..."
@for i in $$(seq 1 50); do curl -s http://localhost:8080/slow > /dev/null & done; wait
@echo "✅ Alerts should fire in ~5 minutes. Check Alertmanager."