installers.horus.osirisrunner #
Osirisrunner Installer
A V language installer module for building and managing the Hero Runner service. This installer handles the complete lifecycle of the Osirisrunner binary from the Horus workspace.
Features
- Automatic Rust Installation: Installs Rust toolchain if not present
- Git Repository Management: Clones and manages the horus repository
- Binary Building: Compiles the osirisrunner binary from the horus workspace
- Service Management: Start/stop/restart via zinit
- Configuration: Customizable Redis connection
Quick Start
Manual Usage
import freeflowuniverse.herolib.installers.horus.osirisrunner as osirisrunner_installer
mut osirisrunner := osirisrunner_installer.get()!
osirisrunner.install()!
osirisrunner.start()!
Configuration
!!osirisrunner.configure
name:'default'
binary_path:'/hero/var/bin/osirisrunner'
redis_addr:'127.0.0.1:6379'
log_level:'info'
repo_path:'/root/code/git.ourworld.tf/herocode/horus'
Configuration Fields
- name: Instance name (default: 'default')
- binary_path: Path where the osirisrunner binary will be installed (default: '/hero/var/bin/osirisrunner')
- redis_addr: Redis server address (default: '127.0.0.1:6379')
- log_level: Rust log level - trace, debug, info, warn, error (default: 'info')
- repo_path: Path to clone the horus repository (default: '/root/code/git.ourworld.tf/herocode/horus')
Commands
Install
Builds the osirisrunner binary from the horus workspace. This will:1. Install Rust if not present2. Clone the horus repository from git.ourworld.tf3. Build the osirisrunner binary with cargo build -p runner-osiris --release
hero osirisrunner.install
Start
Starts the osirisrunner service using zinit:
hero osirisrunner.start
Stop
Stops the running service:
hero osirisrunner.stop
Restart
Restarts the service:
hero osirisrunner.restart
Destroy
Stops the service and removes all files:
hero osirisrunner.destroy
Requirements
- Dependencies:
- Rust toolchain (automatically installed)
- Git (for cloning repository)
- Redis (must be running separately)
Architecture
The installer follows the standard herolib installer pattern:
- osirisrunner_model.v: Configuration structure and initialization
- osirisrunner_actions.v: Build, install, start, stop, destroy logic
- osirisrunner_factory_.v: Factory pattern for instance management
Notes
- The installer builds from source rather than downloading pre-built binaries
- Redis must be running and accessible at the configured address
- The binary is built with
RUSTFLAGS="-A warnings"to suppress warnings - Service management uses zinit by default
fn delete #
fn delete(args ArgsGet) !
fn exists #
fn exists(args ArgsGet) !bool
does the config exists?
fn get #
fn get(args ArgsGet) !&Osirisrunner
fn heroscript_dumps #
fn heroscript_dumps(obj Osirisrunner) !string
///////////NORMALLY NO NEED TO TOUCH
fn heroscript_loads #
fn heroscript_loads(heroscript string) !Osirisrunner
fn list #
fn list(args ArgsList) ![]&Osirisrunner
if fromdb set: load from filesystem, and not from mem, will also reset what is in mem
fn new #
fn new(args ArgsGet) !&Osirisrunner
fn play #
fn play(mut plbook PlayBook) !
fn set #
fn set(o Osirisrunner) !
register the config for the future
fn switch #
fn switch(name string)
switch instance to be used for osirisrunner
struct ArgsGet #
struct ArgsGet {
pub mut:
name string = 'default'
binary_path string
redis_addr string
log_level string
repo_path string
fromdb bool // will load from filesystem
create bool // default will not create if not exist
}
///////FACTORY
struct ArgsList #
struct ArgsList {
pub mut:
fromdb bool // will load from filesystem
}
struct InstallArgs #
struct InstallArgs {
pub mut:
reset bool
}
struct Osirisrunner #
struct Osirisrunner {
pub mut:
name string = 'default'
binary_path string = os.join_path(os.home_dir(), 'hero/bin/runner_osiris')
redis_addr string = '127.0.0.1:6379'
log_level string = 'info'
repo_path string = '/root/code/git.ourworld.tf/herocode/horus'
}
THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED
fn (Osirisrunner) install_start #
fn (mut self Osirisrunner) install_start(args InstallArgs) !
fn (Osirisrunner) reload #
fn (mut self Osirisrunner) reload() !
load from disk and make sure is properly intialized
fn (Osirisrunner) restart #
fn (mut self Osirisrunner) restart(args StartArgs) !
fn (Osirisrunner) running #
fn (mut self Osirisrunner) running() !bool
fn (Osirisrunner) start #
fn (mut self Osirisrunner) start(args StartArgs) !
fn (Osirisrunner) stop #
fn (mut self Osirisrunner) stop() !
struct StartArgs #
struct StartArgs {
pub mut:
reset bool
}