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"