-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
106 lines (77 loc) · 2.17 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.PHONY: setup-db recreate-db build run
create-all-db:
createdb yaes-dev
createdb yaes-test
createdb yaes
setup-db:
createdb ${DB_NAME}
${MAKE} migrate
recreate-db:
dropdb ${DB_NAME}
createdb ${DB_NAME}
${MAKE} migrate
setup: setup-db
dep ensure
build:
go build ./cmd/server
migrate:
go run ./cmd/migration
linux:
GOOS=linux CGO_ENABLED=0 go build ./cmd/server
prod-build: GO_APP_ENV = production
prod-build: build
run: PORT = 3000
run:
go run ./cmd/server/main.go
prod-run: GO_APP_ENV = production
prod-run: run
dev-setup:
go get github.com/codegangsta/gin
dev-run:
gin --build ./cmd/server
setup-docs:
go get -v -u github.com/go-swagger/go-swagger/cmd/swagger
docs:
swagger serve api-docs/swagger.yml
test: DB_NAME = yaes-test
test: recreate-db
go generate ./...
GO_APP_ENV="test" go test -v ./...
bench: DB_NAME = yaes-test
bench: recreate-db
go generate ./...
GO_APP_ENV="test" go test -bench=. -v ./...
ci-test:
go generate ./...
GO_APP_ENV="test" go test -v ./...
k8s-deploy:
./devops/k8s/setup.sh
./devops/k8s/up.sh
k8s-remove:
./devops/k8s/down.sh
./devops/k8s/teardown.sh
k8s-reapply-svc:
kubectl delete -f devops/k8s/service.yaml
kubectl apply -f devops/k8s/service.yaml
k8s-deploy-dashboard:
./devops/k8s/third-party/dashboard/up.sh
k8s-remove-dashboard:
./devops/k8s/third-party/dashboard/down.sh
k8s-proxy:
kubectl proxy
k8s-open-dashboard:
open http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy
k8s-get-dashboard-token:
./devops/k8s/third-party/dashboard/scripts/get-token.sh
# username: admin
# password: prom-operator
kctl-pf-grafana:
kubectl port-forward svc/monitoring-grafana 20000:80 -n monitoring
kctl-pf-prometheus:
kubectl port-forward svc/monitoring-prometheus-oper-prometheus 9090 -n monitoring
# export POSTGRES_PASSWORD=$(kubectl get secret --namespace default yaes-db-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
# PGPASSWORD="$POSTGRES_PASSWORD" psql postgres://yaesuser@localhost:5433/yaes?sslmode=disable
kctl-pf-postgres:
kubectl port-forward --namespace default svc/yaes-db-postgresql 5433:5432
kctl-logs-yaes:
kubectl logs -f -l app=yaes