feat: Replace TCP bridges with Hero Router for cross-node communication (Phase 2) #69
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_compute#69
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Follows from #65 (Phase 1 — HTTP-over-UDS migration). hero_compute's multi-node deployment (master/worker mode) currently uses in-process TCP bridges for cross-node communication:
These are raw TCP forwarders baked into each binary. They bypass Hero's standard networking layer (Hero Router), have no encryption, no authentication, and no service discovery.
Objective
Replace the custom TCP bridges with Hero Router as the single network entry point per node. Each node runs
hero_routeron a single port, which discovers local Unix sockets and routes incoming HTTP requests to the correct service.Architecture Change
Before (TCP Bridges)
Two custom TCP ports per node, raw byte forwarding, no discovery.
After (Hero Router)
Single entry point per node, HTTP routing, service discovery, context headers.
Implementation Plan
1. Remove TCP bridge code
crates/hero_compute_server/src/main.rs: Removetcp_bridge()function and--tcp-portCLI argcrates/hero_compute_explorer/src/main.rs: Removetcp_bridge()function and--tcp-portCLI argMAX_BRIDGE_CONNECTIONSconstant2. Update NodeProxy to route through Hero Router
crates/hero_compute_explorer/src/explorer/proxy.rs: Updatecall_tcp()to send HTTP POST through Hero Router URL instead of raw TCPhttp://worker-ip:9998/hero_compute/rpc/api/root/cloud/rpc(Hero Router path)3. Update heartbeat sender
crates/hero_compute_server/src/heartbeat_sender.rs: Updatesend_tcp()to send HTTP POST through Hero Routerhttp://master-ip:9998/hero_compute/explorer_rpc/api/root/explorer/rpc4. Update CLI and .env generation
crates/hero_compute/src/main.rs: Remove--rpc-portand--explorer-portflagswrite_env():EXPLORER_ADDRESSESuses Hero Router URL formatHERO_COMPUTE_ADVERTISE_ADDRESSformat--portfor UI (still needs direct TCP for WebSocket console)5. Update documentation
Socket Discovery
Hero Router auto-discovers services by scanning
$HERO_SOCKET_DIR/. With the Phase 1 layout:No registration code needed — Hero Router finds the sockets automatically.
What Stays
Dependencies
hero_routeras a dependencyAcceptance Criteria
cargo build --workspacesucceedscargo test --workspacepasses--rpc-portand--explorer-portCLI flags removedReferences
Implementation committed:
53e5d3fPR: #71
Browse:
53e5d3f