-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (103 loc) · 5.47 KB
/
Copy pathMakefile
File metadata and controls
129 lines (103 loc) · 5.47 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
# ─────────────────────────────────────────────────────────────────────────
# Dynamo KV Store — Makefile
#
# Usage:
# make build — compile and package the fat jar
# make test — run all unit tests
# make node1 — start node1 on port 8080
# make node2 — start node2 on port 8081
# make node3 — start node3 on port 8082
# make demo — run the full end-to-end demo script
# make docker-build — build the Docker image
# make cluster-up — start 3-node Docker cluster
# make cluster-down — stop Docker cluster
# make health — check health of all 3 local nodes
# make clean — clean build artifacts
# ─────────────────────────────────────────────────────────────────────────
JAR = target/dynamo-kv-1.0.0.jar
JVM_OPTS = -Xms128m -Xmx512m
.PHONY: build test node1 node2 node3 demo \
docker-build cluster-up cluster-down \
health clean help
# ── Build ─────────────────────────────────────────────────────────────────
build:
@echo "Building dynamo-kv..."
mvn clean package -DskipTests -q
@echo "Built: $(JAR)"
test:
@echo "Running tests..."
mvn test
# ── Run local nodes ───────────────────────────────────────────────────────
node1: build
java $(JVM_OPTS) -jar $(JAR) config/node1.properties
node2: build
java $(JVM_OPTS) -jar $(JAR) config/node2.properties
node3: build
java $(JVM_OPTS) -jar $(JAR) config/node3.properties
# ── Demo ─────────────────────────────────────────────────────────────────
demo:
@echo "Running end-to-end demo..."
@chmod +x scripts/demo.sh
./scripts/demo.sh
# ── Docker ────────────────────────────────────────────────────────────────
docker-build:
docker build -t dynamo-kv:latest .
cluster-up:
docker-compose up -d
@echo "Cluster starting... waiting 15s for health checks..."
@sleep 15
@docker-compose ps
cluster-down:
docker-compose down
cluster-logs:
docker-compose logs -f
# ── Ops ───────────────────────────────────────────────────────────────────
health:
@echo "=== Node 1 (port 8080) ==="
@curl -s http://localhost:8080/admin/health | python3 -m json.tool 2>/dev/null || echo "NOT RUNNING"
@echo ""
@echo "=== Node 2 (port 8081) ==="
@curl -s http://localhost:8081/admin/health | python3 -m json.tool 2>/dev/null || echo "NOT RUNNING"
@echo ""
@echo "=== Node 3 (port 8082) ==="
@curl -s http://localhost:8082/admin/health | python3 -m json.tool 2>/dev/null || echo "NOT RUNNING"
members:
@echo "=== Gossip membership (node1 view) ==="
@curl -s http://localhost:8080/admin/members | python3 -m json.tool 2>/dev/null || echo "NOT RUNNING"
ring:
@echo "=== Ring info (node1 view) ==="
@curl -s http://localhost:8080/ring/info | python3 -m json.tool 2>/dev/null || echo "NOT RUNNING"
antientropy:
@echo "=== Anti-entropy stats (node1 view) ==="
@curl -s http://localhost:8080/admin/antientropy | python3 -m json.tool 2>/dev/null || echo "NOT RUNNING"
trigger-sync:
@echo "Triggering anti-entropy round on all nodes..."
@curl -s -X POST http://localhost:8080/internal/antientropy/trigger
@curl -s -X POST http://localhost:8081/internal/antientropy/trigger
@curl -s -X POST http://localhost:8082/internal/antientropy/trigger
@echo "Done"
# ── Clean ─────────────────────────────────────────────────────────────────
clean:
mvn clean
rm -rf data/
# ── Help ─────────────────────────────────────────────────────────────────
help:
@echo ""
@echo "Dynamo KV Store — Make targets:"
@echo ""
@echo " make build Compile and package the fat jar"
@echo " make test Run all unit tests"
@echo " make node1 Start node1 on port 8080"
@echo " make node2 Start node2 on port 8081"
@echo " make node3 Start node3 on port 8082"
@echo " make demo Run full end-to-end demo"
@echo " make docker-build Build Docker image"
@echo " make cluster-up Start 3-node Docker cluster"
@echo " make cluster-down Stop Docker cluster"
@echo " make health Check health of all local nodes"
@echo " make members Show gossip membership table"
@echo " make ring Show consistent hash ring info"
@echo " make antientropy Show anti-entropy stats"
@echo " make trigger-sync Manually trigger anti-entropy on all nodes"
@echo " make clean Remove build artifacts and data"
@echo ""