-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
217 lines (198 loc) · 8.6 KB
/
Copy pathMakefile
File metadata and controls
217 lines (198 loc) · 8.6 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
SHELL := /bin/bash
.DEFAULT_GOAL := help
DOCKER ?= docker
IMAGE ?= pdparchitect/buzznode:local
CONTAINER ?= buzznode
NATIVE_ARCH := $(shell uname -m | sed \
-e 's/^x86_64$$/amd64/' \
-e 's/^aarch64$$/arm64/')
PLATFORM ?= linux/$(NATIVE_ARCH)
TARGETARCH ?= $(word 2,$(subst /, ,$(PLATFORM)))
BUZZ_VERSION ?= 0.5.4
BUZZ_RELEASE_TAG ?= desktop-v0.5.4
BUZZ_DEB_SHA256 ?= 9c2f0df4589c08698dd940e09d911884a5468c35169d1068fc6ccc93012bfeff
BUZZ_SOURCE_SHA ?= 651f6372754e60e3f936b3397040eb0f1e44c9f3
DESKTOP_IMAGE ?= ghcr.io/pdparchitect/launcher-image-base-desktop:0.1.9
CODEX_VERSION ?= 0.146.0
CLAUDE_CODE_VERSION ?= 2.1.221
CODEX_ACP_VERSION ?= 1.1.9
CLAUDE_ACP_VERSION ?= 0.64.2
GOOSE_VERSION ?= 1.45.0
GOOSE_AMD64_SHA256 ?= e0db638ac437ca0a60b0c1622f45322608d228d1a285214c3bf48fd9763346a5
GOOSE_ARM64_SHA256 ?= c9894106c90e404ac8b8d67c628aea2943dd6a1bc83bfd8e2171d482fa43d72a
BIND_ADDRESS ?= 127.0.0.1
PORT ?= 6904
RELAY_URL ?=
BUZZ_NETWORK ?=
VNC_STATS ?= false
VOLUME_PREFIX ?= buzznode
# Pass render nodes only. `--device=/dev/dri` would also hand over card*, the
# DRM master/modesetting node, which nothing in this container has a use for.
GPU_DEVICE := $(shell for node in /dev/dri/renderD*; do \
[ -e "$$node" ] && echo "--device=$$node"; done)
RELAY_ENV := $(if $(strip $(RELAY_URL)),--env "BUZZ_RELAY_URL=$(RELAY_URL)",)
NETWORK_ARG := $(if $(strip $(BUZZ_NETWORK)),--network "$(BUZZ_NETWORK)",)
.PHONY: help check build network run recreate up test smoke connection-test stop logs vnc-log status url size-report
help:
@echo "Buzznode local Docker workflow"
@echo
@echo " make check Validate scripts, tests, and pinned metadata"
@echo " make build Build $(IMAGE)"
@echo " make run Start or create the Buzznode container"
@echo " make recreate Recreate the container without rebuilding"
@echo " make up Build and recreate the container"
@echo " make test Check, build, run, and smoke-test the environment"
@echo " make smoke Test the node desktop and headless agent tools"
@echo " make connection-test Test the configured external Buzz relay"
@echo " make logs Follow container logs"
@echo " make vnc-log Follow the KasmVNC session log"
@echo " make status Show container and node status"
@echo " make stop Stop and remove the container"
@echo " make url Print the local desktop URL"
@echo " make size-report Report the graphical stack's share of the image"
@echo
@echo "Overrides: PORT=8080 RELAY_URL=wss://buzz.example"
@echo " PLATFORM=linux/arm64 (default: $(PLATFORM))"
@echo " BUZZ_NETWORK=buzz-local VNC_STATS=true"
check:
bash -n \
overlay/etc/desktop/session.d/10-buzznode-harness \
overlay/etc/desktop/startup.d/05-agent-runtime-trust \
overlay/usr/local/bin/agent-runtime-login \
overlay/usr/local/bin/buzznode \
overlay/usr/local/bin/buzznode-greeting \
overlay/usr/local/bin/desktop-panel-status \
overlay/usr/local/bin/desktop-welcome \
tests/test-agent-runtime-login.sh tests/test-buzznode.sh \
tests/test-desktop-theme.sh tests/smoke-container.sh
bash tests/test-agent-runtime-login.sh
bash tests/test-buzznode.sh
bash tests/test-desktop-theme.sh
@grep -q "^ARG DESKTOP_IMAGE=$(DESKTOP_IMAGE)$$" Dockerfile
@grep -q "^ARG BUZZ_VERSION=$(BUZZ_VERSION)$$" Dockerfile
@grep -q "^ARG BUZZ_RELEASE_TAG=$(BUZZ_RELEASE_TAG)$$" Dockerfile
@grep -q "^ARG BUZZ_DEB_SHA256=$(BUZZ_DEB_SHA256)$$" Dockerfile
@grep -q "^ARG BUZZ_SOURCE_SHA=$(BUZZ_SOURCE_SHA)$$" Dockerfile
@grep -q "^ARG CODEX_VERSION=$(CODEX_VERSION)$$" Dockerfile
@grep -q "^ARG CLAUDE_CODE_VERSION=$(CLAUDE_CODE_VERSION)$$" Dockerfile
@grep -q "^ARG CODEX_ACP_VERSION=$(CODEX_ACP_VERSION)$$" Dockerfile
@grep -q "^ARG CLAUDE_ACP_VERSION=$(CLAUDE_ACP_VERSION)$$" Dockerfile
@grep -q "^ARG GOOSE_VERSION=$(GOOSE_VERSION)$$" Dockerfile
@grep -q "^ARG GOOSE_AMD64_SHA256=$(GOOSE_AMD64_SHA256)$$" Dockerfile
@grep -q "^ARG GOOSE_ARM64_SHA256=$(GOOSE_ARM64_SHA256)$$" Dockerfile
@grep -q 'RUN kasm-patch "Buzznode"' Dockerfile
@grep -q 'cd /workspace' overlay/etc/bash.bashrc.d/buzznode-prompt.sh
@grep -q 'BUZZNODE_CODEX_SANDBOX_MODE' overlay/etc/desktop/startup.d/05-agent-runtime-trust
@grep -q 'BUZZNODE_CODEX_SANDBOX_MODE' README.md
@grep -q '\[ -n "$${PS1:-}" \]' overlay/etc/bash.bashrc.d/buzznode-prompt.sh
@test "$$(jq -er '.schemaVersion' launcher/application.json)" = 2
@! jq -e 'has("image")' launcher/application.json >/dev/null
@jq -e '.interfaces.health.kind == "health" and .interfaces.health.port == 6902 and .interfaces.health.path == "/healthz"' launcher/application.json >/dev/null
@jq -e '.interfaces.notifications.kind == "notifications" and .interfaces.notifications.port == 6902 and .interfaces.notifications.path == "/notifications"' launcher/application.json >/dev/null
@jq -e '.interfaces.preview.kind == "preview" and .interfaces.preview.port == 6902 and .interfaces.preview.path == "/preview.jpg"' launcher/application.json >/dev/null
@for asset in $$(jq -er '.media.icon, .media.cover, .media.screenshots[].source' launcher/application.json); do \
test -f "launcher/$$asset"; \
done
@echo "Buzznode metadata, setup CLI, and shell syntax are valid."
build:
$(DOCKER) build \
--platform "$(PLATFORM)" \
--build-arg "TARGETARCH=$(TARGETARCH)" \
--build-arg "DESKTOP_IMAGE=$(DESKTOP_IMAGE)" \
--build-arg "BUZZ_VERSION=$(BUZZ_VERSION)" \
--build-arg "BUZZ_RELEASE_TAG=$(BUZZ_RELEASE_TAG)" \
--build-arg "BUZZ_DEB_SHA256=$(BUZZ_DEB_SHA256)" \
--build-arg "BUZZ_SOURCE_SHA=$(BUZZ_SOURCE_SHA)" \
--build-arg "CODEX_VERSION=$(CODEX_VERSION)" \
--build-arg "CLAUDE_CODE_VERSION=$(CLAUDE_CODE_VERSION)" \
--build-arg "CODEX_ACP_VERSION=$(CODEX_ACP_VERSION)" \
--build-arg "CLAUDE_ACP_VERSION=$(CLAUDE_ACP_VERSION)" \
--build-arg "GOOSE_VERSION=$(GOOSE_VERSION)" \
--build-arg "GOOSE_AMD64_SHA256=$(GOOSE_AMD64_SHA256)" \
--build-arg "GOOSE_ARM64_SHA256=$(GOOSE_ARM64_SHA256)" \
--tag "$(IMAGE)" \
.
network:
@if [ -n "$(strip $(BUZZ_NETWORK))" ]; then \
if ! $(DOCKER) network inspect "$(BUZZ_NETWORK)" >/dev/null 2>&1; then \
$(DOCKER) network create "$(BUZZ_NETWORK)" >/dev/null; \
echo "Created Docker network $(BUZZ_NETWORK)."; \
fi; \
fi
run: network
@if $(DOCKER) container inspect "$(CONTAINER)" >/dev/null 2>&1; then \
if [ "$$($(DOCKER) container inspect --format '{{.State.Running}}' "$(CONTAINER)")" = "true" ]; then \
echo "Container $(CONTAINER) is already running."; \
else \
$(DOCKER) start "$(CONTAINER)"; \
fi; \
else \
$(DOCKER) run --detach \
--name "$(CONTAINER)" \
--platform "$(PLATFORM)" \
--restart unless-stopped \
--shm-size 1g \
$(GPU_DEVICE) \
$(NETWORK_ARG) \
--publish "$(BIND_ADDRESS):$(PORT):6901" \
$(RELAY_ENV) \
--env "DESKTOP_VNC_STATS=$(VNC_STATS)" \
--volume "$(VOLUME_PREFIX)-workspace:/workspace" \
--volume "$(VOLUME_PREFIX)-config:/home/agent/.config" \
--volume "$(VOLUME_PREFIX)-data:/home/agent/.local/share" \
--volume "$(VOLUME_PREFIX)-nest:/home/agent/.buzz" \
--volume "$(VOLUME_PREFIX)-codex:/home/agent/.codex" \
--volume "$(VOLUME_PREFIX)-claude:/home/agent/.claude" \
"$(IMAGE)"; \
fi
@$(MAKE) --no-print-directory url
recreate:
@$(MAKE) --no-print-directory stop
@$(MAKE) --no-print-directory run
up: build recreate
test: check up smoke
smoke:
@echo "Waiting for Buzznode at http://$(BIND_ADDRESS):$(PORT) ..."
@ready=false; \
for attempt in $$(seq 1 60); do \
if curl --fail --silent "http://$(BIND_ADDRESS):$(PORT)/index.html" >/dev/null; then \
ready=true; \
break; \
fi; \
sleep 2; \
done; \
if [ "$$ready" != "true" ]; then \
echo "Buzznode did not become ready within 120 seconds."; \
$(DOCKER) logs --tail 150 "$(CONTAINER)" || true; \
exit 1; \
fi
@DOCKER="$(DOCKER)" bash tests/smoke-container.sh \
"$(CONTAINER)" "$(TARGETARCH)"
@echo "Buzznode is ready with a desktop and one headless agent harness."
connection-test:
@$(DOCKER) exec \
--user agent \
"$(CONTAINER)" \
buzznode doctor
stop:
@if $(DOCKER) container inspect "$(CONTAINER)" >/dev/null 2>&1; then \
$(DOCKER) rm --force "$(CONTAINER)"; \
else \
echo "Container $(CONTAINER) does not exist."; \
fi
logs:
$(DOCKER) logs --follow "$(CONTAINER)"
vnc-log:
$(DOCKER) exec "$(CONTAINER)" \
bash -c 'tail --lines=200 --follow /home/agent/.vnc/*:1.log'
status:
@$(DOCKER) ps --all \
--filter "name=^/$(CONTAINER)$$" \
--format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'
@if $(DOCKER) container inspect "$(CONTAINER)" >/dev/null 2>&1; then \
$(DOCKER) exec "$(CONTAINER)" buzznode status || true; \
fi
url:
@echo "Desktop: http://$(BIND_ADDRESS):$(PORT)"
size-report:
@DOCKER="$(DOCKER)" bash tools/size-report.sh "$(IMAGE)"