Files
pdtv26/status/Makefile
T
dckc 7957d88ff9
check / check (push) Canceled after 0s
fixup! feat(status): a status page, for the phone of whoever looks after the box
install the app in /usr/local/lib/pdtv26-status, not in the state
directory: with DynamicUser, systemd makes /var/lib/pdtv26-status its
own symlink to /var/lib/private, and the service failed at
STATE_DIRECTORY ("File exists"). The package's check now catches a unit
that runs a program from its own StateDirectory.

Generated-by: Claude Opus 5.5
2026-12-02 18:38:37 -06:00

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 = /usr/local/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'