|
| 1 | +# BuilderNet VM Scripts |
| 2 | + |
| 3 | +Temporary bash scripts for running BuilderNet VM alongside builder-playground. |
| 4 | +Feel free to translate them to Go and integrate into the CLI. |
| 5 | + |
| 6 | +## Information: |
| 7 | + |
| 8 | +Changes are made in two repos: |
| 9 | +- [flashbots-images](https://github.com/flashbots/flashbots-images/tree/fryd/mkosi-playground) on `fryd/mkosi-playground` branch, |
| 10 | +- [builder-playground](https://github.com/flashbots/builder-playground/tree/fryd/mkosi-playground) on `fryd/mkosi-playground` branch, |
| 11 | + |
| 12 | +There are no plans of using [buildernet-playground](https://github.com/flashbots/buildernet-playground) repo. |
| 13 | + |
| 14 | +## Start playground |
| 15 | + |
| 16 | +Start playground with: `--bind-external` (expose ports to the VM) and `--contender` (create transactions) |
| 17 | + |
| 18 | +```bash |
| 19 | +builder-playground \ |
| 20 | + start buildernet \ |
| 21 | + --bind-external \ |
| 22 | + --output ".playground-home" \ |
| 23 | + --contender \ |
| 24 | + --detached fryd-vm-builder |
| 25 | +``` |
| 26 | + |
| 27 | +## First Time Setup |
| 28 | + |
| 29 | +```bash |
| 30 | +./sync.sh # Clone / fetch flashbots-images repo |
| 31 | +./build.sh # Build VM image with mkosi |
| 32 | +./prepare.sh # Extract image + create data disk |
| 33 | +``` |
| 34 | + |
| 35 | +`sync.sh` clones/updates the `fryd/mkosi-playground` branch of flashbots-images. |
| 36 | + |
| 37 | +## Run VM |
| 38 | + |
| 39 | +```bash |
| 40 | +./start.sh # Start VM (background) |
| 41 | +./console.sh # Open console to the VM |
| 42 | +./ssh.sh # SSH into running VM (requires SSH key setup) |
| 43 | +./stop.sh # Stop VM |
| 44 | +``` |
| 45 | + |
| 46 | +## Builder Hub |
| 47 | + |
| 48 | +```bash |
| 49 | +./builderhub-configure.sh # Register VM with builder-hub and update config for the VM |
| 50 | +./builderhub-get-config.sh # Get configuration for the VM |
| 51 | +``` |
| 52 | + |
| 53 | +## Operator API |
| 54 | + |
| 55 | +Scripts to interact with the operator-api service running inside the VM. |
| 56 | + |
| 57 | +> **Note:** Actions and File Uploads could potentially be used for various things, like injecting genesis config instead of BuilderHub - still exploring this functionality. |
| 58 | +
|
| 59 | +```bash |
| 60 | +./operator-api-health.sh # Check if operator-api is healthy |
| 61 | +./operator-api-logs.sh # Get event logs |
| 62 | +./operator-api-action.sh <action> # Execute an action |
| 63 | +``` |
| 64 | + |
| 65 | +Available actions: |
| 66 | +- `reboot` - Reboot the system |
| 67 | +- `rbuilder_restart` - Restart rbuilder-operator service |
| 68 | +- `rbuilder_stop` - Stop rbuilder-operator service |
| 69 | +- `fetch_config` - Fetch config from BuilderHub |
| 70 | +- `rbuilder_bidding_restart` - Restart rbuilder-bidding service |
| 71 | +- `ssh_stop` - Stop SSH service |
| 72 | +- `ssh_start` - Start SSH service |
| 73 | +- `haproxy_restart` - Restart HAProxy service |
| 74 | + |
| 75 | +### File Uploads |
| 76 | + |
| 77 | +Upload files to predefined paths. Only whitelisted names from `[file_uploads]` config are allowed: |
| 78 | + |
| 79 | +```toml |
| 80 | +[file_uploads] |
| 81 | +rbuilder_blocklist = "/var/lib/persistent/rbuilder-operator/rbuilder.blocklist.json" |
| 82 | +``` |
| 83 | + |
| 84 | +```bash |
| 85 | +# Stores local blocklist.json content to the configured remote path |
| 86 | +curl -k --data-binary "@blocklist.json" https://localhost:13535/api/v1/file-upload/rbuilder_blocklist |
| 87 | +``` |
| 88 | + |
| 89 | +### Customization |
| 90 | + |
| 91 | +To add more actions or file uploads, modify the config template: |
| 92 | +https://github.com/flashbots/flashbots-images/blob/fryd/mkosi-playground/mkosi.profiles/playground/mkosi.extra/usr/lib/mustache-templates/etc/operator-api/config.toml.mustache |
| 93 | + |
| 94 | +## Maintenance |
| 95 | + |
| 96 | +```bash |
| 97 | +./sync.sh # Update flashbots-images to latest |
| 98 | +./clean.sh # Clean build artifacts + runtime files |
| 99 | +``` |
| 100 | + |
| 101 | +## Ports |
| 102 | + |
| 103 | +| Port | Service | |
| 104 | +|------|---------| |
| 105 | +| 2222 | SSH (maps to VM:40192) | |
| 106 | +| 13535 | Operator API (maps to VM:3535) | |
0 commit comments