#!/usr/bin/env bash # Gives one app an empty database before it is measured. Deleting an # instance parks its data, and the hostname can't be reused until an # operator purges it, so this runs in two steps: # scripts/fresh-instance.sh delete then an operator purges the host # scripts/fresh-instance.sh create recreate, wait for the recorded version # Bakeoff test data only. Paul's call, 2026-10-24. set -euo pipefail step=$1 slug=$2 cd "$(dirname "$0")/.." app=todo-$slug host=todo-$slug.bfj.oncarlos.com want=$(python3 -c "import json; print(json.load(open('results/$slug.json'))['Version'])") if [ "$step" = delete ]; then carlos instances delete --account bfj --app "$app" --host "$host" --message "Empty the database before measuring (bakeoff)" exit 0 fi carlos instances create --account bfj --app "$app" --host "$host" --channel edge --message "Recreate with an empty database (bakeoff)" for _ in $(seq 1 60); do got=$(curl -s --max-time 10 "https://$host/api/version" || true) [ "$got" = "$want" ] && { echo "$slug: fresh instance serving $got"; carlos instances list --account bfj --app "$app" | tail -1; exit 0; } sleep 5 done echo "$slug: fresh instance not serving $want after 5 minutes (last: $got)" >&2 exit 1