-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (51 loc) · 1.61 KB
/
Copy pathMakefile
File metadata and controls
67 lines (51 loc) · 1.61 KB
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
.PHONY: proto docker-up docker-down tidy install-proto-tools migrate-up migrate-down migrate-create
# Install protoc tools
install-proto-tools:
@echo "Installing protoc and Go plugins..."
sudo apt update && sudo apt install -y protobuf-compiler golang-go
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
@echo "Done! Make sure ~/go/bin is in your PATH"
# Generate Go code from proto files
proto:
@echo "Generating Go code from protos..."
PATH="$$PATH:$$HOME/go/bin" protoc \
--go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/developer/developer.proto \
proto/user/user.proto \
proto/token/token.proto
@echo "Done!"
# Start all services
docker-up:
docker-compose up -d
# Stop all services
docker-down:
docker-compose down
# Clean up volumes
docker-clean:
docker-compose down -v
# Tidy Go modules
tidy:
go mod tidy
# Run services
run-gateway:
go run ./services/api-gateway
run-developer:
go run ./services/developer-service
run-user:
go run ./services/user-service
run-token:
go run ./services/token-service
# Database URL
DB_URL ?= postgres://authservice:authservice@localhost:5432/authservice?sslmode=disable
# Database migrations
migrate-up:
migrate -path migrations -database "$(DB_URL)" up
migrate-down:
migrate -path migrations -database "$(DB_URL)" down 1
migrate-create:
@read -p "Migration name: " name; \
migrate create -ext sql -dir migrations -seq $$name
install-migrate:
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest