-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
123 lines (99 loc) · 3.85 KB
/
Makefile
File metadata and controls
123 lines (99 loc) · 3.85 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
# Purpose: Unified Developer Experience & DevOps interface
# Author: Nahasat Nibir (Lead Cloud Architect)
# Date: 2026-03-19
.PHONY: up down proto clean dev seed test-go test-ai test aws-check tf-init tf-plan tf-deploy tf-destroy build-docker
# Load environment variables (Automatically exports to Terraform as TF_VAR_ if named correctly)
ifneq (,$(wildcard ./.env))
include .env
export
endif
# ==========================================
# LOCAL DATA STORES (Postgres & Redis)
# ==========================================
up:
@echo "Starting local infrastructure (Postgres, Redis)..."
docker-compose up -d
@echo "Infrastructure is up and running."
down:
@echo "Stopping local infrastructure..."
docker-compose down -v
@echo "Infrastructure removed."
# ==========================================
# GPRC & PROTOBUFS
# ==========================================
proto:
@echo "Compiling Protobufs..."
@mkdir -p gateway/internal/rpc/pb
# Generate Go code strictly into the gateway module
protoc -I=proto --go_out=gateway/internal/rpc/pb --go_opt=paths=source_relative \
--go-grpc_out=gateway/internal/rpc/pb --go-grpc_opt=paths=source_relative \
game.proto
# Generate Python code
cd ai_service && uv run python -m grpc_tools.protoc -I../proto --python_out=src/api/ --grpc_python_out=src/api/ ../proto/game.proto
@echo "Protobuf compilation complete."
clean:
@echo "Cleaning up generated files..."
rm -rf gateway/internal/rpc/pb/*.pb.go
rm -f ai_service/src/api/*_pb2*.py
@echo "Clean complete."
# ==========================================
# DATABASE SETUP & SEEDING
# ==========================================
seed:
@echo "Seeding the database with Gamified Healthcare Scenarios..."
cd ai_service && uv run python -m src.db.seed
@echo "Database seeding complete."
# ==========================================
# LOCAL DEVELOPMENT (Single Command Run)
# ==========================================
# Runs the databases, Go, Python, and React all in one terminal
dev: up
@echo "Starting VaultSim Enterprise Stack..."
@echo "Press CTRL+C to stop all services gracefully."
@trap 'echo "Shutting down services..."; kill 0' SIGINT; \
(cd gateway && go run cmd/server/main.go) & \
(cd ai_service && uv run python -m src.main) & \
(cd web && npm run dev) & \
wait
# ==========================================
# TESTING
# ==========================================
test-go:
@echo "Running Go Gateway Tests..."
cd gateway && go test -v ./...
test-ai:
@echo "Running Python AI Service Tests..."
cd ai_service && uv run pytest tests/
test: test-go test-ai
@echo "All tests passed successfully."
# ==========================================
# DOCKER BUILD
# ==========================================
build-docker:
@echo "Building production Docker images..."
docker build -t vaultsim-gateway -f gateway/Dockerfile ./gateway
docker build -t vaultsim-ai-service -f ai_service/Dockerfile ./ai_service
docker build -t vaultsim-web -f web/Dockerfile ./web
@echo "Docker images built successfully."
# ==========================================
# AWS & TERRAFORM DEPLOYMENT
# ==========================================
# Verifies your AWS CLI is authenticated before running infrastructure commands
aws-check:
@echo "Verifying AWS credentials..."
@aws sts get-caller-identity > /dev/null || (echo "AWS CLI not authenticated. Run 'aws configure' first." && exit 1)
@echo "AWS authentication successful."
tf-init: aws-check
@echo "Initializing Terraform..."
cd infra && terraform init
tf-plan: tf-init
@echo "Planning Terraform changes..."
cd infra && terraform plan
tf-deploy: tf-init
@echo "Deploying infrastructure to AWS..."
cd infra && terraform apply -auto-approve
@echo "Deployment complete."
tf-destroy: aws-check
@echo "Destroying AWS infrastructure to save costs..."
cd infra && terraform destroy -auto-approve
@echo "AWS Infrastructure successfully destroyed."