-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
328 lines (265 loc) · 7.96 KB
/
Copy pathmise.toml
File metadata and controls
328 lines (265 loc) · 7.96 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# Mise configuration for Seshat
# https://mise.jdx.dev/
[tools]
rust = "1.90"
protoc = "28"
[env]
# Environment variables
RUST_BACKTRACE = "1"
RUST_LOG = "seshat=debug,raft=info"
[tasks.install]
description = "Install dependencies and tools"
run = [
"rustup component add rustfmt clippy",
"cargo fetch",
]
[tasks.build]
description = "Build all crates in workspace"
run = "cargo build --workspace"
[tasks."build:release"]
description = "Build optimized release binary"
run = "cargo build --workspace --release"
[tasks.format]
description = "Format all Rust code"
run = "cargo fmt --all"
[tasks."format:check"]
description = "Check code formatting without modifying"
run = "cargo fmt --all -- --check"
[tasks.lint]
description = "Run clippy linter"
run = "cargo clippy --workspace --all-targets --all-features -- -D warnings"
[tasks.test]
description = "Run all tests"
run = "cargo test --workspace"
[tasks."test:unit"]
description = "Run unit tests only"
run = "cargo test --workspace --lib"
[tasks."test:integration"]
description = "Run integration tests only"
run = "cargo test --workspace --test '*'"
[tasks.dev]
description = "Run tests in watch mode"
depends = ["install"]
run = """
if ! command -v cargo-watch &> /dev/null; then
echo "Installing cargo-watch..."
cargo install cargo-watch
fi
cargo watch -x test
"""
[tasks.docker]
description = "Build Docker image for Seshat"
run = "docker build -t seshat:latest -f Dockerfile ."
[tasks."docker:compose"]
description = "Build all Docker Compose services"
run = "docker-compose build"
[tasks.start]
description = "Start 5-node cluster with Docker Compose"
depends = ["docker:compose"]
run = """
echo "Starting 5-node Seshat cluster..."
echo " - seshat-1: redis://localhost:6379, internal://localhost:7379"
echo " - seshat-2: redis://localhost:6380, internal://localhost:7380"
echo " - seshat-3: redis://localhost:6381, internal://localhost:7381"
echo " - seshat-4: redis://localhost:6382, internal://localhost:7382"
echo " - seshat-5: redis://localhost:6383, internal://localhost:7383"
echo ""
docker-compose up
"""
[tasks.stop]
description = "Stop the cluster"
run = "docker-compose down"
[tasks.clean]
description = "Clean build artifacts and test data"
run = [
"cargo clean",
"rm -rf data1 data2 data3 data4 data5",
"rm -rf snapshots",
]
[tasks.check]
description = "Format code and run all checks (format, lint, build, test)"
depends = ["format", "lint", "build", "test"]
[tasks.validate]
description = "Full validation pipeline (format, lint, build, test)"
run = [
"mise run format:check",
"mise run lint",
"mise run build",
"mise run test",
]
[tasks.proto]
description = "Generate code from .proto files"
run = """
if [ -d "proto" ]; then
cargo build --package protocol
echo "✓ Protobuf code regenerated"
else
echo "No proto/ directory found"
fi
"""
# Cluster management tasks
[tasks."cluster:logs"]
description = "Tail logs from all cluster nodes"
run = "docker-compose logs -f"
[tasks."cluster:ps"]
description = "Show cluster node status"
run = "docker-compose ps"
[tasks."cluster:restart"]
description = "Restart the cluster"
run = [
"docker-compose down",
"docker-compose up -d",
]
[tasks."cluster:reset"]
description = "Reset cluster data (WARNING: deletes all data)"
run = [
"docker-compose down -v",
"rm -rf data1 data2 data3",
"docker-compose up -d",
]
# Redis client tasks
[tasks.redis-cli]
description = "Connect to node 1 with redis-cli"
run = "redis-cli -h localhost -p 6379"
[tasks."redis:node1"]
description = "Connect to node 1"
run = "redis-cli -h localhost -p 6379"
[tasks."redis:node2"]
description = "Connect to node 2"
run = "redis-cli -h localhost -p 6380"
[tasks."redis:node3"]
description = "Connect to node 3"
run = "redis-cli -h localhost -p 6381"
[tasks."redis:node4"]
description = "Connect to node 4"
run = "redis-cli -h localhost -p 6382"
[tasks."redis:node5"]
description = "Connect to node 5"
run = "redis-cli -h localhost -p 6383"
[tasks.benchmark]
description = "Run redis-benchmark against the cluster"
run = """
if ! command -v redis-benchmark &> /dev/null; then
echo "⚠️ redis-benchmark not found. Install redis-tools."
exit 1
fi
redis-benchmark -h localhost -p 6379 -t get,set -n 100000 -q
"""
# Development helpers
[tasks.docs]
description = "Build and open Rust documentation"
run = "cargo doc --workspace --no-deps --open"
[tasks.expand]
description = "Show macro expansion for a crate (usage: mise expand <crate>)"
run = "cargo expand -p ${1:-seshat}"
[tasks.tree]
description = "Show dependency tree"
run = "cargo tree --workspace"
# Storage crate tasks
[tasks."storage:build"]
description = "Build seshat-storage crate"
run = "cargo build --package seshat-storage"
[tasks."storage:check"]
description = "Check seshat-storage for errors"
run = "cargo check --package seshat-storage"
[tasks."storage:fmt"]
description = "Format seshat-storage"
run = "cargo fmt --package seshat-storage"
[tasks."storage:fmt-check"]
description = "Check seshat-storage formatting"
run = "cargo fmt --package seshat-storage -- --check"
[tasks."storage:clippy"]
description = "Run clippy on seshat-storage"
run = "cargo clippy --package seshat-storage -- -D warnings"
[tasks."storage:test"]
description = "Run seshat-storage tests"
run = "cargo test --package seshat-storage"
[tasks."storage:all"]
description = "Build, format, lint, and test seshat-storage"
depends = ["storage:check", "storage:fmt-check", "storage:clippy", "storage:test"]
# Generic project tasks (usage: mise check:PROJECT)
# Projects: storage, kv, resp, seshat, protocol
[tasks."check:storage"]
description = "Check seshat-storage"
run = "cargo check --package seshat-storage"
[tasks."check:kv"]
description = "Check seshat-kv"
run = "cargo check --package seshat-kv"
[tasks."check:resp"]
description = "Check seshat-resp"
run = "cargo check --package seshat-resp"
[tasks."check:seshat"]
description = "Check seshat binary"
run = "cargo check --package seshat"
[tasks."check:protocol"]
description = "Check protocol crate"
run = "cargo check --package protocol"
[tasks."check:all"]
description = "Check all crates"
run = "cargo check --workspace"
# Format tasks
[tasks."fmt:storage"]
description = "Format seshat-storage"
run = "cargo fmt --package seshat-storage"
[tasks."fmt:kv"]
description = "Format seshat-kv"
run = "cargo fmt --package seshat-kv"
[tasks."fmt:resp"]
description = "Format seshat-resp"
run = "cargo fmt --package seshat-resp"
[tasks."fmt:seshat"]
description = "Format seshat binary"
run = "cargo fmt --package seshat"
[tasks."fmt:all"]
description = "Format all crates"
run = "cargo fmt --workspace"
# Lint tasks
[tasks."lint:storage"]
description = "Lint seshat-storage"
run = "cargo clippy --package seshat-storage -- -D warnings"
[tasks."lint:kv"]
description = "Lint seshat-kv"
run = "cargo clippy --package seshat-kv -- -D warnings"
[tasks."lint:resp"]
description = "Lint seshat-resp"
run = "cargo clippy --package seshat-resp -- -D warnings"
[tasks."lint:seshat"]
description = "Lint seshat binary"
run = "cargo clippy --package seshat -- -D warnings"
[tasks."lint:all"]
description = "Lint all crates"
run = "cargo clippy --workspace -- -D warnings"
# Test tasks
[tasks."test:storage"]
description = "Test seshat-storage"
run = "cargo test --package seshat-storage"
[tasks."test:kv"]
description = "Test seshat-kv"
run = "cargo test --package seshat-kv"
[tasks."test:resp"]
description = "Test seshat-resp"
run = "cargo test --package seshat-resp"
[tasks."test:seshat"]
description = "Test seshat binary"
run = "cargo test --package seshat"
[tasks."test:all"]
description = "Test all crates"
run = "cargo test --workspace"
# Git hooks (optional)
[tasks."hooks:install"]
description = "Install git pre-commit hooks"
run = """
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/sh
mise run format:check || {
echo "Code is not formatted. Run: mise format"
exit 1
}
mise run lint || {
echo "Clippy checks failed."
exit 1
}
EOF
chmod +x .git/hooks/pre-commit
echo "✓ Git pre-commit hook installed"
"""