Skip to content

Commit a06b467

Browse files
authored
feat: set default BUILDERNET_IMAGE to url and add readyz.sh helper script (#393)
1 parent 1528441 commit a06b467

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

custom-recipes/buildernet/mkosi/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ curl -sSfL https://raw.githubusercontent.com/flashbots/builder-playground/main/i
2929
mkdir buildernet-dev && cd buildernet-dev
3030
builder-playground generate buildernet/mkosi
3131

32-
# 3. Point to the VM image
33-
# - you can point to a local file or URL
34-
# - alternatively you can set this in playground.yaml (see below)
32+
# 3. Point to the VM image — local path, https:// URL, or set in playground.yaml.
33+
# Skip to download the latest pre-built image automatically.
34+
# Pre-built images: https://downloads.buildernet.org/buildernet-playground-images/
3535
export BUILDERNET_IMAGE=/path/to/buildernet-qemu.qcow2
3636

3737
# 4. Start (runs L1 Docker stack + VM in the background)
3838
builder-playground start playground.yaml --bind-external --detached
3939

40-
# 5. Wait for the VM to boot (~60-90s) then check readiness
41-
./scripts/operator-api-health.sh # repeat until you see "OK"
40+
# 5. Wait for the VM to be ready
41+
./scripts/readyz.sh
4242

4343
# 6. Verify by sending a transaction
4444
builder-playground test --rpc http://localhost:18645 --el-rpc http://localhost:8545
@@ -102,7 +102,7 @@ For Docker service logs (Reth, Lighthouse, mev-boost-relay, etc.), use `builder-
102102

103103
| Variable | Default | Description |
104104
|----------|---------|-------------|
105-
| `BUILDERNET_IMAGE` | *(set in playground.yaml)* | Path or URL to the VM qcow2 image |
105+
| `BUILDERNET_IMAGE` | pre-built image URL (see playground.yaml) | Local path or https:// URL to the VM qcow2 image |
106106
| `QEMU_CPU` | `8` | Number of CPU cores |
107107
| `QEMU_RAM` | `32G` | Memory allocation |
108108
| `QEMU_ACCEL` | `kvm` | Acceleration (`kvm` or `tcg`) |
@@ -163,6 +163,7 @@ buildernet-dev/
163163
├── prepare.sh # Download/copy image + create data disk
164164
├── start.sh # Start the QEMU VM
165165
├── stop.sh # Stop the QEMU VM
166+
├── readyz.sh # Wait for VM readiness (/readyz on HAProxy)
166167
├── console.sh # Serial console
167168
├── clean.sh # Remove runtime files
168169
└── operator-api-*.sh # Operator API helpers

custom-recipes/buildernet/mkosi/playground.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ recipe:
3232
builder:
3333
lifecycle_hooks: true
3434
env:
35-
BUILDERNET_IMAGE: ".flashbots-images/mkosi.output/buildernet-qemu_latest.qcow2"
35+
BUILDERNET_IMAGE: "https://downloads.buildernet.org/buildernet-playground-images/dev-20260303-3059b761/buildernet-qemu_dev-20260303-3059b761.qcow2"
3636
init:
3737
- ./scripts/prepare.sh
3838
start: ./scripts/start.sh
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
# Poll /readyz on HAProxy until the VM is ready or timeout is reached
3+
set -eu -o pipefail
4+
5+
TIMEOUT=${1:-300}
6+
PORT=${HAPROXY_PORT:-10443}
7+
HOST=${HAPROXY_HOST:-localhost}
8+
URL="https://${HOST}:${PORT}/readyz"
9+
START=$(date +%s)
10+
11+
echo "Waiting for ${URL}..."
12+
while true; do
13+
if curl -sfk -m 2 -o /dev/null "${URL}" 2>/dev/null; then
14+
echo "OK ($(( $(date +%s) - START ))s)"
15+
exit 0
16+
fi
17+
elapsed=$(( $(date +%s) - START ))
18+
if [[ "${elapsed}" -ge "${TIMEOUT}" ]]; then
19+
echo "Timed out after ${elapsed}s"
20+
exit 1
21+
fi
22+
echo " ${elapsed}s elapsed, retrying..."
23+
sleep 5
24+
done

0 commit comments

Comments
 (0)