- 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
75 lines
1.9 KiB
Markdown
75 lines
1.9 KiB
Markdown
# Hero Supervisor Examples
|
|
|
|
This directory contains examples demonstrating Hero Supervisor functionality.
|
|
|
|
## Available Examples
|
|
|
|
### osiris_openrpc
|
|
|
|
Comprehensive example showing the complete workflow of using Hero Supervisor with OSIRIS runners via OpenRPC.
|
|
|
|
**Features:**
|
|
- Automatic supervisor and runner startup
|
|
- OpenRPC client communication
|
|
- Runner registration and management
|
|
- Job dispatching with multiple scripts
|
|
- Context-based access control
|
|
- Graceful shutdown
|
|
|
|
**Run:**
|
|
```bash
|
|
cargo run --example osiris_openrpc
|
|
```
|
|
|
|
See [osiris_openrpc/README.md](osiris_openrpc/README.md) for details.
|
|
|
|
## Prerequisites
|
|
|
|
All examples require:
|
|
- Redis server running on `localhost:6379`
|
|
- Rust toolchain installed
|
|
|
|
## Example Structure
|
|
|
|
```
|
|
examples/
|
|
├── README.md # This file
|
|
├── osiris_openrpc/ # OSIRIS + OpenRPC example
|
|
│ ├── main.rs # Main example code
|
|
│ ├── README.md # Detailed documentation
|
|
│ ├── note.rhai # Note creation script
|
|
│ ├── event.rhai # Event creation script
|
|
│ ├── query.rhai # Query script
|
|
│ └── access_denied.rhai # Access control test script
|
|
└── _archive/ # Archived old examples
|
|
```
|
|
|
|
## Architecture Overview
|
|
|
|
The examples demonstrate the Hero Supervisor architecture:
|
|
|
|
```
|
|
Client (OpenRPC)
|
|
↓
|
|
Supervisor (OpenRPC Server)
|
|
↓
|
|
Redis Queue
|
|
↓
|
|
Runners (OSIRIS, SAL, etc.)
|
|
```
|
|
|
|
## Development
|
|
|
|
To add a new example:
|
|
|
|
1. Create a new directory under `examples/`
|
|
2. Add `main.rs` with your example code
|
|
3. Add any required script files (`.rhai`)
|
|
4. Add a `README.md` documenting the example
|
|
5. Update `Cargo.toml` to register the example
|
|
6. Update this README with a link
|
|
|
|
## Archived Examples
|
|
|
|
Previous examples have been moved to `_archive/` for reference. These may be outdated but can provide useful patterns for specific use cases.
|