-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
160 lines (121 loc) · 5.11 KB
/
Makefile
File metadata and controls
160 lines (121 loc) · 5.11 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
DB_URL=postgresql://root:secret@localhost:5432/simple_bank?sslmode=disable
image:
docker build -f deployments/Dockerfile.plan -t plan-service:latest .
docker build -f deployments/Dockerfile.implementation -t implementation-service:latest .
docker build -f deployments/Dockerfile.diagram -t diagram-service:latest .
docker build -f deployments/Dockerfile.analyzer -t analyzer-service:latest .
docker build -f deployments/Dockerfile.gateway -t gin-gateway:latest .
image-plan:
docker build -f deployments/Dockerfile.plan -t plan-service:latest .
image-implementation:
docker build -f deployments/Dockerfile.implementation -t implementation-service:latest .
image-diagram:
docker build -f deployments/Dockerfile.diagram -t diagram-service:latest .
image-analyzer:
docker build -f deployments/Dockerfile.analyzer -t analyzer-service:latest .
image-gateway:
docker build -f deployments/Dockerfile.gateway -t gin-gateway:latest .
db_docs:
dbdocs build doc/db.dbml
sqlc:
sqlc generate
test:
go test -v -cover -short ./...
gateway-server:
go run internal/gateway/main.go
mock:
mockgen -package mockdb -destination db/mock/store.go github.com/techschool/simplebank/db/sqlc Store
mockgen -package mockwk -destination worker/mock/distributor.go github.com/techschool/simplebank/worker TaskDistributor
proto:
@echo "Compiling proto files for all services..."
@make proto-agent
@make proto-plan
@make proto-implementation
@make proto-diagram
@make proto-analyzer
@echo "All proto files compiled successfully!"
proto-agent:
@echo "Compiling Agent Service proto..."
rm -f services/agent/pb/*.go
protoc --proto_path=services/agent/pb \
--go_out=services/agent/pb --go_opt=paths=source_relative \
--go-grpc_out=services/agent/pb --go-grpc_opt=paths=source_relative \
services/agent/pb/*.proto
proto-plan:
@echo "Compiling Plan Service proto..."
rm -f services/plan/pb/*.go
protoc --proto_path=services/plan/pb \
--go_out=services/plan/pb --go_opt=paths=source_relative \
--go-grpc_out=services/plan/pb --go-grpc_opt=paths=source_relative \
services/plan/pb/*.proto
proto-implementation:
@echo "Compiling Implementation Service proto..."
rm -f services/implementation/pb/*.go
protoc --proto_path=services/implementation/pb \
--go_out=services/implementation/pb --go_opt=paths=source_relative \
--go-grpc_out=services/implementation/pb --go-grpc_opt=paths=source_relative \
services/implementation/pb/*.proto
proto-diagram:
@echo "Compiling Diagram Service proto..."
rm -f services/diagram/pb/*.go
protoc --proto_path=services/diagram/pb \
--go_out=services/diagram/pb --go_opt=paths=source_relative \
--go-grpc_out=services/diagram/pb --go-grpc_opt=paths=source_relative \
services/diagram/pb/*.proto
proto-analyzer:
@echo "Compiling Analyzer Service proto..."
rm -f services/analyzer/pb/*.go
protoc --proto_path=services/analyzer/pb \
--go_out=services/analyzer/pb --go_opt=paths=source_relative \
--go-grpc_out=services/analyzer/pb --go-grpc_opt=paths=source_relative \
services/analyzer/pb/*.proto
# 각 서비스 실행
run-gateway:
go run internal/gateway/main.go
run-plan:
cd services/plan && go run main.go
run-implementation:
cd services/implementation && go run main.go
run-diagram:
cd services/diagram && go run main.go
run-analyzer:
cd services/analyzer && go run main.go
# 모든 서비스 동시 실행 (개발용)
run-all:
@echo "Starting all microservices..."
@make -j6 run-gateway run-plan run-implementation run-diagram run-analyzer
evans:
evans --host localhost --port 9090 -r repl
evans-plan:
evans --host localhost --port 9091 -r repl
evans-implementation:
evans --host localhost --port 9092 -r repl
evans-diagram:
evans --host localhost --port 9093 -r repl
evans-analyzer:
evans --host localhost --port 9094 -r repl
# Kubernetes / Helm
k8s-install:
@echo "Installing Codev42 to Kubernetes..."
cd deployments/codev42 && helm dependency update
helm install codev42 deployments/codev42 -n codev42 --create-namespace
k8s-upgrade:
@echo "Upgrading Codev42 ..."
helm upgrade codev42 deployments/codev42 -n codev42
k8s-uninstall:
@echo "Uninstalling Codev42 ..."
helm uninstall codev42 -n codev42
k8s-status:
@echo "Checking Codev42 status..."
kubectl get all -n codev42
k8s-logs-plan:
kubectl logs -f deployment/plan-service -n codev42
k8s-logs-impl:
kubectl logs -f deployment/implementation-service -n codev42
k8s-logs-diagram:
kubectl logs -f deployment/diagram-service -n codev42
k8s-logs-analyzer:
kubectl logs -f deployment/analyzer-service -n codev42
k8s-logs-gateway:
kubectl logs -f deployment/gin-gateway -n codev42
.PHONY: network postgres createdb dropdb migrateup migratedown migrateup1 migratedown1 new_migration db_docs db_schema sqlc test server mock proto proto-agent proto-plan proto-implementation proto-diagram proto-analyzer evans evans-plan evans-implementation evans-diagram evans-analyzer redis run-gateway run-agent run-plan run-implementation run-diagram run-analyzer run-all k8s-install k8s-upgrade k8s-uninstall k8s-status k8s-logs-plan k8s-logs-impl k8s-logs-diagram k8s-logs-analyzer k8s-logs-gateway