feat: Replace TCP bridges with Hero Router for cross-node communication #71

Merged
mahmoud merged 5 commits from development_hero_router into development 2026-04-07 09:39:04 +00:00
Owner

Summary

Phase 2 of #65. Removes in-process TCP bridges (ports 9002/9003) and routes all cross-node communication through Hero Router (port 9998).

Builds on top of development_hero_socket (Phase 1 — HTTP-over-UDS migration). Merge Phase 1 first.

Changes

  • Removed: tcp_bridge() from server and explorer binaries
  • Removed: --tcp-port, --rpc-port, --explorer-port CLI flags
  • Added: SDK helpers for Hero Router URL construction (router_server_rpc_url(), router_explorer_rpc_url(), http_rpc_tcp())
  • Updated: NodeProxy.call_tcp() → routes through Hero Router HTTP URLs
  • Updated: Heartbeat sender → sends via Hero Router to remote explorers
  • Updated: .env generation → EXPLORER_ADDRESSES and ADVERTISE_ADDRESS use http:// Hero Router URLs
  • Kept: UI TCP port 9001 for WebSocket console sessions

Architecture (Before → After)

Before: Two custom TCP ports per node (9002 explorer, 9003 server), raw byte forwarding

Master explorer ←─TCP:9002── Worker heartbeat
Master explorer ──TCP:9003─→ Worker server

After: Single Hero Router entry point per node, HTTP routing with service discovery

Master hero_router:9998 → local explorer_rpc.sock
Worker hero_router:9998 → local rpc.sock

Dependencies

  • Requires development_hero_socket (Phase 1) to be merged first
  • Hero Router must be installed and running on each node for multi-node mode

Test plan

  • cargo build --workspace passes
  • cargo test --workspace passes (33 passed, 0 failed)
  • make lint passes
  • Single node (local) mode works unchanged
  • Multi-node master/worker with Hero Router running

Closes #69

## Summary Phase 2 of #65. Removes in-process TCP bridges (ports 9002/9003) and routes all cross-node communication through Hero Router (port 9998). Builds on top of `development_hero_socket` (Phase 1 — HTTP-over-UDS migration). Merge Phase 1 first. ## Changes - **Removed**: `tcp_bridge()` from server and explorer binaries - **Removed**: `--tcp-port`, `--rpc-port`, `--explorer-port` CLI flags - **Added**: SDK helpers for Hero Router URL construction (`router_server_rpc_url()`, `router_explorer_rpc_url()`, `http_rpc_tcp()`) - **Updated**: `NodeProxy.call_tcp()` → routes through Hero Router HTTP URLs - **Updated**: Heartbeat sender → sends via Hero Router to remote explorers - **Updated**: `.env` generation → `EXPLORER_ADDRESSES` and `ADVERTISE_ADDRESS` use `http://` Hero Router URLs - **Kept**: UI TCP port 9001 for WebSocket console sessions ## Architecture (Before → After) **Before**: Two custom TCP ports per node (9002 explorer, 9003 server), raw byte forwarding ``` Master explorer ←─TCP:9002── Worker heartbeat Master explorer ──TCP:9003─→ Worker server ``` **After**: Single Hero Router entry point per node, HTTP routing with service discovery ``` Master hero_router:9998 → local explorer_rpc.sock Worker hero_router:9998 → local rpc.sock ``` ## Dependencies - Requires `development_hero_socket` (Phase 1) to be merged first - Hero Router must be installed and running on each node for multi-node mode ## Test plan - [x] `cargo build --workspace` passes - [x] `cargo test --workspace` passes (33 passed, 0 failed) - [x] `make lint` passes - [ ] Single node (local) mode works unchanged - [ ] Multi-node master/worker with Hero Router running Closes #69
feat(sockets): align with Hero Socket Convention -- HTTP over UDS + standardized layout
All checks were successful
Test / test (push) Successful in 1m28s
Test / test (pull_request) Successful in 1m58s
367356c0a8
Migrate hero_compute from raw newline-delimited JSON-RPC via UnixRpcServer
to HTTP-over-UDS via AxumRpcServer with standardized socket directory layout
under $HERO_SOCKET_DIR/hero_compute/.

- Replace UnixRpcServer with AxumRpcServer in server and explorer
- Add SDK path helpers: socket_dir(), server_socket_path(), ui_socket_path(),
  explorer_socket_path()
- Replace raw_rpc_unix() with http_rpc_unix() (HTTP/1.1 POST over UDS)
- Add connect_server_socket() for correct /api/root/cloud/rpc path
- Add protocol: "openrpc" to heroservice.json for hero_router discovery
- Standardize HERO_COMPUTE_EXPLORER_SOCKET env var across all crates
- Update all documentation: protocol descriptions, socket paths, examples
- TCP bridges preserved for multi-node (Phase 2 removes them)

Socket layout:
  ~/hero/var/sockets/hero_compute/rpc.sock          (server)
  ~/hero/var/sockets/hero_compute/ui.sock            (dashboard)
  ~/hero/var/sockets/hero_compute/explorer_rpc.sock  (explorer)

#65
feat: replace TCP bridges with Hero Router for cross-node communication
All checks were successful
Test / test (pull_request) Successful in 1m27s
Test / test (push) Successful in 1m48s
53e5d3f8fd
Remove in-process TCP bridges (ports 9002/9003) from server and explorer
binaries. Cross-node communication now routes through Hero Router (port 9998)
which auto-discovers local Unix sockets and provides HTTP routing.

- Remove tcp_bridge() functions from server and explorer
- Remove --tcp-port, --rpc-port, --explorer-port CLI flags
- Add SDK helpers: router_server_rpc_url(), router_explorer_rpc_url(),
  http_rpc_tcp(), HERO_ROUTER_PORT
- Update NodeProxy.call_tcp() to route through Hero Router URLs
- Update heartbeat sender to use Hero Router for remote explorers
- Update .env generation: EXPLORER_ADDRESSES and ADVERTISE_ADDRESS
  now use http:// Hero Router URLs instead of tcp:// bridge addresses
- Update validation in rpc.rs to accept http:// URLs
- Update all documentation

UI TCP port (9001) preserved for WebSocket console sessions.

#69
merge: resolve conflicts with development (env_file_path, Cargo.toml duplicates)
All checks were successful
Test / test (push) Successful in 2m7s
Test / test (pull_request) Successful in 2m23s
3f324aeb8a
Merge branch 'development' into development_hero_router
All checks were successful
Test / test (pull_request) Successful in 1m48s
Test / test (push) Successful in 2m43s
de10a3936c
merge: resolve conflicts after Phase 1 socket branch merged to development
All checks were successful
Test / test (push) Successful in 2m59s
Test / test (pull_request) Successful in 3m1s
29e1543070
mahmoud merged commit 75f0164e5f into development 2026-04-07 09:39:04 +00:00
mahmoud deleted branch development_hero_router 2026-04-07 09:39:09 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_compute!71
No description provided.