feat: Align with Hero Socket Convention — HTTP over UDS + standardized socket layout #65

Open
opened 2026-04-06 15:06:38 +00:00 by mahmoud · 4 comments
Owner

Context

Per Kristof's architecture mandate, all Hero services must:

  • Use HTTP over Unix Domain Sockets (no raw protocols)
  • Follow standardized socket naming ($HERO_SOCKET_DIR/<service>/<type>.sock)
  • Integrate with Hero Router (local discovery) and Hero Proxy (external security)

hero_compute currently uses raw newline-delimited JSON-RPC via UnixRpcServer with flat socket files (hero_compute_server.sock). This needs to become HTTP-over-UDS via AxumRpcServer with proper directory layout.

Two-Phase Approach

Phase 1: Socket Layout + HTTP-over-UDS Migration (this issue)

Phase 2: Replace TCP Bridges with Hero Proxy (future issue)


Phase 1 Tasks

1.1 — SDK: Update socket constants and helpers

File: crates/hero_compute_sdk/src/lib.rs

  • Replace SERVER_SOCKET_NAME and UI_SOCKET_NAME constants with path helper functions
  • Add socket_dir() helper reading HERO_SOCKET_DIR env var (default ~/hero/var/sockets)
  • Add rpc_socket_path()$HERO_SOCKET_DIR/hero_compute/rpc.sock
  • Add ui_socket_path()$HERO_SOCKET_DIR/hero_compute/ui.sock
  • Add explorer_rpc_socket_path()$HERO_SOCKET_DIR/hero_compute/explorer_rpc.sock
  • Update raw_rpc_unix() to use HTTP POST over UDS (server will now speak HTTP)
  • Update doc example to use new path helpers

1.2 — Server: Switch from UnixRpcServer to AxumRpcServer

File: crates/hero_compute_server/src/main.rs

Replace:

let server = UnixRpcServer::new();
server.register_app("root", "cloud", domain.clone()).await?;
server.run(vec![("root".to_string(), socket_path)]).await?;

With:

let config = RpcServerConfig::new()
    .listen_addr(socket_path.to_string_lossy().as_ref());
let server = AxumRpcServer::new(config).await?;
server.register_app("root", "cloud", domain.clone()).await?;
server.run().await?;
  • Use SDK's rpc_socket_path() instead of hardcoded path
  • Switch to AxumRpcServer (HTTP over UDS)
  • Remove manual create_dir_all for socket parent (AxumRpcServer handles this)
  • Keep TCP bridge for now (phase 2 removes it)

File: crates/hero_compute_server/src/config.rs

  • Remove server_socket_name field and HERO_COMPUTE_SERVER_SOCKET_NAME env var
  • Update tests

1.3 — Explorer: Switch from UnixRpcServer to AxumRpcServer

File: crates/hero_compute_explorer/src/main.rs

  • Same AxumRpcServer migration as server
  • Socket path: $HERO_SOCKET_DIR/hero_compute/explorer_rpc.sock
  • Keep TCP bridge (phase 2)

File: crates/hero_compute_explorer/src/config.rs

  • Remove explorer_socket_name field and HERO_COMPUTE_EXPLORER_SOCKET_NAME env var
  • Update tests

File: crates/hero_compute_explorer/src/explorer/proxy.rs

  • Update NodeProxy::call_unix() to use HTTP POST over UDS instead of raw JSON-RPC
  • call_tcp() stays for now (phase 2)

1.4 — UI: Update socket path references

File: crates/hero_compute_ui/src/server.rs

  • default_server_socket() → use SDK's rpc_socket_path()
  • default_explorer_socket() → use SDK's explorer_rpc_socket_path()
  • UI's own socket: $HERO_SOCKET_DIR/hero_compute/ui.sock
  • Update RPC proxy handlers to forward HTTP POST (not raw JSON-RPC)
  • Keep TCP port binding (9001) — needed for console WebSocket sessions
  • Update health check hero_proc socket reference

1.5 — CLI: Update socket references and .env generation

File: crates/hero_compute/src/main.rs

  • Use SDK path helpers for all socket references
  • Update .env generation: EXPLORER_ADDRESSES in master mode uses new path
  • Remove old socket name env vars from managed list
  • Update hero_proc health check and kill_other socket paths

1.6 — Examples: Update socket paths

Files: crates/hero_compute_examples/examples/basic_usage.rs, health.rs

  • Use SDK's rpc_socket_path() instead of hardcoded paths

1.7 — Config files and metadata

  • .env.example: Remove old socket name vars, add HERO_SOCKET_DIR docs
  • heroservice.json: Update socket path and protocol
  • Cargo.toml (workspace): Verify hero_rpc_osis features for AxumRpcServer

1.8 — Heartbeat sender: Update for HTTP

File: crates/hero_compute_server/src/heartbeat_sender.rs

  • For unix explorer addresses, switch to HTTP POST over UDS
  • For TCP addresses (cross-node), keep raw for now (phase 2)
  • Update own_socket_path in heartbeat payload to new path

Socket Layout (Before → After)

Before:

~/hero/var/sockets/hero_compute_server.sock    (raw JSON-RPC)
~/hero/var/sockets/hero_compute_ui.sock        (HTTP)
~/hero/var/sockets/hero_compute_explorer.sock  (raw JSON-RPC)

After:

~/hero/var/sockets/hero_compute/rpc.sock           (HTTP — server)
~/hero/var/sockets/hero_compute/ui.sock            (HTTP — dashboard)
~/hero/var/sockets/hero_compute/explorer_rpc.sock  (HTTP — explorer)

Key Technical Details

  • AxumRpcServer from hero_rpc_osis is a drop-in replacement for UnixRpcServerregister_app() has the identical signature
  • hero_rpc commit a0f4a08 (2026-04-06) added full hero_sockets compliance with X-Hero-Context, X-Hero-Claims, X-Forwarded-Prefix header extraction
  • TCP bridges (ports 9002/9003) and UI TCP port (9001) are kept — removal is Phase 2

Verification

  1. cargo build --workspace compiles
  2. cargo test --workspace passes
  3. Sockets created at ~/hero/var/sockets/hero_compute/{rpc,ui,explorer_rpc}.sock
  4. curl --unix-socket ~/hero/var/sockets/hero_compute/rpc.sock http://localhost/health returns OK
  5. hero_router auto-discovers hero_compute's rpc.sock
  6. UI dashboard at http://localhost:9001 still works
  7. Multi-node master/worker mode still works (TCP bridges preserved)
## Context Per Kristof's architecture mandate, all Hero services must: - Use **HTTP over Unix Domain Sockets** (no raw protocols) - Follow **standardized socket naming** (`$HERO_SOCKET_DIR/<service>/<type>.sock`) - Integrate with **Hero Router** (local discovery) and **Hero Proxy** (external security) hero_compute currently uses raw newline-delimited JSON-RPC via `UnixRpcServer` with flat socket files (`hero_compute_server.sock`). This needs to become HTTP-over-UDS via `AxumRpcServer` with proper directory layout. ## Two-Phase Approach ### Phase 1: Socket Layout + HTTP-over-UDS Migration (this issue) ### Phase 2: Replace TCP Bridges with Hero Proxy (future issue) --- ## Phase 1 Tasks ### 1.1 — SDK: Update socket constants and helpers **File:** `crates/hero_compute_sdk/src/lib.rs` - [x] Replace `SERVER_SOCKET_NAME` and `UI_SOCKET_NAME` constants with path helper functions - [x] Add `socket_dir()` helper reading `HERO_SOCKET_DIR` env var (default `~/hero/var/sockets`) - [x] Add `rpc_socket_path()` → `$HERO_SOCKET_DIR/hero_compute/rpc.sock` - [x] Add `ui_socket_path()` → `$HERO_SOCKET_DIR/hero_compute/ui.sock` - [x] Add `explorer_rpc_socket_path()` → `$HERO_SOCKET_DIR/hero_compute/explorer_rpc.sock` - [x] Update `raw_rpc_unix()` to use HTTP POST over UDS (server will now speak HTTP) - [x] Update doc example to use new path helpers ### 1.2 — Server: Switch from UnixRpcServer to AxumRpcServer **File:** `crates/hero_compute_server/src/main.rs` Replace: ```rust let server = UnixRpcServer::new(); server.register_app("root", "cloud", domain.clone()).await?; server.run(vec![("root".to_string(), socket_path)]).await?; ``` With: ```rust let config = RpcServerConfig::new() .listen_addr(socket_path.to_string_lossy().as_ref()); let server = AxumRpcServer::new(config).await?; server.register_app("root", "cloud", domain.clone()).await?; server.run().await?; ``` - [x] Use SDK's `rpc_socket_path()` instead of hardcoded path - [x] Switch to `AxumRpcServer` (HTTP over UDS) - [x] Remove manual `create_dir_all` for socket parent (AxumRpcServer handles this) - [x] Keep TCP bridge for now (phase 2 removes it) **File:** `crates/hero_compute_server/src/config.rs` - [x] Remove `server_socket_name` field and `HERO_COMPUTE_SERVER_SOCKET_NAME` env var - [x] Update tests ### 1.3 — Explorer: Switch from UnixRpcServer to AxumRpcServer **File:** `crates/hero_compute_explorer/src/main.rs` - [x] Same AxumRpcServer migration as server - [x] Socket path: `$HERO_SOCKET_DIR/hero_compute/explorer_rpc.sock` - [x] Keep TCP bridge (phase 2) **File:** `crates/hero_compute_explorer/src/config.rs` - [x] Remove `explorer_socket_name` field and `HERO_COMPUTE_EXPLORER_SOCKET_NAME` env var - [x] Update tests **File:** `crates/hero_compute_explorer/src/explorer/proxy.rs` - [x] Update `NodeProxy::call_unix()` to use HTTP POST over UDS instead of raw JSON-RPC - [x] `call_tcp()` stays for now (phase 2) ### 1.4 — UI: Update socket path references **File:** `crates/hero_compute_ui/src/server.rs` - [x] `default_server_socket()` → use SDK's `rpc_socket_path()` - [x] `default_explorer_socket()` → use SDK's `explorer_rpc_socket_path()` - [x] UI's own socket: `$HERO_SOCKET_DIR/hero_compute/ui.sock` - [x] Update RPC proxy handlers to forward HTTP POST (not raw JSON-RPC) - [x] Keep TCP port binding (9001) — needed for console WebSocket sessions - [x] Update health check hero_proc socket reference ### 1.5 — CLI: Update socket references and .env generation **File:** `crates/hero_compute/src/main.rs` - [x] Use SDK path helpers for all socket references - [ ] Update `.env` generation: `EXPLORER_ADDRESSES` in master mode uses new path - [ ] Remove old socket name env vars from managed list - [ ] Update hero_proc health check and kill_other socket paths ### 1.6 — Examples: Update socket paths **Files:** `crates/hero_compute_examples/examples/basic_usage.rs`, `health.rs` - [ ] Use SDK's `rpc_socket_path()` instead of hardcoded paths ### 1.7 — Config files and metadata - [ ] `.env.example`: Remove old socket name vars, add `HERO_SOCKET_DIR` docs - [ ] `heroservice.json`: Update socket path and protocol - [ ] `Cargo.toml` (workspace): Verify `hero_rpc_osis` features for AxumRpcServer ### 1.8 — Heartbeat sender: Update for HTTP **File:** `crates/hero_compute_server/src/heartbeat_sender.rs` - [ ] For unix explorer addresses, switch to HTTP POST over UDS - [ ] For TCP addresses (cross-node), keep raw for now (phase 2) - [ ] Update `own_socket_path` in heartbeat payload to new path --- ## Socket Layout (Before → After) **Before:** ``` ~/hero/var/sockets/hero_compute_server.sock (raw JSON-RPC) ~/hero/var/sockets/hero_compute_ui.sock (HTTP) ~/hero/var/sockets/hero_compute_explorer.sock (raw JSON-RPC) ``` **After:** ``` ~/hero/var/sockets/hero_compute/rpc.sock (HTTP — server) ~/hero/var/sockets/hero_compute/ui.sock (HTTP — dashboard) ~/hero/var/sockets/hero_compute/explorer_rpc.sock (HTTP — explorer) ``` ## Key Technical Details - `AxumRpcServer` from `hero_rpc_osis` is a **drop-in replacement** for `UnixRpcServer` — `register_app()` has the identical signature - `hero_rpc` commit `a0f4a08` (2026-04-06) added full hero_sockets compliance with `X-Hero-Context`, `X-Hero-Claims`, `X-Forwarded-Prefix` header extraction - TCP bridges (ports 9002/9003) and UI TCP port (9001) are **kept** — removal is Phase 2 ## Verification 1. `cargo build --workspace` compiles 2. `cargo test --workspace` passes 3. Sockets created at `~/hero/var/sockets/hero_compute/{rpc,ui,explorer_rpc}.sock` 4. `curl --unix-socket ~/hero/var/sockets/hero_compute/rpc.sock http://localhost/health` returns OK 5. hero_router auto-discovers hero_compute's rpc.sock 6. UI dashboard at http://localhost:9001 still works 7. Multi-node master/worker mode still works (TCP bridges preserved)
Author
Owner

Implementation Spec for Issue #65

Objective

Migrate hero_compute from raw newline-delimited JSON-RPC via UnixRpcServer with flat socket files to HTTP-over-UDS via AxumRpcServer with standardized Hero socket directory layout under $HERO_SOCKET_DIR/hero_compute/.

Requirements

  • Replace UnixRpcServer with AxumRpcServer in server and explorer
  • Standardize socket layout: ~/hero/var/sockets/hero_compute/{rpc,ui,explorer_rpc}.sock
  • Replace raw newline-delimited transport with HTTP POST over UDS
  • Support HERO_SOCKET_DIR env var (default ~/hero/var/sockets)
  • Keep TCP bridges (ports 9001/9002/9003) operational (Phase 2 removal)

Socket Layout (Before → After)

Before After Protocol
~/hero/var/sockets/hero_compute_server.sock ~/hero/var/sockets/hero_compute/rpc.sock HTTP
~/hero/var/sockets/hero_compute_ui.sock ~/hero/var/sockets/hero_compute/ui.sock HTTP
~/hero/var/sockets/hero_compute_explorer.sock ~/hero/var/sockets/hero_compute/explorer_rpc.sock HTTP

Files to Modify

File Description
crates/hero_compute_sdk/src/lib.rs Add path helpers, rewrite transport to HTTP POST
crates/hero_compute_server/src/main.rs Switch to AxumRpcServer
crates/hero_compute_server/src/config.rs Update socket defaults
crates/hero_compute_server/src/heartbeat_sender.rs Switch heartbeats to HTTP POST
crates/hero_compute_explorer/src/main.rs Switch to AxumRpcServer
crates/hero_compute_explorer/src/config.rs Update socket defaults
crates/hero_compute_explorer/src/explorer/proxy.rs Switch proxy to HTTP POST
crates/hero_compute_ui/src/server.rs Update socket paths and RPC proxy
crates/hero_compute/src/main.rs Update CLI socket paths and .env generation
crates/hero_compute_examples/examples/basic_usage.rs Update socket paths
crates/hero_compute_examples/examples/health.rs Update socket paths
.env.example Update documentation
crates/hero_compute_server/heroservice.json Update socket path

Implementation Plan

Step 1: SDK -- Add Path Helpers and Rewrite Transport (Foundation)

Files: crates/hero_compute_sdk/src/lib.rs, crates/hero_compute_sdk/Cargo.toml

  • Replace SERVER_SOCKET_NAME/UI_SOCKET_NAME constants with socket_dir(), server_socket_path(), ui_socket_path(), explorer_socket_path() functions
  • Rewrite raw_rpc_unix() to HTTP POST over UDS using hyper
  • Add RPC path constants (SERVER_RPC_PATH, EXPLORER_RPC_PATH)
  • Dependencies: none

Step 2: Server -- Switch to AxumRpcServer

Files: crates/hero_compute_server/src/main.rs, config.rs

  • Replace UnixRpcServer with AxumRpcServer + RpcServerConfig
  • Use SDK server_socket_path() for socket path
  • Update config defaults and env vars
  • Dependencies: Step 1

Step 3: Explorer -- Switch to AxumRpcServer

Files: crates/hero_compute_explorer/src/main.rs, config.rs

  • Same migration as Step 2 for explorer
  • Socket path: explorer_socket_path()
  • Dependencies: Step 1

Step 4: Explorer Proxy + Heartbeat Sender -- HTTP Transport

Files: crates/hero_compute_explorer/src/explorer/proxy.rs, crates/hero_compute_server/src/heartbeat_sender.rs

  • Rewrite call_unix()/call_tcp() and send_unix()/send_tcp() to use HTTP POST
  • Dependencies: Step 1

Step 5: UI, CLI, Examples, Config Files -- Update All References

Files: crates/hero_compute_ui/src/server.rs, crates/hero_compute/src/main.rs, examples, .env.example, heroservice.json

  • Update all socket path references to use SDK helpers
  • Update RPC proxy handlers to use new transport
  • Update .env generation
  • Dependencies: Step 1

Acceptance Criteria

  • cargo build --workspace succeeds
  • cargo test --workspace passes
  • Sockets created at ~/hero/var/sockets/hero_compute/{rpc,ui,explorer_rpc}.sock
  • Server/explorer respond to HTTP POST on Unix sockets
  • SDK client communicates with AxumRpcServer
  • UI proxy correctly forwards via HTTP POST over UDS
  • Heartbeat works via HTTP POST over UDS
  • TCP bridges (9001/9002/9003) still function
  • HERO_SOCKET_DIR env var works

Notes

  • AxumRpcServer is a drop-in for UnixRpcServer -- register_app() has the same signature
  • RPC path: AxumRpcServer exposes /api/{context}/{domain}/rpc; SDK client connect_socket() must target this path
  • TCP bridge is protocol-agnostic (raw byte copy) -- no changes needed to bridge code itself
  • hyper 1 + hyper-util already in workspace for HTTP-over-UDS client
## Implementation Spec for Issue #65 ### Objective Migrate hero_compute from raw newline-delimited JSON-RPC via `UnixRpcServer` with flat socket files to HTTP-over-UDS via `AxumRpcServer` with standardized Hero socket directory layout under `$HERO_SOCKET_DIR/hero_compute/`. ### Requirements - Replace `UnixRpcServer` with `AxumRpcServer` in server and explorer - Standardize socket layout: `~/hero/var/sockets/hero_compute/{rpc,ui,explorer_rpc}.sock` - Replace raw newline-delimited transport with HTTP POST over UDS - Support `HERO_SOCKET_DIR` env var (default `~/hero/var/sockets`) - Keep TCP bridges (ports 9001/9002/9003) operational (Phase 2 removal) ### Socket Layout (Before → After) | Before | After | Protocol | |--------|-------|----------| | `~/hero/var/sockets/hero_compute_server.sock` | `~/hero/var/sockets/hero_compute/rpc.sock` | HTTP | | `~/hero/var/sockets/hero_compute_ui.sock` | `~/hero/var/sockets/hero_compute/ui.sock` | HTTP | | `~/hero/var/sockets/hero_compute_explorer.sock` | `~/hero/var/sockets/hero_compute/explorer_rpc.sock` | HTTP | ### Files to Modify | File | Description | |------|-------------| | `crates/hero_compute_sdk/src/lib.rs` | Add path helpers, rewrite transport to HTTP POST | | `crates/hero_compute_server/src/main.rs` | Switch to AxumRpcServer | | `crates/hero_compute_server/src/config.rs` | Update socket defaults | | `crates/hero_compute_server/src/heartbeat_sender.rs` | Switch heartbeats to HTTP POST | | `crates/hero_compute_explorer/src/main.rs` | Switch to AxumRpcServer | | `crates/hero_compute_explorer/src/config.rs` | Update socket defaults | | `crates/hero_compute_explorer/src/explorer/proxy.rs` | Switch proxy to HTTP POST | | `crates/hero_compute_ui/src/server.rs` | Update socket paths and RPC proxy | | `crates/hero_compute/src/main.rs` | Update CLI socket paths and .env generation | | `crates/hero_compute_examples/examples/basic_usage.rs` | Update socket paths | | `crates/hero_compute_examples/examples/health.rs` | Update socket paths | | `.env.example` | Update documentation | | `crates/hero_compute_server/heroservice.json` | Update socket path | ### Implementation Plan #### Step 1: SDK -- Add Path Helpers and Rewrite Transport (Foundation) **Files:** `crates/hero_compute_sdk/src/lib.rs`, `crates/hero_compute_sdk/Cargo.toml` - Replace `SERVER_SOCKET_NAME`/`UI_SOCKET_NAME` constants with `socket_dir()`, `server_socket_path()`, `ui_socket_path()`, `explorer_socket_path()` functions - Rewrite `raw_rpc_unix()` to HTTP POST over UDS using hyper - Add RPC path constants (`SERVER_RPC_PATH`, `EXPLORER_RPC_PATH`) - **Dependencies:** none #### Step 2: Server -- Switch to AxumRpcServer **Files:** `crates/hero_compute_server/src/main.rs`, `config.rs` - Replace `UnixRpcServer` with `AxumRpcServer` + `RpcServerConfig` - Use SDK `server_socket_path()` for socket path - Update config defaults and env vars - **Dependencies:** Step 1 #### Step 3: Explorer -- Switch to AxumRpcServer **Files:** `crates/hero_compute_explorer/src/main.rs`, `config.rs` - Same migration as Step 2 for explorer - Socket path: `explorer_socket_path()` - **Dependencies:** Step 1 #### Step 4: Explorer Proxy + Heartbeat Sender -- HTTP Transport **Files:** `crates/hero_compute_explorer/src/explorer/proxy.rs`, `crates/hero_compute_server/src/heartbeat_sender.rs` - Rewrite `call_unix()`/`call_tcp()` and `send_unix()`/`send_tcp()` to use HTTP POST - **Dependencies:** Step 1 #### Step 5: UI, CLI, Examples, Config Files -- Update All References **Files:** `crates/hero_compute_ui/src/server.rs`, `crates/hero_compute/src/main.rs`, examples, `.env.example`, `heroservice.json` - Update all socket path references to use SDK helpers - Update RPC proxy handlers to use new transport - Update .env generation - **Dependencies:** Step 1 ### Acceptance Criteria - [ ] `cargo build --workspace` succeeds - [ ] `cargo test --workspace` passes - [ ] Sockets created at `~/hero/var/sockets/hero_compute/{rpc,ui,explorer_rpc}.sock` - [ ] Server/explorer respond to HTTP POST on Unix sockets - [ ] SDK client communicates with AxumRpcServer - [ ] UI proxy correctly forwards via HTTP POST over UDS - [ ] Heartbeat works via HTTP POST over UDS - [ ] TCP bridges (9001/9002/9003) still function - [ ] `HERO_SOCKET_DIR` env var works ### Notes - `AxumRpcServer` is a drop-in for `UnixRpcServer` -- `register_app()` has the same signature - RPC path: AxumRpcServer exposes `/api/{context}/{domain}/rpc`; SDK client `connect_socket()` must target this path - TCP bridge is protocol-agnostic (raw byte copy) -- no changes needed to bridge code itself - hyper 1 + hyper-util already in workspace for HTTP-over-UDS client
Author
Owner

Test Results

  • Build: Pass
  • Unit tests: 32 passed, 0 failed
  • Integration tests: 25 ignored (require running infrastructure)
  • Doc tests: 1 passed, 5 ignored
  • Total: 33 passed, 0 failed, 30 ignored

All tests pass. No compilation warnings or errors.

## Test Results - **Build**: ✅ Pass - **Unit tests**: 32 passed, 0 failed - **Integration tests**: 25 ignored (require running infrastructure) - **Doc tests**: 1 passed, 5 ignored - **Total**: 33 passed, 0 failed, 30 ignored All tests pass. No compilation warnings or errors.
Author
Owner

Implementation Summary

Changes Made

SDK (crates/hero_compute_sdk/src/lib.rs)

  • Replaced SERVER_SOCKET_NAME/UI_SOCKET_NAME constants with path helper functions: socket_dir(), server_socket_path(), ui_socket_path(), explorer_socket_path()
  • Added SERVER_RPC_PATH and EXPLORER_RPC_PATH constants
  • Replaced raw_rpc_unix() with http_rpc_unix() — HTTP/1.1 POST over Unix Domain Socket

Server (crates/hero_compute_server/)

  • Switched from UnixRpcServer to AxumRpcServer with RpcServerConfig
  • Socket path: $HERO_SOCKET_DIR/hero_compute/rpc.sock
  • Removed server_socket_name config field and HERO_COMPUTE_SERVER_SOCKET_NAME env var
  • Updated heartbeat sender to use HTTP POST transport

Explorer (crates/hero_compute_explorer/)

  • Same UnixRpcServerAxumRpcServer migration
  • Socket path: $HERO_SOCKET_DIR/hero_compute/explorer_rpc.sock
  • Updated NodeProxy::call_unix() and call_tcp() to use HTTP POST transport
  • Updated config field to explorer_socket_path: PathBuf

UI (crates/hero_compute_ui/src/server.rs)

  • Updated default_server_socket(), default_explorer_socket(), and UI socket binding to use SDK helpers
  • Replaced all 5 raw_rpc_unix calls with http_rpc_unix

CLI (crates/hero_compute/src/main.rs)

  • Updated build_service_definition() and write_env() to use SDK path helpers

Examples — Updated socket paths to use SDK helpers

Config files — Updated .env.example and heroservice.json with new socket layout documentation

Socket Layout (Before → After)

Before After
hero_compute_server.sock (raw) hero_compute/rpc.sock (HTTP)
hero_compute_ui.sock (HTTP) hero_compute/ui.sock (HTTP)
hero_compute_explorer.sock (raw) hero_compute/explorer_rpc.sock (HTTP)

Notes

  • TCP bridges (ports 9001/9002/9003) preserved — removal is Phase 2
  • HERO_SOCKET_DIR env var supported with default ~/hero/var/sockets
## Implementation Summary ### Changes Made **SDK (`crates/hero_compute_sdk/src/lib.rs`)** - Replaced `SERVER_SOCKET_NAME`/`UI_SOCKET_NAME` constants with path helper functions: `socket_dir()`, `server_socket_path()`, `ui_socket_path()`, `explorer_socket_path()` - Added `SERVER_RPC_PATH` and `EXPLORER_RPC_PATH` constants - Replaced `raw_rpc_unix()` with `http_rpc_unix()` — HTTP/1.1 POST over Unix Domain Socket **Server (`crates/hero_compute_server/`)** - Switched from `UnixRpcServer` to `AxumRpcServer` with `RpcServerConfig` - Socket path: `$HERO_SOCKET_DIR/hero_compute/rpc.sock` - Removed `server_socket_name` config field and `HERO_COMPUTE_SERVER_SOCKET_NAME` env var - Updated heartbeat sender to use HTTP POST transport **Explorer (`crates/hero_compute_explorer/`)** - Same `UnixRpcServer` → `AxumRpcServer` migration - Socket path: `$HERO_SOCKET_DIR/hero_compute/explorer_rpc.sock` - Updated `NodeProxy::call_unix()` and `call_tcp()` to use HTTP POST transport - Updated config field to `explorer_socket_path: PathBuf` **UI (`crates/hero_compute_ui/src/server.rs`)** - Updated `default_server_socket()`, `default_explorer_socket()`, and UI socket binding to use SDK helpers - Replaced all 5 `raw_rpc_unix` calls with `http_rpc_unix` **CLI (`crates/hero_compute/src/main.rs`)** - Updated `build_service_definition()` and `write_env()` to use SDK path helpers **Examples** — Updated socket paths to use SDK helpers **Config files** — Updated `.env.example` and `heroservice.json` with new socket layout documentation ### Socket Layout (Before → After) | Before | After | |--------|-------| | `hero_compute_server.sock` (raw) | `hero_compute/rpc.sock` (HTTP) | | `hero_compute_ui.sock` (HTTP) | `hero_compute/ui.sock` (HTTP) | | `hero_compute_explorer.sock` (raw) | `hero_compute/explorer_rpc.sock` (HTTP) | ### Notes - TCP bridges (ports 9001/9002/9003) preserved — removal is Phase 2 - `HERO_SOCKET_DIR` env var supported with default `~/hero/var/sockets`
Author
Owner

Implementation committed: 9805acf

Browse: 9805acf

Implementation committed: `9805acf` Browse: https://forge.ourworld.tf/lhumina_code/hero_compute/commit/9805acf
mahmoud self-assigned this 2026-04-06 18:35:52 +00:00
mahmoud added this to the ACTIVE project 2026-04-06 18:35:55 +00:00
mahmoud added this to the now milestone 2026-04-06 18:35:57 +00:00
Sign in to join this conversation.
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#65
No description provided.