-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (81 loc) · 2.81 KB
/
Makefile
File metadata and controls
98 lines (81 loc) · 2.81 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
PREFIX ?= /opt/ttstack
CARGO ?= cargo
CARGO_FLAG ?=
.PHONY: all build release test lint fmt fmt-check doc clean \
install uninstall deploy-agent deploy-ctl deploy deploy-dist help
all: fmt lint build test
## Build debug binaries
build:
$(CARGO) build $(CARGO_FLAG)
## Build optimized release binaries
release:
$(CARGO) build --release $(CARGO_FLAG)
## Run all tests
test:
$(CARGO) test $(CARGO_FLAG)
## Run clippy linter (treat warnings as errors)
lint:
$(CARGO) clippy $(CARGO_FLAG) -- -D warnings
## Format code
fmt:
$(CARGO) fmt
## Check formatting without modifying
fmt-check:
$(CARGO) fmt -- --check
## Generate API documentation
doc:
$(CARGO) doc --no-deps --document-private-items $(CARGO_FLAG)
## Remove build artifacts
clean:
$(CARGO) clean
## Install release binaries to PREFIX/bin (no systemd setup)
install: release
@mkdir -p $(PREFIX)/bin
install -m 755 target/release/tt $(PREFIX)/bin/tt
install -m 755 target/release/tt-ctl $(PREFIX)/bin/tt-ctl
install -m 755 target/release/tt-agent $(PREFIX)/bin/tt-agent
@echo "Installed to $(PREFIX)/bin/"
## Remove installed binaries
uninstall:
rm -f $(PREFIX)/bin/tt $(PREFIX)/bin/tt-ctl $(PREFIX)/bin/tt-agent
## Deploy tt-agent on this host (requires root, idempotent)
deploy-agent: release
sudo target/release/tt deploy agent
## Deploy tt-ctl (controller + web UI) on this host (requires root, idempotent)
deploy-ctl: release
sudo target/release/tt deploy ctl
## Deploy both agent and controller on this host
deploy: release
sudo target/release/tt deploy all
## Distributed deploy to all hosts in deploy.toml (via SSH)
deploy-dist: release
target/release/tt deploy dist deploy.toml
## Show available targets
help:
@echo "TTstack build targets:"
@echo ""
@echo " Development:"
@echo " make build Debug build"
@echo " make release Optimized release build"
@echo " make test Run all tests"
@echo " make lint Run clippy"
@echo " make fmt Format code"
@echo " make doc Generate docs"
@echo " make clean Remove build artifacts"
@echo ""
@echo " Installation:"
@echo " make install Copy binaries to $(PREFIX)/bin/"
@echo " make uninstall Remove installed binaries"
@echo ""
@echo " Deployment (local, requires root, idempotent):"
@echo " make deploy-agent Deploy tt-agent on this host"
@echo " make deploy-ctl Deploy tt-ctl + web UI on this host"
@echo " make deploy Deploy both on this host"
@echo ""
@echo " Deployment (distributed, via SSH):"
@echo " make deploy-dist Deploy to fleet (reads deploy.toml)"
@echo ""
@echo " Images (auto-generate guest images):"
@echo " tt image recipes List available image recipes"
@echo " tt image create <name> [--image-dir DIR]"
@echo " tt image create all --engine docker"