-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (91 loc) · 3.47 KB
/
Copy pathMakefile
File metadata and controls
117 lines (91 loc) · 3.47 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
.PHONY: all build run test test-xinchuang-lifecycle clean docker-up docker-down docker-logs install-backend install-agent install-web fmt lint db-migrate
all: install-backend install-agent install-web
install-backend:
cd backend && go mod download && go mod tidy
install-agent:
cd agent && go mod download && go mod tidy
install-web:
cd frontend && npm install
build: build-backend build-agent build-web
build-backend:
make -C backend build
build-agent:
make -C agent build
build-web:
make -C frontend build
run: run-backend run-agent run-web
run-backend:
cd backend && go run ./cmd/main.go
run-agent:
cd agent && go run ./cmd/main.go
run-web:
cd frontend && npm run dev
test: test-backend test-agent
test-backend:
make -C backend test
test-agent:
make -C agent test
test-xinchuang-lifecycle:
cd agent && go test ./internal/executor -run '^(TestOceanBase|TestTiDB|TestDameng|TestKingbase|TestOpenGauss|TestGBase8a|TestGBase8s)' -count=1
cd backend && go test ./internal/plugins/kernel -run '^TestXinchuangCoreBase' -count=1
cd backend && go test ./internal/services -run 'Test.*(Capability|Refused|Rejects)' -count=1
cd frontend && npm test -- --run src/services/flavorCapability.test.ts
docker-up:
@echo "docker-compose.dev.yml not in repo; use bin/*/start-all.sh or add compose file"
@exit 1
docker-down:
@echo "docker-compose.dev.yml not in repo"
@exit 1
docker-logs:
@echo "docker-compose.dev.yml not in repo"
@exit 1
clean:
make -C backend clean
make -C agent clean
make -C frontend clean
fmt:
cd backend && go fmt ./...
cd agent && go fmt ./...
lint:
cd backend && golangci-lint run
cd agent && golangci-lint run
db-migrate:
cd backend && go run ./cmd/main.go migrate
dist: build-backend build-agent build-web
rm -rf dist && mkdir -p dist/bin dist/config dist/scripts
cp backend/bin/platform dist/bin/dbops-backend
cp agent/bin/agent dist/bin/dbops-agent
cp -r backend/config/*.yaml dist/config/ 2>/dev/null || true
cp -r bin dist/scripts/bin 2>/dev/null || true
cp frontend/build dist/web -r 2>/dev/null || cp -r frontend/dist dist/web 2>/dev/null || true
tar -czf dbops-offline-$(shell date +%Y%m%d).tar.gz dist/
@echo "Offline package: dbops-offline-$(shell date +%Y%m%d).tar.gz"
upgrade: build-backend build-agent
@echo "=== DBOps Platform Upgrade ==="
@echo "Stopping services..."
scripts/stop.sh || true
@echo "Installing new binaries..."
cp backend/bin/platform /usr/local/bin/dbops-backend 2>/dev/null || true
cp agent/bin/agent /usr/local/bin/dbops-agent 2>/dev/null || true
@echo "Running DB migrations..."
cd backend && go run ./cmd/main.go migrate 2>/dev/null || true
@echo "Starting services..."
scripts/start.sh || true
@echo "=== Upgrade complete ==="
help:
@echo "MySQL Ops Platform Makefile"
@echo ""
@echo "Usage:"
@echo " make install-backend Install backend dependencies"
@echo " make install-agent Install agent dependencies"
@echo " make install-web Install web console dependencies"
@echo " make build Build all components"
@echo " make dist Build offline install package"
@echo " make upgrade One-click platform upgrade"
@echo " make run Run all components"
@echo " make test Run tests"
@echo " make docker-up Start Docker services"
@echo " make docker-down Stop Docker services"
@echo " make clean Clean build artifacts"
@echo " make fmt Format code"
@echo " make lint Run linters"