- 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
Hero Supervisor Example
This example demonstrates how to configure and run the Hero Supervisor with multiple actors using a TOML configuration file.
Files
config.toml- Example supervisor configuration with multiple actorsrun_supervisor.sh- Shell script to build and run the supervisor with the example configrun_supervisor.rs- Rust script using escargot to build and run the supervisorREADME.md- This documentation file
Configuration
The config.toml file defines:
- Redis connection: URL for the Redis server used for job queuing
- Database path: Local path for supervisor state storage
- Job queue key: Redis key for the supervisor job queue
- Actors: List of actor configurations with:
name: Unique identifier for the actorrunner_type: Type of runner ("SAL", "OSIS", "V", "Python")binary_path: Path to the actor binaryprocess_manager: Process management type ("simple" or "tmux")
Prerequisites
- Redis Server: Ensure Redis is running on
localhost:6379(or update the config) - Actor Binaries: Build the required actor binaries referenced in the config:
# Build SAL worker cd ../../sal cargo build --bin sal_worker # Build OSIS and system workers cd ../../worker cargo build --bin osis cargo build --bin system
Running the Example
Option 1: Shell Script (Recommended)
./run_supervisor.sh
Option 2: Rust Script with Escargot
cargo +nightly -Zscript run_supervisor.rs
Option 3: Manual Build and Run
# Build the supervisor
cd ../../../supervisor
cargo build --bin supervisor --features cli
# Run with config
./target/debug/supervisor --config ../baobab/examples/supervisor/config.toml
Usage
Once running, the supervisor will:
- Load the configuration from
config.toml - Initialize and start all configured actors
- Listen for jobs on the Redis queue (
hero:supervisor:jobs) - Dispatch jobs to appropriate actors based on the
runnerfield - Monitor actor health and status
Testing
You can test the supervisor by dispatching jobs to the Redis queue:
# Using redis-cli to add a test job
redis-cli LPUSH "hero:supervisor:jobs" '{"id":"test-123","runner":"sal_actor_1","script":"print(\"Hello from SAL actor!\")"}'
Stopping
Use Ctrl+C to gracefully shutdown the supervisor. It will:
- Stop accepting new jobs
- Wait for running jobs to complete
- Shutdown all managed actors
- Clean up resources
Customization
Modify config.toml to:
- Add more actors
- Change binary paths to match your build locations
- Update Redis connection settings
- Configure different process managers per actor
- Adjust database and queue settings
Troubleshooting
- Redis Connection: Ensure Redis is running and accessible
- Binary Paths: Verify all actor binary paths exist and are executable
- Permissions: Ensure the supervisor has permission to create the database directory
- Ports: Check that Redis port (6379) is not blocked by firewall