-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMakefile
104 lines (72 loc) · 2.49 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
.PHONY:
# ==============================================================================
# Docker
develop:
@echo Starting develop docker compose
docker-compose -f docker-compose.yaml up --build
local:
@echo Starting develop docker compose
docker-compose -f docker-compose.local.yaml up --build
upload:
docker build -t alexanderbryksin/stan_microservice:latest -f ./Dockerfile .
docker push alexanderbryksin/stan_microservice:latest
#APP_VERSION=latest docker-compose up
pull:
docker pull alexanderbryksin/stan_microservice:latest
# ==============================================================================
# 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
cd ..
cd ./nginx && openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nginx-selfsigned.key -out nginx-selfsigned.crt
# ==============================================================================
# Go migrate postgresql
DB_NAME = mails_db
DB_HOST = localhost
DB_PORT = 5432
SSL_MODE = disable
force_db:
migrate -database postgres://postgres:postgres@$(DB_HOST):$(DB_PORT)/$(DB_NAME)?sslmode=$(SSL_MODE) -path migrations force 1
version_db:
migrate -database postgres://postgres:postgres@$(DB_HOST):$(DB_PORT)/$(DB_NAME)?sslmode=$(SSL_MODE) -path migrations version
migrate_up:
migrate -database postgres://postgres:postgres@$(DB_HOST):$(DB_PORT)/$(DB_NAME)?sslmode=$(SSL_MODE) -path migrations up 1
migrate_down:
migrate -database postgres://postgres:postgres@$(DB_HOST):$(DB_PORT)/$(DB_NAME)?sslmode=$(SSL_MODE) -path migrations down 1
# ==============================================================================
# Swagger
swagger:
@echo Starting swagger generating
swag init -g **/**/*.go