This repository has been archived on 2025-11-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
supervisor/README.md
Timur Gordon 4b516d9d7e update readme
2025-11-12 12:15:46 +01:00

38 lines
1.6 KiB
Markdown

# Supervisor
A job execution supervisor that queues jobs to runners over redis and returns their output. It provides an OpenRPC server for remote job dispatching. The openrpc server requires authorization via a shared secret key. Secret keys are scoped to grant one of three levels of access: Admin, Registrar (can register runners), User (can use supervisor).
Jobs contain scripts, some env vars, an identifier of the runner to execute the script and signatures. The supervisor also verifies the signatures, however access control based on who the signatories of a script is handled by the runner logic.
## Usage
The supervisor needs an admin key to be configured to get started.
`cargo run -- --admin-secret <SECRET>`
You can also use the run script which uses the `.env` file to get the admin key.
`./scripts/run.sh`
The scripts directory also offers other scripts for building testing etc.
## Functionality
Beyond the job functionality, the supervisor also provides functionality for managing keys and registering runners. Runner registration simply means the supervisor becomes aware that a certain runner is being run and listening to it's queue. The The full spec can be seen in `openrpc.json`.
## OpenRPC
### Server
The supervisor automatically starts an OpenRPC server on `127.0.0.1:3030` that exposes all supervisor functionality via JSON-RPC.
### Example JSON-RPC Call
```bash
curl -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"list_runners","id":1}' \
http://127.0.0.1:3030
```
### Client
The repository also offers OpenRPC Client for supervisor compatible with WASM targets as well.