2019-05-30 06:32:56 +00:00
|
|
|
.PHONY: all build clean format test gen-certs-go
|
2019-04-15 03:56:55 +00:00
|
|
|
|
2019-06-02 09:39:39 +00:00
|
|
|
docker: clean format install
|
2019-06-02 02:42:46 +00:00
|
|
|
docker-compose build
|
|
|
|
|
2019-06-02 09:39:39 +00:00
|
|
|
build: gen-certs-go
|
2019-06-01 20:32:11 +00:00
|
|
|
go build -mod=vendor -o ./bin/server ./cmd/server
|
|
|
|
rm ./cmd/server/certs.go
|
2019-05-06 00:56:27 +00:00
|
|
|
|
2019-04-15 03:56:55 +00:00
|
|
|
clean:
|
2019-06-02 09:39:39 +00:00
|
|
|
rm -rf ./bin ./vendor ./cmd/server/certs.go
|
2019-04-15 03:56:55 +00:00
|
|
|
|
2019-05-29 15:02:04 +00:00
|
|
|
local:
|
|
|
|
docker-compose up -d
|
|
|
|
|
2019-05-28 01:16:50 +00:00
|
|
|
up:
|
2019-05-29 15:02:04 +00:00
|
|
|
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
|
2019-04-15 03:56:55 +00:00
|
|
|
|
2019-05-28 01:16:50 +00:00
|
|
|
upd:
|
2019-05-29 15:02:04 +00:00
|
|
|
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
2019-05-28 01:16:50 +00:00
|
|
|
|
|
|
|
down:
|
|
|
|
docker-compose down
|
|
|
|
|
|
|
|
machine-create-google:
|
|
|
|
docker-machine create --driver google \
|
2019-05-29 15:02:04 +00:00
|
|
|
--google-address selfpass \
|
2019-05-28 01:16:50 +00:00
|
|
|
--google-project selfpass-241808 \
|
2019-06-02 02:42:46 +00:00
|
|
|
--google-machine-type g1-small \
|
2019-05-28 01:16:50 +00:00
|
|
|
--google-machine-image https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-9-stretch-v20190514 \
|
2019-05-29 15:02:04 +00:00
|
|
|
--google-username selfpass \
|
|
|
|
--google-zone us-west1-c \
|
2019-05-28 01:16:50 +00:00
|
|
|
selfpass01
|
2019-06-02 19:37:39 +00:00
|
|
|
$(MAKE) machine-put-redis.conf
|
|
|
|
$(MAKE) machine-put-data
|
|
|
|
$(MAKE) machine-install-stackdriver-agent
|
|
|
|
$(MAKE) machine-add-grpc-server-tag
|
2019-05-28 01:16:50 +00:00
|
|
|
|
|
|
|
machine-rm:
|
|
|
|
docker-machine rm selfpass01
|
|
|
|
|
2019-06-02 02:42:46 +00:00
|
|
|
machine-ssh:
|
|
|
|
docker-machine ssh selfpass01
|
|
|
|
|
|
|
|
machine-put-redis.conf:
|
|
|
|
docker-machine scp ./redis.conf selfpass01:redis.conf
|
|
|
|
|
|
|
|
machine-put-data:
|
|
|
|
docker-machine scp -r ./data selfpass01:
|
|
|
|
|
|
|
|
machine-get-data:
|
|
|
|
docker-machine scp -r selfpass01:data ./
|
|
|
|
|
|
|
|
machine-add-grpc-server-tag:
|
|
|
|
gcloud compute instances add-tags selfpass01 \
|
|
|
|
--zone us-west1-c \
|
|
|
|
--tags grpc-server
|
|
|
|
|
|
|
|
machine-install-stackdriver-agent:
|
|
|
|
docker-machine ssh selfpass01 "curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh && sudo bash install-monitoring-agent.sh"
|
|
|
|
|
2019-04-15 03:56:55 +00:00
|
|
|
format:
|
2019-05-22 15:22:40 +00:00
|
|
|
gofmt -w -s -l .
|
|
|
|
|
2019-06-01 20:32:11 +00:00
|
|
|
install:
|
|
|
|
go mod tidy
|
|
|
|
go mod vendor
|
|
|
|
|
2019-05-22 15:22:40 +00:00
|
|
|
install-spc:
|
|
|
|
go install ./cmd/spc
|
2019-04-15 03:56:55 +00:00
|
|
|
|
|
|
|
gen-protoc:
|
|
|
|
protoc --go_out=plugins=grpc:. \
|
|
|
|
./credentials/protobuf/service.proto
|
|
|
|
|
2019-05-06 00:56:27 +00:00
|
|
|
gen-csr-json:
|
|
|
|
mkdir certs
|
|
|
|
cd certs && cfssl print-defaults csr > csr.json
|
|
|
|
|
|
|
|
gen-ca:
|
|
|
|
cd certs && cfssl genkey -initca csr.json | cfssljson -bare ca
|
|
|
|
|
|
|
|
gen-server-cert:
|
|
|
|
cd certs && cfssl gencert -ca ca.pem -ca-key ca-key.pem csr.json | cfssljson -bare server
|
|
|
|
|
|
|
|
gen-client-cert:
|
|
|
|
cd certs && cfssl gencert -ca ca.pem -ca-key ca-key.pem csr.json | cfssljson -bare client
|
|
|
|
|
2019-05-28 01:16:50 +00:00
|
|
|
gen-certs-go:
|
|
|
|
./gen_certs_go.sh > ./cmd/server/certs.go
|
|
|
|
|
2019-04-15 03:56:55 +00:00
|
|
|
test:
|
|
|
|
go test -cover ./...
|