Bridge deploy runbook (on-TV alvidaa-bridge, armv7)
Executable end-to-end by one person with the repo and the root key.
Read LANES.md first for what the bridge is. Ground rules
apply: announce the md5 in the team bulletin before touching the TV,
never reboot as part of a deploy, home shell stays pristine (findings
12 Β§7).
What you need
- This repo, with
server/keys/tv_root_ed25519present (gitignored). TV_HOSTset if the TV's DHCP lease moved (default192.168.0.11; ssh port 2222, userrootβ i.e../server/tv 'cmd'works).- Go toolchain for the armv7 cross-build.
1. Build and stage
git pull --ff-only # ALWAYS deploy from synced HEAD
cd bridge && go test ./... && cd ..
./tools/build-bridge.sh # -> bridge/dist/alvidaa-bridge-armv7
shasum -a 256 bridge/dist/alvidaa-bridge-armv7
md5 -q bridge/dist/alvidaa-bridge-armv7 # record this β announce it
Currency rule (learned 2026-11-05 the hard way): an md5 match against your staged artifact proves you deployed what you intended β it proves NOTHING about whether that artifact is current. Another lane may have built and deployed a newer binary while you were heads-down. Two guards, both mandatory:
- Rebuild from synced HEAD every deploy; never deploy a
dist/binary you did not just build (git describeβ the-X main.versionembed β must reference the commit you mean to ship). - Immediately before the swap,
curl http://$TV_HOST:8770/api/healthand compare itsversionto yours. If the live version is NEWER than your artifact, STOP β reconcile with the board before overwriting anything.
tools/build-bridge.sh embeds the version (v1.0-XX-g<hash>) from
git describe; commit your work first so the binary is not -dirty
(an unrelated-dirty worktree still shows -dirty β say so when
announcing). The running bridge reports its version at
GET /api/health (version field) and as the first bridge.log line.
2. Announce
Post the md5 (and version) in the team bulletin before writing to the TV. No other lane touches the TV during the deploy window.
3. Push (no ETXTBSY, minimal downtime)
The TV has no sftp/scp server β push over ssh cat. Write to a NEW
file, verify, then swap; overwriting the inode of a running binary
fails with ETXTBSY.
SSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 -i server/keys/tv_root_ed25519 root@$TV_HOST"
# 3a. backup the running binary on the TV (one .bak per deploy)
$SSH 'cp -p /var/local/alvidaa/alvidaa-bridge /var/local/alvidaa/alvidaa-bridge.bak-$(date +%Y%m%d-%H%M)'
# 3b. push to a staging path
rm -f /tmp/alvidaa-bridge-armv7.push # ensure clean local pipe
$SSH 'cat > /var/local/alvidaa/alvidaa-bridge.new' < bridge/dist/alvidaa-bridge-armv7
# 3c. verify ON THE TV β must equal the announced md5
$SSH 'md5sum /var/local/alvidaa/alvidaa-bridge.new; chmod 755 /var/local/alvidaa/alvidaa-bridge.new'
4. Swap and restart with the exact flags
$SSH 'kill $(pidof alvidaa-bridge) 2>/dev/null; sleep 1
mv /var/local/alvidaa/alvidaa-bridge.new /var/local/alvidaa/alvidaa-bridge
/var/local/alvidaa/alvidaa-bridge \
-keys /var/local/alvidaa/keys \
-assets /var/local/alvidaa/launcher \
-config /var/local/alvidaa/config.json \
-addr 0.0.0.0:8770 \
-mqtt 127.0.0.1:36669 >> /var/local/alvidaa/bridge.log 2>&1 &'
Currency re-check goes here (see Β§1): health version compared against
your artifact BEFORE the kill. The TV has no usable nohup and no
busybox setsid applet on this build β the plain backgrounded start
survives the ssh session in practice, but verify with pidof +
/api/health from a separate connection before declaring success.
nohup matters: without it the dropbear session teardown can reap the
bridge the moment your ssh command returns. Flags are exact β -addr
0.0.0.0:8770 (LAN reachability for verification) and -mqtt
127.0.0.1:36669 (loopback TLS, one client identity: never start two).
5. Verify (from the Mac; the TV has no curl)
curl -s http://$TV_HOST:8770/api/health # ok:true, version: v1.0-XX-g..., mqtt:true
curl -s -o /dev/null -w '%{http_code}\n' http://$TV_HOST:8770/icon/vidaa-recon # 200
curl -s -o /dev/null -w '%{http_code}\n' http://$TV_HOST:8770/icon/2256 # 200 (Spotify, staged)
curl -s -o /dev/null -w '%{http_code}\n' http://$TV_HOST:8770/bg/bg2.png # 200
curl -s -o /dev/null -w '%{http_code}\n' http://$TV_HOST:8770/next/app.html # 200 (dir-index fix)
$SSH 'pidof alvidaa-bridge; head -1 /var/local/alvidaa/bridge.log' # version line
Then press Home (or have the owner do it): the watcher bounce should land on the launcher within ~1s. That is the end-to-end green.
6. Rollback
$SSH 'kill $(pidof alvidaa-bridge) 2>/dev/null; sleep 1
cp -p /var/local/alvidaa/alvidaa-bridge.bak-<stamp> /var/local/alvidaa/alvidaa-bridge
/var/local/tvtools/busybox nohup /var/local/alvidaa/alvidaa-bridge \
-keys /var/local/alvidaa/keys -assets /var/local/alvidaa/launcher \
-config /var/local/alvidaa/config.json -addr 0.0.0.0:8770 \
-mqtt 127.0.0.1:36669 >> /var/local/alvidaa/bridge.log 2>&1 &'
Re-verify /api/health reports the OLD version. Never leave the TV
without a working bridge without saying so in the bulletin.
Watchdog gap (ACKED β landed as hook v13 in the repo, TV redeploy pending)
Hook v12 (tools/otaTest-hook.sh) kept the bridge alive only inside two
bounded loops: the early-start retry (~2 min, 60Γ2s) and the watchdog
(~20 min, 40Γ30s). After minute ~20 the loop exited; if the bridge died
after that β crash, OOM, MQTT identity fight, bad config on a manual
restart β nothing restarted it until the next reboot, and the same
bounded loop was all that guarded dropbear/telnetd (ssh access itself
expired at the same mark).
Landed as hook v13 (template + installer embed, together): the
watchdog loop is immortal (while [ 1 = 1 ]), and per ds41's required
condition the /var/local/hook.off kill-switch is re-checked every
iteration (v12 checked it once at script start, so an immortal loop
would have bypassed it forever). sleep 30 cadence kept β no busy
spin; the kill -9 $(pidof dropbear) line is unchanged (separate known
issue, out of scope). The v13 hook is not yet deployed to the TV β the
running TV hook is still v12 until a coordinated redeploy window.