devbox/deploy/redeploy-hub.sh
shoemoney 3a0513de5b chore: fleet deploy scripts + systemd unit 🚚
- 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.
2026-06-22 23:46:53 -05:00

19 lines
912 B
Bash
Executable file

#!/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"