From 3a0513de5b7ee570480b54c08c5eb5fa916e7670 Mon Sep 17 00:00:00 2001 From: shoemoney Date: Mon, 22 Jun 2026 23:46:53 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20fleet=20deploy=20scripts=20+=20systemd?= =?UTF-8?q?=20unit=20=F0=9F=9A=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - deploy/devbox-hub.service: reboot-persistent systemd unit (the one live on .10) - deploy/redeploy-hub.sh: cross-compile linux/amd64 + ship + restart hub - deploy/redeploy-client.sh: build + push client to fleet macs Captures the by-hand deploy flow so redeploys (every M3 endpoint) are one command. --- deploy/devbox-hub.service | 16 ++++++++++++++++ deploy/redeploy-client.sh | 18 ++++++++++++++++++ deploy/redeploy-hub.sh | 19 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 deploy/devbox-hub.service create mode 100755 deploy/redeploy-client.sh create mode 100755 deploy/redeploy-hub.sh diff --git a/deploy/devbox-hub.service b/deploy/devbox-hub.service new file mode 100644 index 0000000..6a430a2 --- /dev/null +++ b/deploy/devbox-hub.service @@ -0,0 +1,16 @@ +# devbox hub systemd unit (installed at /etc/systemd/system/devbox-hub.service on the hub host). +# Reboot-persistent, auto-restart. Runs as a normal user that owns the data dir. +[Unit] +Description=devbox hub +After=network-online.target +Wants=network-online.target + +[Service] +ExecStart=/mnt/tank/apps/devbox/devbox-hub serve --data /mnt/tank/apps/devbox/data --listen 0.0.0.0:8088 +WorkingDirectory=/mnt/tank/apps/devbox +User=shoemoney +Restart=on-failure +RestartSec=3 + +[Install] +WantedBy=multi-user.target diff --git a/deploy/redeploy-client.sh b/deploy/redeploy-client.sh new file mode 100755 index 0000000..7bf370c --- /dev/null +++ b/deploy/redeploy-client.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Build the devbox client (host arch — fleet macs are darwin/arm64) and push it to +# the fleet macs at /tmp/devbox. Run from anywhere in the repo. +set -euo pipefail +cd "$(dirname "$0")/.." + +FLEET=(hueb reek wick amber) # 192.168.1.3/.4/.5/.7 + +echo "🔨 building devbox client..." +go build -o /tmp/devbox ./cmd/devbox + +for h in "${FLEET[@]}"; do + if scp -q /tmp/devbox "${h}:/tmp/devbox" 2>/dev/null && ssh "$h" 'chmod +x /tmp/devbox'; then + echo "✅ ${h}" + else + echo "⚠️ ${h} unreachable, skipped" + fi +done diff --git a/deploy/redeploy-hub.sh b/deploy/redeploy-hub.sh new file mode 100755 index 0000000..66ddf6c --- /dev/null +++ b/deploy/redeploy-hub.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Cross-compile the devbox hub for the NAS (linux/amd64, no CGO — pure-Go sqlite), +# ship it, and restart the systemd service. Run from anywhere in the repo. +set -euo pipefail +cd "$(dirname "$0")/.." + +HUB=nas # ssh alias for 192.168.1.10 +DEST=/mnt/tank/apps/devbox +URL=http://192.168.1.10:8088 + +echo "🔨 building linux/amd64..." +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /tmp/devbox-hub-linux ./cmd/devbox-hub + +echo "🚚 shipping to ${HUB}:${DEST}..." +scp -q /tmp/devbox-hub-linux "${HUB}:${DEST}/devbox-hub.new" +ssh "$HUB" "mv ${DEST}/devbox-hub.new ${DEST}/devbox-hub && chmod +x ${DEST}/devbox-hub && sudo systemctl restart devbox-hub && systemctl is-active devbox-hub" + +echo "✅ redeployed. hub metrics:" +curl --retry 10 --retry-connrefused --retry-delay 1 --max-time 15 -sf "${URL}/metrics" | grep '^devbox_' || echo "⚠️ hub not answering yet"