docs: prepare repeatable V1 presentation
This commit is contained in:
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P)
|
||||
# shellcheck source=process-lib.sh
|
||||
source "$ROOT/tools/process-lib.sh"
|
||||
ANVIL_TEST_PHRASE='test test test test test test test test test test test junk'
|
||||
CLEANING=0
|
||||
|
||||
cleanup() {
|
||||
local status=$? cleanup_status=0
|
||||
((CLEANING == 0)) || return
|
||||
CLEANING=1
|
||||
trap - INT TERM EXIT
|
||||
demo_stop_recorded "$ROOT" vite || cleanup_status=1
|
||||
demo_stop_recorded "$ROOT" anvil || cleanup_status=1
|
||||
((status == 0 && cleanup_status != 0)) && status=$cleanup_status
|
||||
exit "$status"
|
||||
}
|
||||
trap 'exit 130' INT
|
||||
trap 'exit 143' TERM
|
||||
trap cleanup EXIT
|
||||
|
||||
record_launched() {
|
||||
local kind=$1 pid=$2
|
||||
for _ in {1..50}; do
|
||||
if demo_record_process "$ROOT" "$kind" "$pid"; then return 0; fi
|
||||
demo_pid_is_running "$pid" || break
|
||||
sleep 0.02
|
||||
done
|
||||
printf 'Could not prove identity for launched %s PID %s; stopping without targeting an unverified PID.\n' "$kind" "$pid" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
cd "$ROOT"
|
||||
bash tools/reset-local.sh
|
||||
bash tools/doctor.sh
|
||||
install -d -m 0700 "$ROOT/.demo"
|
||||
|
||||
setsid anvil --host 127.0.0.1 --port 8545 --chain-id 31337 --mnemonic "$ANVIL_TEST_PHRASE" >"$ROOT/.demo/anvil.log" 2>&1 &
|
||||
ANVIL_PID=$!
|
||||
record_launched anvil "$ANVIL_PID"
|
||||
for _ in {1..100}; do
|
||||
if [[ $(cast chain-id --rpc-url http://127.0.0.1:8545 2>/dev/null || true) == 31337 ]]; then ANVIL_READY=1; break; fi
|
||||
demo_pid_is_running "$ANVIL_PID" || break
|
||||
sleep 0.1
|
||||
done
|
||||
[[ ${ANVIL_READY:-0} == 1 ]] || { printf '%s\n' 'Anvil did not become ready; see .demo/anvil.log' >&2; exit 1; }
|
||||
|
||||
make deploy-v1
|
||||
make seed-v1
|
||||
DEMO_EXPECTED_STAGE=v1 make check-state
|
||||
npm_config_offline=true forge build --force
|
||||
node tools/sync-web-artifacts.mjs
|
||||
node tools/sync-web-artifacts.mjs --check
|
||||
node tools/publish-web-manifest.mjs
|
||||
|
||||
setsid "$ROOT/web/node_modules/.bin/vite" web --host 127.0.0.1 --port 5173 >"$ROOT/.demo/vite.log" 2>&1 &
|
||||
VITE_PID=$!
|
||||
record_launched vite "$VITE_PID"
|
||||
for _ in {1..100}; do
|
||||
if curl --fail --silent --output /dev/null http://127.0.0.1:5173/; then VITE_READY=1; break; fi
|
||||
demo_pid_is_running "$VITE_PID" || break
|
||||
sleep 0.1
|
||||
done
|
||||
[[ ${VITE_READY:-0} == 1 ]] || { printf '%s\n' 'Vite did not become ready; see .demo/vite.log' >&2; exit 1; }
|
||||
|
||||
printf '\nV1 operations console: http://127.0.0.1:5173/\n'
|
||||
printf '%s\n' 'In a second terminal: DEMO_EXPECTED_STAGE=v1 make check-state'
|
||||
printf '%s\n' 'Stop this attached demo with Ctrl-C; make reset-local is the recovery command.'
|
||||
while demo_pid_is_running "$ANVIL_PID" && demo_pid_is_running "$VITE_PID"; do sleep 1; done
|
||||
printf '%s\n' 'A demo child exited unexpectedly; inspect .demo/anvil.log and .demo/vite.log.' >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user