From 35ea035bd54d34b56811b051ec316aedbd4dcc52 Mon Sep 17 00:00:00 2001 From: Timur Gordon <31495328+timurgordon@users.noreply.github.com> Date: Tue, 4 Nov 2025 17:05:17 +0100 Subject: [PATCH] Add build.sh and run.sh scripts for osiris runner - Added build.sh that builds runner_osiris binary in release mode - Added run.sh that builds first, then starts the runner - Fixed binary name from osiris_runner to runner_osiris - Scripts use RUSTFLAGS to suppress warnings - Runner configured via environment variables (RUNNER_ID, REDIS_URL, BASE_DB_ID) --- Cargo.lock | 29 +++++++++++++++++++++++++++-- Cargo.toml | 1 + scripts/build.sh | 11 +++++++++++ scripts/run.sh | 23 +++++++++++++++++++++++ src/lib.rs | 3 ++- 5 files changed, 64 insertions(+), 3 deletions(-) create mode 100755 scripts/build.sh create mode 100755 scripts/run.sh diff --git a/Cargo.lock b/Cargo.lock index e015edd..8641b19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1290,14 +1290,27 @@ dependencies = [ "chrono", "hex", "log", - "redis 0.25.4", "secp256k1", "serde", + "serde-wasm-bindgen", "serde_json", "sha2", "thiserror 1.0.69", - "tokio", "uuid", + "wasm-bindgen", +] + +[[package]] +name = "hero-job-client" +version = "0.1.0" +dependencies = [ + "chrono", + "hero-job", + "log", + "redis 0.25.4", + "serde_json", + "thiserror 1.0.69", + "tokio", ] [[package]] @@ -3262,6 +3275,7 @@ dependencies = [ "clap", "env_logger", "hero-job", + "hero-job-client", "hero_logger", "heromodels", "heromodels-derive", @@ -3767,6 +3781,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_core" version = "1.0.228" diff --git a/Cargo.toml b/Cargo.toml index 792b057..bba6f16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,6 +53,7 @@ rand = "0.8" # Core hero dependencies hero_logger = { git = "https://git.ourworld.tf/herocode/baobab.git", branch = "logger" } hero-job = { path = "../job/rust" } +hero-job-client = { path = "../job/rust/client" } # hero-job = { git = "https://git.ourworld.tf/herocode/job.git", subdirectory = "rust" } # Osiris dependencies (used by runner_osiris binary) diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..e7df1a9 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +PROJECT_DIR=$(cd "$SCRIPT_DIR/.." && pwd) + +echo "Building Osiris Runner..." +cd "$PROJECT_DIR" +RUSTFLAGS="-A warnings" cargo build --release --bin runner_osiris + +echo "✅ Osiris Runner built successfully" diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100755 index 0000000..354991e --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +PROJECT_DIR=$(cd "$SCRIPT_DIR/.." && pwd) + +# Build first +"$SCRIPT_DIR/build.sh" + +# Configuration +RUNNER_ID="${RUNNER_ID:-osiris}" +REDIS_URL="${REDIS_URL:-redis://localhost:6379}" +BASE_DB_ID="${BASE_DB_ID:-1}" +LOG_LEVEL="${LOG_LEVEL:-info}" + +echo "Starting Osiris Runner..." +cd "$PROJECT_DIR" + +RUST_LOG="$LOG_LEVEL" RUST_LOG_STYLE=never \ +exec target/release/runner_osiris \ + --redis-url "$REDIS_URL" \ + --base-db-id "$BASE_DB_ID" \ + "$RUNNER_ID" diff --git a/src/lib.rs b/src/lib.rs index 2c3517c..1d0c8ad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,8 @@ pub use async_runner::{AsyncRunner, spawn_async_runner}; pub use sync_runner::{SyncRunner, SyncRunnerConfig, spawn_sync_runner}; // Re-export job types from hero-job crate -pub use hero_job::{Job, JobStatus, JobError, JobBuilder, JobSignature, Client, ClientBuilder}; +pub use hero_job::{Job, JobStatus, JobError, JobBuilder, JobSignature}; +pub use hero_job_client::{Client, ClientBuilder}; pub use redis::AsyncCommands; use log::{error, info};