-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (40 loc) · 1.87 KB
/
Copy pathMakefile
File metadata and controls
55 lines (40 loc) · 1.87 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
GIT_HEAD = $(shell git rev-parse HEAD | head -c8)
LIMA_INSTANCE = wings
LIMA_CONFIG = $(CURDIR)/lima-wings.yaml
.PHONY: lima-create lima-setup lima-status lima-logs lima-stop lima-delete
lima-create:
limactl create --name=$(LIMA_INSTANCE) --tty=false $(LIMA_CONFIG)
limactl start $(LIMA_INSTANCE)
lima-setup:
chmod +x scripts/lima-setup.sh
./scripts/lima-setup.sh
lima-status:
@echo "Instance:"
@limactl list $(LIMA_INSTANCE) 2>/dev/null || echo " (not created — run: make lima-create)"
@echo ""
@limactl shell $(LIMA_INSTANCE) -- bash -c '\
echo "VM IP: $$(hostname -I | awk "{print \$$1}")"; \
echo "Wings: $$(systemctl is-active wings 2>/dev/null || echo not-installed)"; \
curl -sf http://127.0.0.1:8080/api/system 2>/dev/null | head -c 200 || echo "API: not reachable"' \
2>/dev/null || true
lima-logs:
limactl shell $(LIMA_INSTANCE) -- journalctl -u wings -n 50 --no-pager
lima-stop:
limactl stop $(LIMA_INSTANCE)
lima-delete:
limactl delete $(LIMA_INSTANCE) -f
build:
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -gcflags "all=-trimpath=$(pwd)" -o build/wings_linux_amd64 -v wings.go
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -gcflags "all=-trimpath=$(pwd)" -o build/wings_linux_arm64 -v wings.go
debug:
go build -ldflags="-X github.com/realmctl/wings/system.Version=$(GIT_HEAD)"
sudo ./wings --debug --ignore-certificate-errors --config config.yml --pprof --pprof-block-rate 1
# Runs a remotly debuggable session for Wings allowing an IDE to connect and target
# different breakpoints.
rmdebug:
go build -gcflags "all=-N -l" -ldflags="-X github.com/realmctl/wings/system.Version=$(GIT_HEAD)" -race
sudo dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./wings -- --debug --ignore-certificate-errors --config config.yml
cross-build: clean build compress
clean:
rm -rf build/wings_*
.PHONY: all build compress clean