No description
  • Rust 76.9%
  • Shell 10%
  • JavaScript 7.5%
  • HTML 3.8%
  • CSS 1.8%
Find a file
despiegk a369fae587
Some checks failed
Test / test (push) Failing after 16s
Build Linux / build-linux (x86_64-unknown-linux-musl, false, x86_64-unknown-linux-musl) (push) Failing after 24s
Build Linux / build-linux (aarch64-unknown-linux-gnu, true, aarch64-unknown-linux-gnu) (push) Failing after 34s
feat(bundle): add --test mode with isolated paths and fix service var_dir routing
Introduces a `--test` flag that roots all data, sockets, and the router
port under `~/hero_test/` so a test instance runs fully alongside the
production one. Key changes:

- `config::load()` now accepts `test_mode: bool` and fills in
  hero_test defaults (sockets, var_dir, router port 19988, mycelium
  state) for any field not already set by the config file or env.
- `var_dir()` becomes config-aware (was a zero-arg global default);
  all callers in services.rs updated to pass `cfg`.
- Mycelium RPC socket is derived from the bundle socket_dir so
  test/prod instances each get their own socket.
- Dashboard health-check URLs fixed to use canonical
  `/<service>/<socket>/health` paths with an explicit `socket` field
  per service entry.
- Cargo.toml `[patch]` sections added to unify `hero_admin_lib` across
  transitive git deps during development.
- Build logs and updated build map/report committed for aarch64-apple-darwin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 22:40:44 +02:00
.forgejo/workflows feat(bundle): first version of in-process supervisor 2026-05-10 11:45:10 +02:00
.hero feat(bundle): add --test mode with isolated paths and fix service var_dir routing 2026-05-10 22:40:44 +02:00
crates feat(bundle): add --test mode with isolated paths and fix service var_dir routing 2026-05-10 22:40:44 +02:00
docs feat(bundle): first version of in-process supervisor 2026-05-10 11:45:10 +02:00
scripts feat(bundle): first version of in-process supervisor 2026-05-10 11:45:10 +02:00
.gitignore feat(bundle): first version of in-process supervisor 2026-05-10 11:45:10 +02:00
Cargo.lock feat(bundle): add --test mode with isolated paths and fix service var_dir routing 2026-05-10 22:40:44 +02:00
Cargo.toml feat(bundle): add --test mode with isolated paths and fix service var_dir routing 2026-05-10 22:40:44 +02:00
Cargo.toml.hero_builder_backup refactor(workspace): migrate to multi-crate layout with admin UI and integration tests 2026-05-10 21:04:27 +02:00
LICENSE feat(bundle): first version of in-process supervisor 2026-05-10 11:45:10 +02:00
README.md feat(bundle): add --test mode with isolated paths and fix service var_dir routing 2026-05-10 22:40:44 +02:00
rust-toolchain.toml feat(bundle): first version of in-process supervisor 2026-05-10 11:45:10 +02:00

hero_bundle

A single binary that runs the core Hero services in-process as independent tokio tasks. From the outside, every bundled service binds the same Unix sockets and exposes the same OpenRPC, REST, and admin/UI interfaces it would when launched standalone — clients cannot tell the difference.

New here? Start with concepts for what the bundle is and how it differs from running each service as its own OS process.

How It Works

hero_bundle links each service crate as a Rust library and spawns it on the shared tokio runtime. There is no IPC between bundled services for lifecycle purposes, no fork/exec, and no external supervisor. A single CancellationToken plus a SIGINT/SIGTERM watcher drives shutdown; each task is then joined with a 30-second timeout.

Bundled services and their library crates:

Service Crate Role
mycelium mycelium_daemon Local message bus (TUN forced off, not a node)
hero_db hero_db_server Encrypted Redis-compatible storage backend
hero_indexer hero_indexer_server Document/index service
hero_code hero_code_server Script and editor service
hero_proc hero_proc_server Process supervisor for external processes
hero_router hero_router TCP entry point and per-service router

hero_proc is bundled as one of the services and continues to supervise external processes via fork/exec exactly as it does standalone. It does not supervise its bundled siblings — the bundle owns those tasks directly.

Requirements

  • Rust 1.95+
  • Sibling repos checked out next to this one (../hero_proc, ../hero_db, ../hero_code, ../hero_indexer, ../hero_router, ../mycelium_network). All service crates are path dependencies.

Quick Start

cargo build --release --workspace
./target/release/hero_bundle

With a custom config:

./target/release/hero_bundle --config ~/hero/cfg/hero_bundle.toml

The default config path is ~/hero/cfg/hero_bundle.toml. If that file does not exist, the bundle starts with built-in defaults.

Service Architecture

Binary Type Description
hero_bundle daemon Single process hosting all bundled services in-proc

Each bundled service still binds its own Unix sockets under $HERO_SOCKET_DIR/<service>/... (default ~/hero/var/sockets) and writes to its own log target under ~/hero/var/logs/<service>/....

Configuration

See docs/configuration.md for the full TOML schema and the environment variables the bundle honours.

Test Mode

Run a second instance alongside a production one without any path or port conflicts:

hero_bundle --test

Everything is rooted under ~/hero_test/ instead of ~/hero/:

Resource Standard --test
Sockets ~/hero/var/sockets/ ~/hero_test/var/sockets/
Data / DB ~/hero/var/ ~/hero_test/var/
Mycelium state ~/hero/var/mycelium/ ~/hero_test/var/mycelium/
Router port 9988 19988

All values are still individually overridable by the config file or HERO_SOCKET_DIR env var — --test only fills in defaults for anything not already set. The startup banner shows [TEST MODE] and prints the active paths.

Troubleshooting

A service refuses to bind its socket — another process (likely the standalone version of that service) already owns the path. Stop it before launching the bundle.

Slow startup — services start in order with a 200 ms stagger. Check the banner and per-service tracing output to see where startup is blocking.

Shutdown timed out after 30s — one of the bundled tasks did not honour the cancellation token within the join window. The bundle still exits; check the offending service's logs.

Documentation

License

Apache-2.0