tools/fleet: publish the rented-GPU fleet page's data to the downloads host

The page lives at an unlisted path on dl.igneum.network (name in ~/.config/igneum/fleet-path) and reads fleet.json
every 30 s; this script copies a fleet.json in and deploys, then checks the edge serves it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-06 11:52:18 +00:00
parent 017c7db517
commit d0ac0d1ca4

15
tools/fleet/publish-fleet.sh Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Publish the rented-GPU fleet page's data: copies a fleet.json into the downloads site's fleet folder and deploys.
# tools/fleet/publish-fleet.sh <fleet.json> (the fleet agent calls this after every change, at most once a minute)
# The folder name is in ~/.config/igneum/fleet-path; the page is dl.igneum.network/<that path>/ (noindex, unlisted).
set -euo pipefail
JSON="${1:?fleet.json path}"
DLSITE="$(cat "$HOME/.config/igneum/dlsite-dir")"; P="$(cat "$HOME/.config/igneum/fleet-path")"
python3 -c "import json,sys; json.load(open(sys.argv[1]))" "$JSON"
cp "$JSON" "$DLSITE/$P/fleet.json"
(cd "$DLSITE" && npx --yes vercel@latest --global-config "$HOME/.config/igneum/vercel" deploy --prod --yes >/dev/null 2>&1) || { echo "deploy failed" >&2; exit 1; }
for i in $(seq 1 12); do
if curl -fsS --max-time 10 "https://dl.igneum.network/$P/fleet.json?t=$(date +%s)" | python3 -c "import json,sys; d=json.load(sys.stdin); sys.exit(0 if d.get('spend',{}).get('updated_at')==json.load(open('$JSON')).get('spend',{}).get('updated_at') else 1)" 2>/dev/null; then echo "live: https://dl.igneum.network/$P/"; exit 0; fi
sleep 5
done
echo "deployed but the edge still serves the previous file" >&2; exit 2