-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (49 loc) · 1.43 KB
/
Copy pathMakefile
File metadata and controls
70 lines (49 loc) · 1.43 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
67
68
69
70
.PHONY: up down logs migrate migrate-down sqlc run test test-unit test-integration tidy \
deploy deploy-build deploy-infra deploy-api down-infra down-api logs-api up-deps
-include .env
export
COMPOSE_INFRA := docker compose -f docker-compose.infra.yml
COMPOSE_API := docker compose -f docker-compose.api.yml
up:
docker compose up -d
# Postgres + Redis only (local; API on host with `make run`)
up-deps:
docker compose up -d postgres redis
# Local all-in-one
deploy:
docker compose up -d --build
deploy-build:
docker compose build api
# Dedicated data server (Postgres + Redis)
deploy-infra:
$(COMPOSE_INFRA) up -d
down-infra:
$(COMPOSE_INFRA) down
# API server only (uses DATABASE_URL + REDIS_URL from .env)
deploy-api:
$(COMPOSE_API) up -d --build
down-api:
$(COMPOSE_API) down
down:
docker compose down
logs:
docker compose logs -f
logs-api:
$(COMPOSE_API) logs -f api
migrate:
go run -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.18.3 \
-path db/migrations -database "$(DATABASE_URL)" up
migrate-down:
go run -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.18.3 \
-path db/migrations -database "$(DATABASE_URL)" down 1
sqlc:
go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.28.0 generate
run:
go run ./cmd/api
test: test-unit test-integration
test-unit:
go test ./internal/... -count=1
test-integration:
go test ./tests/integration/... -count=1 -timeout 120s
tidy:
go mod tidy