Is the box up, and speech, and the brain; how many conversations, turns, IR presses, and looks, today and all time. Counts and times only: no transcripts. - status/status.js: what the events and checks add up to, and the page - status/status-server.js: the page, the box's events and heartbeat, and a TCP check of each part every 30 s; events kept in a file - status/pdtv26-status.service and Makefile: sudo make install on the home server, answering only the private network - checks: status (its tests) Generated-by: Claude Opus 5.5
49 lines
1.6 KiB
Makefile
49 lines
1.6 KiB
Makefile
# status: the agent's status page, for a phone, on the home server: is the box up, are speech and the
|
|
# brain, and how many conversations, turns, IR presses, and looks. The box reports to it when its
|
|
# system sets pdtv26.box.statusUrl.
|
|
# Tools come from the flake: nix develop --command make test
|
|
# sudo make install BOX=... # on the home server
|
|
|
|
FLAKE = ..
|
|
NAME = $(BOX)
|
|
BOX = box
|
|
PORT = 8027
|
|
# What it checks, host:port. Use addresses where this host can't resolve the names.
|
|
BOX_IR = $(BOX):8026
|
|
SPEECH = localhost:8024
|
|
BRAIN = localhost:8025
|
|
# The private network's addresses: the only ones it answers or checks. A tailnet's, by default.
|
|
RANGES = 100.64.0.0/10 fd7a:115c:a1e0::/48
|
|
APP = /var/lib/pdtv26-status/app
|
|
UNIT = /etc/systemd/system/pdtv26-status.service
|
|
TARGETS = /etc/pdtv26-status/targets
|
|
|
|
.PHONY: help test app install
|
|
|
|
## list targets
|
|
help:
|
|
@awk -f ../make-help.awk $(MAKEFILE_LIST)
|
|
|
|
## the unit tests, in Nix's build sandbox
|
|
test:
|
|
nix build -L --no-link ..#status
|
|
|
|
## the server, as a GC root
|
|
app:
|
|
install -d $(dir $(APP))
|
|
nix build --out-link $(APP) '$(FLAKE)#status'
|
|
|
|
$(UNIT): pdtv26-status.service Makefile
|
|
sed 's|@ranges@|$(RANGES)|' $< > $@
|
|
|
|
$(TARGETS): Makefile
|
|
install -d $(dir $@)
|
|
printf 'PORT=%s\nNAME=%s\nBOX=%s\nSPEECH=%s\nBRAIN=%s\n' $(PORT) $(NAME) $(BOX_IR) $(SPEECH) $(BRAIN) > $@
|
|
|
|
## build, install the unit and its targets, and (re)start it: sudo make install BOX=...
|
|
install: app $(UNIT) $(TARGETS)
|
|
systemctl daemon-reload
|
|
systemctl enable pdtv26-status
|
|
systemctl restart pdtv26-status
|
|
sleep 2; systemctl --no-pager status pdtv26-status | grep -E '●|Active|listening'
|