-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (66 loc) · 2.51 KB
/
Makefile
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
include .envrc
# ==================================================================================== #
# PROTOBUF
# ==================================================================================== #
# Define the paths
PROTO_DIR := proto
AUTHENTICATION_PROTO := $(PROTO_DIR)/authenticationservice/authentication.proto
RIDER_PROTO := $(PROTO_DIR)/riderservice/rider.proto
SMS_NOTIFICATION_PROTO := $(PROTO_DIR)/smsnotificationservice/smsnotification.proto
GATEWAY_PROTO := $(PROTO_DIR)/gatewayservice/gateway.proto
AUTHENTICATION_OUT_DIR := authenticationservice/genproto
RIDER_OUT_DIR := riderservice/genproto
SMS_NOTIFICATION_OUT_DIR := smsnotificationservice/genproto
GATEWAY_OUT_DIR := gatewayservice/genproto
# Check if output directories exist, if not create them
.PHONY: create_dirs
create_dirs:
@mkdir -p $(AUTHENTICATION_OUT_DIR)
@mkdir -p $(RIDER_OUT_DIR)
@mkdir -p $(SMS_NOTIFICATION_OUT_DIR)
@mkdir -p $(GATEWAY_OUT_DIR)
# Define the protoc command
PROTOC := protoc
PROTOC_GEN_GO := protoc-gen-go
PROTOC_GEN_GRPC_GO := protoc-gen-go-grpc
# Generate the protobuf files
.PHONY: proto
proto: create_dirs authentication_proto rider_proto sms_notification_proto gateway_proto
authentication_proto: $(AUTHENTICATION_PROTO)
$(PROTOC) --go_out=. --go-grpc_out=. $(AUTHENTICATION_PROTO)
rider_proto: $(RIDER_PROTO)
$(PROTOC) --go_out=. --go-grpc_out=. $(RIDER_PROTO)
sms_notification_proto: $(SMS_NOTIFICATION_PROTO)
$(PROTOC) --go_out=. --go-grpc_out=. $(SMS_NOTIFICATION_PROTO)
gateway_proto: $(GATEWAY_PROTO)
$(PROTOC) --go_out=. --go-grpc_out=. $(GATEWAY_PROTO)
# Clean the generated files
.PHONY: clean
clean:
rm -f $(AUTHENTICATION_OUT_DIR)/*.pb.go
rm -f $(RIDER_OUT_DIR)/*.pb.go
rm -f $(SMS_NOTIFICATION_OUT_DIR)/*.pb.go
rm -f $(GATEWAY_OUT_DIR)/*.pb.go
# ==================================================================================== #
# DEVELOPMENT
# ==================================================================================== #
# Run the rider service
.PHONY: rider
rider:
@go run riderservice/cmd/*.go
# Run the authentication service
.PHONY: authentication
authentication:
@go run authenticationservice/cmd/*.go
# Run the sms notification service
.PHONY: sms
sms:
@go run smsnotificationservice/cmd/*.go
# Run the gateway service
.PHONY: gateway
gateway:
@go run gatewayservice/cmd/*.go
# Run Hashicorp Consul locally
.PHONY: consul
consul:
docker run -d -p 8500:8500 -p 8600:8600/udp --name=ridewise-dev-consul hashicorp/consul agent -server -ui -node=server-1 -bootstrap-expect=1 -client=0.0.0.0