forked from AleksK1NG/Go-Kafka-gRPC-MongoDB-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (64 loc) · 2.24 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
.PHONY:
# ==============================================================================
# Docker
develop:
echo "Starting develop docker compose"
docker-compose -f docker-compose.yml up --build
local:
echo "Starting local docker compose"
docker-compose -f docker-compose.local.yml up --build
upload:
docker build -t alexanderbryksin/products_microservice:latest -f ./Dockerfile .
docker push alexanderbryksin/products_microservice:latest
#APP_VERSION=latest docker-compose up
pull:
sudo docker pull alexanderbryksin/products_microservice:latest
crate_topics:
docker exec -it kafka1 kafka-topics --zookeeper zookeeper:2181 --create --topic create-product --partitions 3 --replication-factor 2
docker exec -it kafka1 kafka-topics --zookeeper zookeeper:2181 --create --topic update-product --partitions 3 --replication-factor 2
docker exec -it kafka1 kafka-topics --zookeeper zookeeper:2181 --create --topic dead-letter-queue --partitions 3 --replication-factor 2
# ==============================================================================
# Modules support
deps-reset:
git checkout -- go.mod
go mod tidy
go mod vendor
tidy:
go mod tidy
go mod vendor
deps-upgrade:
# go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
go get -u -t -d -v ./...
go mod tidy
go mod vendor
deps-cleancache:
go clean -modcache
# ==============================================================================
# Linters
run-linter:
echo "Starting linters"
golangci-lint run ./...
# ==============================================================================
# Docker support
FILES := $(shell docker ps -aq)
down-local:
docker stop $(FILES)
docker rm $(FILES)
clean:
docker system prune -f
logs-local:
docker logs -f $(FILES)
# ==============================================================================
# Make local SSL Certificate
cert:
echo "Generating SSL certificates"
cd ./ssl && sh instructions.sh
# ==============================================================================
# Swagger
swagger:
echo "Starting swagger generating"
swag init -g **/**/*.go
# ==============================================================================
# MongoDB
mongo:
cd ./scripts && mongo admin -u admin -p admin < init.js