-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (69 loc) · 2.18 KB
/
Copy pathMakefile
File metadata and controls
84 lines (69 loc) · 2.18 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
71
72
73
74
75
76
77
78
79
80
81
82
83
.PHONY: s bootstrap build dev-up dev-down svr-up svr-down dev-api docs localstack logs test clean
# ---------------------------------------------------------------------------
# Docker Compose — all service files merged via -f flags
# ---------------------------------------------------------------------------
COMPOSE = docker compose --project-directory . \
-f docker/network.yaml \
-f docker/dns.yaml \
-f docker/postgres.yaml \
-f docker/pgadmin.yaml \
-f docker/redis.yaml \
-f docker/keycloak.yaml \
-f docker/casdoor.yaml \
-f docker/mailserver.yaml \
-f docker/roundcube.yaml \
-f docker/server.yaml \
-f docker/swagger.yaml \
-f docker/godoc.yaml \
-f docker/localstack.yaml
# Git shortcut
s:
git add .
commit-emoji
git push origin main
# Build binaries into .bin/
build:
mkdir -p .bin
go build -o .bin/admin-client ./cmd/client/admin
go build -o .bin/app-client ./cmd/client/app
go build -o .bin/anonymous-client ./cmd/client/anonymous
go build -o .bin/server ./cmd/server
# Development environment (core infra + IdP + mail; server excluded)
dev-up:
$(COMPOSE) up -d postgres redis pgadmin \
keycloak \
casdoor \
dns mailserver roundcube
dev-down:
$(COMPOSE) down -v --remove-orphans
# App server container (build image and start, dependencies unchanged)
svr-up:
$(COMPOSE) up -d --build --no-deps server
# Stop and remove the app server container only
svr-down:
$(COMPOSE) stop server
$(COMPOSE) rm -f -v server
# Documentation (swagger-ui + godoc)
docs:
$(COMPOSE) up -d swagger-ui godoc
@echo "Swagger UI: http://localhost:3002"
@echo "Go Docs: http://localhost:3003"
# AWS mock (localstack)
localstack:
$(COMPOSE) up -d localstack
# Logs (pass SERVICE= to filter, e.g. make logs SERVICE=postgres)
logs:
$(COMPOSE) logs -f $(SERVICE)
# Seed pg_groups table with Casdoor group UUID <-> display name mapping.
# Run AFTER dev-up (server must have created the table via GORM auto-migrate).
dev-seed:
docker compose --project-directory . -f docker/postgres.yaml \
exec -T postgres psql -U user -d cmn_core \
< scripts/data/postgres/seed_groups.sql
# Tests
test:
go test ./...
test-unit:
go test ./test/unit/...
clean:
rm -f coverage.out coverage.html