scripts: pi demo fleet seeding (batched under the 10/day app-create limit)
1 file changed,
+47
−0
scripts/seed-pi-demo.sh+47 −0
diff --git a/scripts/seed-pi-demo.sh b/scripts/seed-pi-demo.sh| new file mode 100755 |
| index 000000000..ad5eb0b5d |
| --- /dev/null |
| +++ b/scripts/seed-pi-demo.sh |
| @@ -0,0 +1,47 @@ |
| +#!/usr/bin/env bash |
| +# Seed the Pi demo fleet on the dev platform: N resident + M parked demo |
| +# instances, all resident in region "pi" (the Pi's own data bucket — no |
| +# placement machinery, residency IS placement), edge routes backed by the |
| +# Pi's reverse channel. |
| +# |
| +# The console API's app-create limiter is 10/address/day, so run this in |
| +# daily batches: seed-pi-demo.sh <start-index> <count>. State is the dev |
| +# platform itself — re-running an already-claimed index is a no-op: `carlos |
| +# apps create` refuses a taken name with "that name is taken" (HTTP 409), |
| +# and this script treats that refusal as success rather than a fresh error. |
| +# |
| +# Requires a carlos CLI build carrying PR #52's `apps create` verb (API |
| +# mode ONLY — sign in first with `carlos auth login -console <url>`; direct |
| +# bucket mode has no claims table to write to and this verb refuses it). |
| +# PR #52 is unmerged as of this writing (branch worktree-cli-app-create) — |
| +# seeding cannot run until it lands. Note also: neither main nor PR #52 |
| +# has an `apps list`/`ls` verb over the console API, so idempotence here is |
| +# done by interpreting create's own "taken" refusal, not by listing first. |
| +set -euo pipefail |
| + |
| +START=${1:?usage: seed-pi-demo.sh <start-index> <count>} |
| +COUNT=${2:?usage: seed-pi-demo.sh <start-index> <count>} |
| +TUNNEL_NAME=${CARLOS_PI_TUNNEL_NAME:?set CARLOS_PI_TUNNEL_NAME (the Pi tunnel channel name)} |
| +if (( COUNT > 10 )); then |
| + echo "warning: console API limits app creation to 10/address/day — run this in batches of <=10" >&2 |
| +fi |
| + |
| +for i in $(seq "$START" $((START + COUNT - 1))); do |
| + app=$(printf 'pi-demo-%03d' "$i") |
| + if out=$(carlos apps create -app "$app" 2>&1); then |
| + echo "created: $app" |
| + elif [[ "$out" == *"that name is taken"* ]]; then |
| + echo "exists: $app" |
| + else |
| + echo "$out" >&2 |
| + echo "failed: $app" >&2 |
| + exit 1 |
| + fi |
| +done |
| + |
| +echo |
| +echo "Next, on the DEV EDGE box, back each new hostname with the Pi channel:" |
| +echo " carlos route -host <hostname-of-app> -tunnel ${TUNNEL_NAME}" |
| +echo "and on the PI, add the matching local routes (carlos add / adopt as usual)." |
| +echo "First 5 apps stay resident (no hibernate flag); the rest get the" |
| +echo "-hibernate flag on their Pi-local routes so they park." |