-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
63 lines (50 loc) · 2.45 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
.PHONY: genproto
.PHONY: build
.PHONY: upload
.PHONY: server-stop
.PHONY: server-start
.PHONY: test
.PHONY: pdf
UBIKOM_ONE_ADR = alpha.ubikom.cc
MAIL_SERVER_ADR = mail.ubikom.cc
SSH_KEY = $(HOME)/aws/ubikom-one.pem
ROOT_DIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GO_PROTO_DIR = $(ROOT_DIR)pb
genproto:
cd proto; protoc --go_out=$(GO_PROTO_DIR) *.proto
cd proto; protoc --go-grpc_out=$(GO_PROTO_DIR) *.proto
server-stop:
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl stop ubikom-web
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl stop ubikom-dump
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl stop ubikom-server
web-stop:
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl stop ubikom-web
upload:
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/ubikom-server ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/ubikom-server
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/ubikom-dump ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/ubikom-dump
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/ubikom-cli ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/ubikom-cli
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/ubikom-web ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/ubikom-web
scp -i $(SSH_KEY) $(ROOT_DIR)welcome/* ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/welcome
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/dbexport ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/dbexport
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/dbimport ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/dbimport
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/snap-print ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/snap-print
scp -i $(SSH_KEY) $(ROOT_DIR)config/supervisor/* ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/supervisor
web-upload:
scp -i $(SSH_KEY) $(ROOT_DIR)build/linux-amd64/ubikom-web ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/ubikom-web
scp -i $(SSH_KEY) $(ROOT_DIR)welcome/* ubuntu@$(UBIKOM_ONE_ADR):~/ubikom/welcome
server-start:
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl start ubikom-server
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl start ubikom-dump
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl start ubikom-web
web-start:
ssh -i $(SSH_KEY) ubuntu@$(UBIKOM_ONE_ADR) sudo supervisorctl start ubikom-web
build:
$(ROOT_DIR)scripts/build.sh
test:
go test -cover -timeout=30s ./...
cover:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
pdf:
mkdir -p $(ROOT_DIR)doc/pdf
cd $(ROOT_DIR)doc; for f in *.md ; do pandoc "$$f" -o "./pdf/$${f%.md}.pdf"; done