Repository navigation
Expand file tree
/
Copy path.mise.toml
More file actions
469 lines (403 loc) · 16 KB
/
Copy path.mise.toml
File metadata and controls
469 lines (403 loc) · 16 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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
[tools]
# Root tools for the entire project (kept minimal, each service manages its own)
watchexec = "2.8.0"
"pipx:semgrep" = "latest"
# Note: ratchet can be installed separately with: go install github.com/sethvargo/ratchet@latest
[env]
# Global environment variables for development
COMPOSE_PROJECT_NAME = "nais-quotes"
OTEL_EXPORTER_OTLP_ENDPOINT = "http://localhost:4317"
# Development service URLs
NEXT_PUBLIC_BACKEND_URL = "http://localhost:8080"
ANALYTICS_SERVICE_URL = "http://localhost:8081"
# =============================================================================
# MAIN DEVELOPMENT TASKS
# =============================================================================
[tasks.dev]
description = "Start all services in development mode"
run = [
"echo '🚀 Starting development environment...'",
"mise run infra:up",
"mkdir -p logs",
"echo 'Starting services...'",
# Start services using their own mise tasks in background
"(cd quotes-backend && mise run dev > ../logs/backend.log 2>&1) &",
"(cd quotes-analytics && mise run dev > ../logs/analytics.log 2>&1) &",
"(cd quotes-frontend && NEXT_PUBLIC_BACKEND_URL=$NEXT_PUBLIC_BACKEND_URL ANALYTICS_SERVICE_URL=$ANALYTICS_SERVICE_URL mise run dev > ../logs/frontend.log 2>&1) &",
"mise run dev:wait-for-services",
"echo '✅ Services ready - streaming logs (Ctrl+C to stop)...'",
"tail -f logs/*.log",
]
[tasks."dev:manual"]
description = "Start infrastructure only - start services manually"
run = [
"mise run infra:up",
"mise run dev:wait-for-infra",
"echo ''",
"echo '🚀 Start services manually in separate terminals:'",
"echo ' mise run backend:dev # Backend (Kotlin/Ktor)'",
"echo ' mise run frontend:dev # Frontend (Next.js)'",
"echo ' mise run analytics:dev # Analytics (.NET)'",
"echo ' mise run loadgen:dev # Load Generator (Go)'",
"echo ''",
]
[tasks."dev:wait-for-services"]
description = "Wait for all services to be ready"
run = [
"echo 'Waiting for services to start...'",
"sleep 5",
"for i in {1..30}; do curl -s http://localhost:8080/internal/health >/dev/null && echo 'Backend ready' && break || sleep 1; done",
"for i in {1..30}; do curl -s http://localhost:8081/internal/health >/dev/null && echo 'Analytics ready' && break || sleep 1; done",
"for i in {1..30}; do curl -s http://localhost:3000 >/dev/null && echo 'Frontend ready' && break || sleep 1; done",
"echo '✅ All services are ready:'",
"echo ' 📱 Frontend: http://localhost:3000'",
"echo ' ⚡ Backend: http://localhost:8080'",
"echo ' 📊 Analytics: http://localhost:8081'",
"echo ' 📈 Grafana: http://localhost:4300'",
]
[tasks."dev:wait-for-infra"]
description = "Wait for infrastructure services to be ready"
run = [
"echo 'Waiting for infrastructure...'",
"for i in {1..30}; do nc -z localhost 5432 2>/dev/null && echo 'PostgreSQL (Unleash) ready' && break || sleep 1; done",
"for i in {1..30}; do nc -z localhost 5433 2>/dev/null && echo 'PostgreSQL (Quotes) ready' && break || sleep 1; done",
"for i in {1..30}; do curl -s http://localhost:4242/health >/dev/null && echo 'Unleash ready' && break || sleep 1; done",
"echo '✅ Infrastructure ready'",
]
[tasks.stop]
description = "Stop all development services"
run = [
"echo '🛑 Stopping all services...'",
"pkill -f 'dotnet.*quotes-analytics' || true",
"pkill -f 'next.*dev' || true",
"pkill -f 'gradle.*run' || true",
"docker-compose down",
"echo '✅ All services stopped'",
]
[tasks.logs]
description = "Show logs from all development services"
run = [
"echo '📋 Application service logs:'",
"echo ''",
"mkdir -p logs",
"tail -f logs/*.log 2>/dev/null || echo 'No log files found. Run mise run dev first.'",
]
[tasks.status]
description = "Show status of all services"
run = [
"echo '📊 Service Status:'",
"echo ''",
"curl -s http://localhost:8080/internal/health | jq . 2>/dev/null && echo '✅ Backend (8080): Running' || echo '❌ Backend (8080): Not responding'",
"curl -s http://localhost:8081/internal/health | jq . 2>/dev/null && echo '✅ Analytics (8081): Running' || echo '❌ Analytics (8081): Not responding'",
"curl -s http://localhost:3000 >/dev/null 2>&1 && echo '✅ Frontend (3000): Running' || echo '❌ Frontend (3000): Not responding'",
"curl -s http://localhost:4300 >/dev/null 2>&1 && echo '✅ Grafana (4300): Running' || echo '❌ Grafana (4300): Not responding'",
"curl -s http://localhost:4242/health >/dev/null 2>&1 && echo '✅ Unleash (4242): Running' || echo '❌ Unleash (4242): Not responding'",
]
# =============================================================================
# INFRASTRUCTURE TASKS
# =============================================================================
[tasks."infra:up"]
description = "Start infrastructure services (PostgreSQL, OTEL, Unleash)"
run = [
"echo '🏗️ Starting infrastructure services...'",
"docker-compose up -d postgres quotes-db otel unleash",
"echo '✅ Infrastructure ready:'",
"echo ' 📊 Grafana: http://localhost:4300'",
"echo ' 🎯 Unleash: http://localhost:4242'",
"echo ' 🗄️ PostgreSQL (Unleash): localhost:5432'",
"echo ' 🗄️ PostgreSQL (Quotes): localhost:5433'",
]
[tasks."infra:down"]
description = "Stop infrastructure services"
run = [
"echo '🛑 Stopping infrastructure...'",
"docker-compose down",
"echo '✅ Infrastructure stopped'",
]
[tasks."infra:logs"]
description = "Show infrastructure logs"
run = "docker-compose logs -f postgres otel unleash"
# =============================================================================
# SERVICE DELEGATION TASKS
# =============================================================================
# Backend (Kotlin/Ktor)
[tasks."backend:dev"]
description = "Start backend in development mode"
run = "cd quotes-backend && mise run dev"
[tasks."backend:build"]
description = "Build backend service"
run = "cd quotes-backend && mise run build"
[tasks."backend:test"]
description = "Test backend service"
run = "cd quotes-backend && mise run test"
[tasks."backend:lint"]
description = "Lint backend service"
run = "cd quotes-backend && mise run lint"
[tasks."backend:clean"]
description = "Clean backend service"
run = "cd quotes-backend && mise run clean"
[tasks."backend:security-scan"]
description = "Security scan backend service"
run = "cd quotes-backend && mise run security-scan"
# Frontend (Next.js)
[tasks."frontend:dev"]
description = "Start frontend in development mode"
env = { NEXT_PUBLIC_BACKEND_URL = "http://localhost:8080", ANALYTICS_SERVICE_URL = "http://localhost:8081" }
run = "cd quotes-frontend && mise run dev"
[tasks."frontend:build"]
description = "Build frontend service"
run = "cd quotes-frontend && mise run build"
[tasks."frontend:test"]
description = "Test frontend service (type check)"
run = "cd quotes-frontend && mise run type-check"
[tasks."frontend:lint"]
description = "Lint frontend service"
run = "cd quotes-frontend && mise run lint"
[tasks."frontend:clean"]
description = "Clean frontend service"
run = "cd quotes-frontend && mise run clean"
[tasks."frontend:security-scan"]
description = "Security scan frontend service"
run = "cd quotes-frontend && mise run security-scan"
# Analytics (.NET)
[tasks."analytics:dev"]
description = "Start analytics in development mode"
run = "cd quotes-analytics && mise run dev"
[tasks."analytics:build"]
description = "Build analytics service"
run = "cd quotes-analytics && mise run build"
[tasks."analytics:test"]
description = "Test analytics service"
run = "cd quotes-analytics && mise run test"
[tasks."analytics:lint"]
description = "Lint analytics service"
run = "cd quotes-analytics && mise run lint"
[tasks."analytics:clean"]
description = "Clean analytics service"
run = "cd quotes-analytics && mise run clean"
[tasks."analytics:security-scan"]
description = "Security scan analytics service"
run = "cd quotes-analytics && mise run security-scan"
# Load Generator (Go)
[tasks."loadgen:dev"]
description = "Start load generator"
run = "cd quotes-loadgen && mise run dev"
[tasks."loadgen:build"]
description = "Build load generator"
run = "cd quotes-loadgen && mise run build"
[tasks."loadgen:test"]
description = "Test load generator"
run = "cd quotes-loadgen && mise run test"
[tasks."loadgen:analytics"]
description = "Generate load for analytics endpoints"
run = "cd quotes-loadgen && mise run load:analytics"
[tasks."loadgen:full"]
description = "Generate load for all endpoints"
run = "cd quotes-loadgen && mise run load:full"
[tasks."loadgen:lint"]
description = "Lint load generator"
run = "cd quotes-loadgen && mise run lint"
[tasks."loadgen:clean"]
description = "Clean load generator"
run = "cd quotes-loadgen && mise run clean"
[tasks."loadgen:security-scan"]
description = "Security scan load generator"
run = "cd quotes-loadgen && mise run security-scan"
# =============================================================================
# ORCHESTRATION TASKS
# =============================================================================
[tasks.build]
description = "Build all services"
run = [
"mise run backend:build",
"mise run frontend:build",
"mise run analytics:build",
"mise run loadgen:build",
]
[tasks.test]
description = "Run tests for all services"
run = [
"mise run backend:test",
"mise run frontend:test",
"mise run analytics:test",
"mise run loadgen:test",
]
[tasks.lint]
description = "Run linting for all services"
run = [
"mise run backend:lint",
"mise run frontend:lint",
"mise run analytics:lint",
"mise run loadgen:lint",
]
[tasks.clean]
description = "Clean all services"
run = [
"mise run backend:clean",
"mise run frontend:clean",
"mise run analytics:clean",
"mise run loadgen:clean",
]
[tasks."security-scan"]
description = "Run security scanning for all services"
run = [
"mise run backend:security-scan",
"mise run frontend:security-scan",
"mise run analytics:security-scan",
"mise run loadgen:security-scan",
]
[tasks.ci]
description = "Run full CI pipeline"
run = [
"mise run lint",
"mise run test",
"mise run build",
"mise run security-scan",
]
[tasks."dependencies:update"]
description = "Update dependencies for all services"
run = [
"echo '📦 Updating dependencies for all services...'",
"mise run backend:dependencies:update",
"mise run frontend:dependencies:update",
"mise run analytics:dependencies:update",
"mise run loadgen:dependencies:update",
"echo '✅ All dependencies updated'",
]
# =============================================================================
# INDIVIDUAL SERVICE DEPENDENCY UPDATE TASKS
# =============================================================================
[tasks."backend:dependencies:update"]
description = "Update backend dependencies"
run = "cd quotes-backend && mise run dependencies:update"
[tasks."frontend:dependencies:update"]
description = "Update frontend dependencies"
run = "cd quotes-frontend && mise run dependencies:update"
[tasks."analytics:dependencies:update"]
description = "Update analytics dependencies"
run = "cd quotes-analytics && mise run dependencies:update"
[tasks."loadgen:dependencies:update"]
description = "Update load generator dependencies"
run = "cd quotes-loadgen && mise run dependencies:update"
# =============================================================================
# GITHUB ACTIONS SECURITY TASKS (Ratchet)
# =============================================================================
[tasks."ratchet:pin"]
description = "Pin GitHub Actions to specific commit SHAs"
run = [
"echo '📌 Pinning GitHub Actions to commit SHAs...'",
"ratchet pin .github/workflows/*.yml .github/workflows/*.yaml",
"echo '✅ All actions pinned'",
]
[tasks."ratchet:update"]
description = "Update pinned GitHub Actions to latest versions"
run = [
"echo '🔄 Updating pinned GitHub Actions...'",
"ratchet update .github/workflows/*.yml .github/workflows/*.yaml",
"echo '✅ All actions updated'",
]
[tasks."ratchet:lint"]
description = "Check if GitHub Actions are properly pinned"
run = [
"echo '🔍 Checking GitHub Actions pinning...'",
"ratchet lint .github/workflows/*.yml .github/workflows/*.yaml",
]
[tasks."ratchet:unpin"]
description = "Unpin GitHub Actions (restore to tags)"
run = [
"echo '🔓 Unpinning GitHub Actions...'",
"ratchet unpin .github/workflows/*.yml .github/workflows/*.yaml",
"echo '✅ All actions unpinned'",
]
# =============================================================================
# DOCKER TASKS
# =============================================================================
[tasks."docker:build"]
description = "Build all Docker images"
run = [
"echo '🐳 Building all Docker images...'",
"docker-compose build",
"echo '✅ All Docker images built'",
]
[tasks."docker:up"]
description = "Start all services with Docker Compose"
run = [
"echo '🚀 Starting all services with Docker Compose...'",
"docker-compose up -d --build",
"echo '✅ All services started'",
"echo '🌐 Frontend: http://localhost:3000'",
"echo '⚡ Backend: http://localhost:8080'",
"echo '📊 Analytics: http://localhost:8081'",
"echo '📈 Grafana: http://localhost:4300'",
"echo '🎯 Unleash: http://localhost:4242'",
]
[tasks."docker:down"]
description = "Stop all Docker services"
run = [
"echo '🛑 Stopping all Docker services...'",
"docker-compose down",
"echo '✅ All Docker services stopped'",
]
[tasks."docker:logs"]
description = "Show logs from all Docker services"
run = "docker-compose logs -f"
# =============================================================================
# SETUP AND HELP
# =============================================================================
[tasks.setup]
description = "Set up the development environment"
run = [
"echo '⚙️ Setting up development environment...'",
"mkdir -p logs",
"mise install",
"echo 'Installing dependencies for each service...'",
"cd quotes-frontend && mise run install",
"cd quotes-backend && mise run build --no-daemon",
"cd quotes-analytics && mise run restore",
"cd quotes-loadgen && mise run mod-download",
"echo '✅ Development environment set up successfully'",
"echo ''",
"echo '🚀 Quick start:'",
"echo ' mise run dev # Start all services with logs'",
"echo ' mise run dev:manual # Manual terminal approach'",
"echo ' mise run docker:up # Full Docker Compose stack'",
]
[tasks.help]
description = "Show available tasks and usage"
run = [
"echo '🚀 Nais Quotes Application - Available Commands:'",
"echo ''",
"echo '📦 Setup:'",
"echo ' mise run setup # Set up development environment'",
"echo ''",
"echo '🚀 Development:'",
"echo ' mise run dev # Start everything (recommended)'",
"echo ' mise run dev:manual # Start infrastructure only'",
"echo ' mise run stop # Stop all services'",
"echo ' mise run logs # Show application logs'",
"echo ' mise run status # Check service status'",
"echo ''",
"echo '🔨 Individual Services:'",
"echo ' mise run backend:dev # Start backend in dev mode'",
"echo ' mise run frontend:dev # Start frontend in dev mode'",
"echo ' mise run analytics:dev # Start analytics in dev mode'",
"echo ' mise run loadgen:dev # Start load generator'",
"echo ' mise run loadgen:analytics # Load test analytics endpoints'",
"echo ' mise run loadgen:full # Load test all endpoints'",
"echo ''",
"echo '🐳 Docker:'",
"echo ' mise run docker:up # Start all services with Docker'",
"echo ' mise run docker:down # Stop all Docker services'",
"echo ' mise run docker:logs # Show Docker logs'",
"echo ''",
"echo '🧪 Testing & Quality:'",
"echo ' mise run test # Run tests for all services'",
"echo ' mise run lint # Run linting for all services'",
"echo ' mise run build # Build all services'",
"echo ' mise run ci # Run full CI pipeline'",
"echo ''",
"echo '🏗️ Infrastructure:'",
"echo ' mise run infra:up # Start infrastructure only'",
"echo ' mise run infra:down # Stop infrastructure'",
"echo ' mise run infra:logs # Show infrastructure logs'",
]