-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.example
79 lines (66 loc) · 2.3 KB
/
Makefile.example
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
STRIPE_SECRET=
STRIPE_KEY=
SECRET_KEY=
SMTP_USERNAME=
SMTP_PASSWORD=
WEB_PORT=4000
API_PORT=4001
## build: builds all binaries
build: clean build_front build_back
@printf "All binaries built!\n"
## clean: cleans all binaries and runs go clean
clean:
@echo "Cleaning..."
@- rm -f dist/*
@go clean
@echo "Cleaned!"
## build_front: builds the front end
build_front:
@echo "Building front end..."
@go build -o dist/gostripe ./cmd/web
@echo "Front end built!"
## build_back: builds the back end
build_back:
@echo "Building back end..."
@go build -o dist/gostripe_api ./cmd/api
@echo "Back end built!"
## build_invoice: builds the invoice microservice
build_invoice:
@echo "Building invoice microservice..."
@go build -o dist/invoice ./cmd/micro/invoice
@echo "Invoice microservice built!"
## start: starts front, back end and invoice microservice
start: start_front start_back start_invoice
## start_front: starts the front end
start_front: build_front
@echo "Starting the front end..."
@env STRIPE_KEY=${STRIPE_KEY} STRIPE_SECRET=${STRIPE_SECRET} SECRET_KEY=${SECRET_KEY} ./dist/gostripe -port=${WEB_PORT} &
@echo "Front end running!"
## start_back: starts the back end
start_back: build_back
@echo "Starting the back end..."
@env STRIPE_KEY=${STRIPE_KEY} STRIPE_SECRET=${STRIPE_SECRET} SECRET_KEY=${SECRET_KEY} SMTP_USERNAME=${SMTP_USERNAME} SMTP_PASSWORD=${SMTP_PASSWORD} ./dist/gostripe_api -port=${API_PORT} &
@echo "Back end running!"
## start_invoice: starts the invoice microservice
start_invoice: build_invoice
@echo "Starting the invoice microservice..."
@env SMTP_USERNAME=${SMTP_USERNAME} SMTP_PASSWORD=${SMTP_PASSWORD} ./dist/invoice &
@echo "Invoice microservice running!"
## stop: stops the front, back end and invoice microservice
stop: stop_front stop_back stop_invoice
@echo "All applications stopped"
## stop_front: stops the front end
stop_front:
@echo "Stopping the front end..."
@-pkill -SIGTERM -f "gostripe -port=${WEB_PORT}"
@echo "Stopped front end"
## stop_back: stops the back end
stop_back:
@echo "Stopping the back end..."
@-pkill -SIGTERM -f "gostripe_api -port=${API_PORT}"
@echo "Stopped back end"
## stop_invoice: stops the invoice microservice
stop_invoice:
@echo "Stopping the invoice microservice..."
@-pkill -SIGTERM -f "invoice"
@echo "Stopped invoice microservice"