igneum/infra/seed-nodes/lib.sh
igneum-labs d8dc8c6ba3 infra: cloud devnet (20 nodes), rented GPU bench and seed node scripts; plans for both
infra/cloud-devnet: hcloud (doctl variant) create, builder-VM provision from a git-archive source tarball,
systemd units for igneumd --devnet-suffix with a sparse --addpeer mesh and a CPU trickle miner per node,
stdlib wRPC client, experiments (latency, partition, hop, collect, observer hookup), README with the command
sequence and the Hetzner API prices of 3 Oct 2026.
infra/gpu-bench: RunPod image recipes (CUDA 12.8, ROCm), bundle, run.sh (vectors gate, 10-min raw, sweep,
inline shortcut ratio, nvcc/NVRTC/OpenCL recompile timings, results row, intake upload), bench-log template.
infra/seed-nodes: create-seed (persistent IPv4, firewall), provision on the VM, health check, addPeer from the
Mac over grpcurl, seeds.txt; igneum-seed-1 created at 188.245.5.161 (Hetzner cx23, fsn1).
docs/plans/cloud-devnet.md and docs/plans/seed-nodes.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-03 22:01:50 +00:00

30 lines
1.3 KiB
Bash
Executable file

# Shared helpers for infra/seed-nodes. Source this.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$HERE/../.." && pwd)"
export REPO
# shellcheck source=config.sh
. "$HERE/config.sh"
SEEDS_TXT="$HERE/seeds.txt"
SEEDS_TSV="$HERE/seeds.tsv"
BUILD_DIR="$HERE/build"
log() { printf '%s %s\n' "$(date -u +%H:%M:%S)" "$*"; }
die() { log "ERROR: $*" >&2; exit 1; }
need() { command -v "$1" >/dev/null 2>&1 || die "$1 is not installed ($2)"; }
hetzner_auth() {
need hcloud "brew install hcloud"
[ -s "$HETZNER_TOKEN_FILE" ] || die "no token at $HETZNER_TOKEN_FILE"
HCLOUD_TOKEN="$(head -1 "$HETZNER_TOKEN_FILE" | tr -d '[:space:]')"; export HCLOUD_TOKEN
}
SSH_OPTS=(-i "$SSH_KEY_FILE" -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile="$HERE/build/known_hosts" -o ConnectTimeout=15 -o BatchMode=yes -o ServerAliveInterval=30)
sssh() { local ip="$1"; shift; ssh "${SSH_OPTS[@]}" "$SSH_USER@$ip" "$@"; }
sscp() { scp -q "${SSH_OPTS[@]}" "$@"; }
seed_ip() { awk -F'\t' -v n="$1" '$1 == n { print $4; exit }' "$SEEDS_TSV" 2>/dev/null; }
seed_names() { cut -f1 "$SEEDS_TSV" 2>/dev/null | grep . || true; }
# seeds.txt is derived from seeds.tsv: one "<ip>:26611" per seed, nothing else, so a script or a package can read it as is.
write_seeds_txt() { awk -F'\t' -v p="$P2P_PORT" '{ print $4 ":" p }' "$SEEDS_TSV" > "$SEEDS_TXT"; }