-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
127 lines (96 loc) · 4.19 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# TODO: clean-up makefile
GOOS=linux
GOPATH:=$(shell go env GOPATH)
CPUCOUNT:=$(shell grep -c ^processor /proc/cpuinfo)
GIT_COMMIT := $(shell git rev-list -1 HEAD)
.PHONY: dev
api:
nodemon --exec go run cmd/apiserver/main.go --signal SIGTERM
wrk:
nodemon --exec go run cmd/worker/main.go --signal SIGTERM
fs:
nodemon --exec go run cmd/fileserver/main.go --signal SIGTERM
test:
go clean -testcache
go test ./pkg/apiserver/... -v --parallel $(CPUCOUNT)
web-dev:
yarn --cwd ./web/ start
api-bin:
rm -rf build/apiserver
GOOS=$(GOOS) CGO_ENABLED=0 go build -ldflags "-X main.gitCommit=$(GIT_COMMIT)" \
-o build/apiserver/apiserver cmd/apiserver/main.go
worker-bin:
rm -rf build/worker
GOOS=$(GOOS) CGO_ENABLED=0 go build -ldflags "-X main.gitCommit=$(GIT_COMMIT)" \
-o build/worker/worker cmd/worker/main.go
fs-bin:
rm -rf build/fileserver
GOOS=$(GOOS) CGO_ENABLED=0 go build -ldflags "-X main.gitCommit=$(GIT_COMMIT)" \
-o build/fileserver/fileserver cmd/fileserver/main.go
fs-sync: fs-bin
docker build -t luqmansen/gosty-fileserver -f docker/fileserver.Dockerfile .
docker container rm fileserver-0 fileserver-1 fileserver-2 --force
docker-compose up -d fileserver-0 fileserver-1 fileserver-2
all-bin: api-bin worker-bin fs-bin
run:
docker-compose up
stop:
docker-compose -f docker-compose.yaml down
docker-base-worker:
docker build -t luqmansen/alpine-ffmpeg-mp4box -f docker/Dockerfile-alpine-ffmpeg-mp4box .
docker-web:
DOCKER_BUILDKIT=1 docker build -t luqmansen/gosty-web -f docker/web.Dockerfile .
docker push luqmansen/gosty-web
push-docker-web-local:
yarn --cwd ./web/ build
docker build -t localhost:5000/gosty-web-dev -f docker/web.dev.Dockerfile .
docker push localhost:5000/gosty-web-dev
restart-docker-web-local:
echo "y" | docker-compose rm -s web
docker-compose up -d web
docker-worker: worker-bin
docker build -t luqmansen/gosty-worker -f docker/worker.Dockerfile .
docker push luqmansen/gosty-worker
push-docker-worker-local: worker-bin
docker build -t localhost:5000/gosty-worker -f docker/worker.Dockerfile .
docker push localhost:5000/gosty-worker
restart-docker-worker-local:
echo "y" | docker-compose rm -s worker
docker-compose up --scale worker=1 -d worker
docker-fs: fs-bin
docker build -t luqmansen/gosty-fileserver -f docker/fileserver.Dockerfile .
docker push luqmansen/gosty-fileserver
push-docker-fs-local: fs-bin
docker build -t localhost:5000/gosty-fileserver -f docker/fileserver.Dockerfile .
docker push localhost:5000/gosty-fileserver
restart-docker-fs-local: push-docker-fs-local
echo "y" | docker-compose rm -s fileserver
docker-compose up -d fileserver
docker-minikube: api-bin fs-bin worker-bin
eval $(minikube -p minikube docker-env)
yarn --cwd ./web/ build
docker build -t gosty-web -f docker/web.dev.Dockerfile .
docker build -t gosty-worker -f docker/worker.Dockerfile .
docker build -t gosty-fileserver -f docker/fileserver.Dockerfile .
docker build -t gosty-apiserver -f docker/apiserver.Dockerfile .
docker-api: api-bin
docker build -t luqmansen/gosty-apiserver -f docker/apiserver.Dockerfile .
push-docker-api-local: api-bin
docker build -t localhost:5000/gosty-apiserver -f docker/apiserver.Dockerfile .
docker push localhost:5000/gosty-apiserver
restart-docker-api-local: push-docker-api-local
echo "y" | docker-compose rm -s apiserver
docker-compose up -d apiserver
push-all: docker-api docker-fs docker-worker docker-web
push-all-local: push-docker-api-local push-docker-fs-local push-docker-worker-local push-docker-web-local
restart-all-local: restart-docker-api-local restart-docker-fs-local restart-docker-worker-local restart-docker-web-local
generate-mock:
mockgen --destination=mock/pkg/apiserver/repositories/rabbitmq/mock_rabbit.go --package mock_rabbitmq --source=pkg/apiserver/repositories/messaging.go
rollout-restart:
# sometimes rabbitmq randomly wont start
kubectl rollout restart statefulset -n gosty rabbit-rabbitmq
# sometimes i forgot to repush all the stuff to local registry
# happens if you use local registry and frequently need to stop the minikube
kubectl rollout restart -f k8s/gosty/gosty-apiserver.yaml
kubectl rollout restart -f k8s/gosty/gosty-worker.yaml
kubectl rollout restart -f k8s/gosty/gosty-web.yaml