- Simplified RunnerConfig to just name, command, and optional env - Removed RunnerType and ProcessManagerType enums - Removed db_path, redis_url, binary_path from config - Made runner name also serve as queue name (no separate queue param) - Added secret-based authentication to all runner management methods - Created comprehensive osiris_openrpc example - Archived old examples to _archive/ - Updated client API to match simplified supervisor interface
2.6 KiB
2.6 KiB
OSIRIS + OpenRPC Comprehensive Example
This example demonstrates the complete workflow of using Hero Supervisor with OSIRIS runners via OpenRPC.
What This Example Does
- Builds and starts Hero Supervisor with OpenRPC server enabled
- Builds the OSIRIS runner binary
- Connects an OpenRPC client to the supervisor
- Registers and starts an OSIRIS runner
- Dispatches multiple jobs via OpenRPC:
- Create a Note
- Create an Event
- Query stored data
- Test access control (expected to fail)
- Monitors job execution and results
- Gracefully shuts down all components
Prerequisites
- Redis server running on
localhost:6379 - Rust toolchain installed
- Both
supervisorandrunner_rustcrates available
Running the Example
cargo run --example osiris_openrpc
Job Scripts
The example uses separate Rhai script files for each job:
note.rhai- Creates and stores a Note objectevent.rhai- Creates and stores an Event objectquery.rhai- Queries and retrieves stored objectsaccess_denied.rhai- Tests access control (should fail)
Architecture
┌─────────────────┐
│ This Example │
│ (OpenRPC │
│ Client) │
└────────┬────────┘
│ JSON-RPC
↓
┌─────────────────┐
│ Supervisor │
│ (OpenRPC │
│ Server) │
└────────┬────────┘
│ Redis Queue
↓
┌─────────────────┐
│ OSIRIS Runner │
│ (Rhai Engine │
│ + HeroDB) │
└─────────────────┘
Key Features Demonstrated
- Automatic binary building using escargot
- OpenRPC communication between client and supervisor
- Runner registration with configuration
- Job dispatching with signatories
- Context-based access control in OSIRIS
- Typed object storage (Note, Event)
- Graceful shutdown and cleanup
Expected Output
The example will:
- ✅ Create a Note successfully
- ✅ Create an Event successfully
- ✅ Query and retrieve stored objects
- ✅ Deny access for unauthorized participants
- ✅ Clean up all resources
Troubleshooting
Redis Connection Error:
- Ensure Redis is running:
redis-server
Build Errors:
- Ensure both supervisor and runner_rust crates are available
- Check that all dependencies are up to date
OpenRPC Connection Error:
- Port 3030 might be in use
- Check supervisor logs for startup issues