selfstart and log #2

Open
opened 2026-03-19 19:47:11 +00:00 by despiegk · 3 comments
Owner

see skill /hero_proc_log_selfstart_check

see skill /hero_proc_log_selfstart_check
Author
Owner

Implementation Spec for Issue #2: Self-Start and Logging via hero_proc

Objective

Integrate hero_whiteboard's three daemon binaries (hero_whiteboard_server, hero_whiteboard_web, hero_whiteboard_ui) with the hero_proc process supervisor so that:

  1. Each binary supports start/stop/status/logs subcommands via hero_proc_sdk
  2. All logging goes through hero_proc via logs.insert RPC calls
  3. The Makefile run/stop targets use the self-start pattern instead of nohup/pkill

Requirements

  • Each binary crate accepts CLI subcommands via clap: serve (default), start, stop, status, logs
  • When running as daemon (serve), logging goes through hero_proc's logs.insert RPC endpoint
  • tracing_subscriber remains as fallback when hero_proc is unavailable
  • Makefile run/stop targets use selfstart pattern

Implementation Plan (10 Steps)

  1. Add hero_proc_sdk and clap to workspace dependencies
  2. Add dependencies to hero_whiteboard_server/Cargo.toml
  3. Add dependencies to hero_whiteboard_web/Cargo.toml
  4. Update hero_whiteboard_ui/Cargo.toml dependencies
  5. Implement selfstart + logging in hero_whiteboard_server/src/main.rs
  6. Implement selfstart + logging in hero_whiteboard_web/src/main.rs
  7. Implement selfstart + logging in hero_whiteboard_ui/src/main.rs
  8. Update scripts/run.sh for selfstart
  9. Update scripts/stop.sh for selfstart
  10. Update scripts/rundev.sh for selfstart

Acceptance Criteria

  • hero_whiteboard_server start/stop/status/logs all work via hero_proc
  • Same subcommands work for hero_whiteboard_web and hero_whiteboard_ui
  • Running without subcommand defaults to serve (backward compatible)
  • Log entries sent to hero_proc via logs.insert with correct src field
  • Falls back to stderr logging when hero_proc unavailable
  • make run and make stop use selfstart pattern
  • cargo build --release succeeds
  • cargo test --workspace passes
## Implementation Spec for Issue #2: Self-Start and Logging via hero_proc ### Objective Integrate hero_whiteboard's three daemon binaries (`hero_whiteboard_server`, `hero_whiteboard_web`, `hero_whiteboard_ui`) with the hero_proc process supervisor so that: 1. Each binary supports `start`/`stop`/`status`/`logs` subcommands via hero_proc_sdk 2. All logging goes through hero_proc via `logs.insert` RPC calls 3. The Makefile `run`/`stop` targets use the self-start pattern instead of `nohup`/`pkill` ### Requirements - Each binary crate accepts CLI subcommands via `clap`: `serve` (default), `start`, `stop`, `status`, `logs` - When running as daemon (`serve`), logging goes through hero_proc's `logs.insert` RPC endpoint - `tracing_subscriber` remains as fallback when hero_proc is unavailable - Makefile `run`/`stop` targets use selfstart pattern ### Implementation Plan (10 Steps) 1. Add `hero_proc_sdk` and `clap` to workspace dependencies 2. Add dependencies to `hero_whiteboard_server/Cargo.toml` 3. Add dependencies to `hero_whiteboard_web/Cargo.toml` 4. Update `hero_whiteboard_ui/Cargo.toml` dependencies 5. Implement selfstart + logging in `hero_whiteboard_server/src/main.rs` 6. Implement selfstart + logging in `hero_whiteboard_web/src/main.rs` 7. Implement selfstart + logging in `hero_whiteboard_ui/src/main.rs` 8. Update `scripts/run.sh` for selfstart 9. Update `scripts/stop.sh` for selfstart 10. Update `scripts/rundev.sh` for selfstart ### Acceptance Criteria - [ ] `hero_whiteboard_server start/stop/status/logs` all work via hero_proc - [ ] Same subcommands work for `hero_whiteboard_web` and `hero_whiteboard_ui` - [ ] Running without subcommand defaults to `serve` (backward compatible) - [ ] Log entries sent to hero_proc via `logs.insert` with correct `src` field - [ ] Falls back to stderr logging when hero_proc unavailable - [ ] `make run` and `make stop` use selfstart pattern - [ ] `cargo build --release` succeeds - [ ] `cargo test --workspace` passes
Author
Owner

Test Results

  • cargo buildPASS (all crates compile successfully)
  • cargo test --workspacePASS (0 failures, all tests pass)
  • No new warnings introduced (all warnings are pre-existing)

Implementation Summary

Changes Made

Cargo.toml files (4 files)

  • Added hero_proc_sdk and clap to workspace dependencies
  • Added workspace dependencies to hero_whiteboard_server, hero_whiteboard_web, hero_whiteboard_ui

hero_whiteboard_server/src/main.rs

  • Added CLI with serve, start, stop, status, logs subcommands via clap
  • start — registers with hero_proc via ServiceBuilder and starts the service
  • stop — stops the hero_proc-managed service
  • status — queries and prints service status
  • logs — fetches and prints log entries from hero_proc
  • serve — runs the daemon (default, backward compatible), sends logs to hero_proc via logs.insert

hero_whiteboard_web/src/main.rs

  • Same CLI subcommands and selfstart pattern as server
  • hero_proc logging integration in serve mode

hero_whiteboard_ui/src/main.rs

  • Extended existing clap Args with subcommands (preserving --hero-socket and --socket flags)
  • Same selfstart pattern and hero_proc logging

scripts/run.sh

  • Replaced nohup launches with $binary start (hero_proc selfstart)
  • Uses $binary logs for error output on failure

scripts/stop.sh

  • Replaced pkill -f with $binary stop (hero_proc managed stop)

scripts/rundev.sh

  • Updated to use selfstart via run.sh (socat proxies unchanged)

Notes

  • Running without subcommand defaults to serve — fully backward compatible
  • hero_proc connection is best-effort — if hero_proc is unavailable, tracing_subscriber provides stderr fallback
  • All log entries use the binary name as src field (e.g. hero_whiteboard_server)
## Test Results - `cargo build` — **PASS** (all crates compile successfully) - `cargo test --workspace` — **PASS** (0 failures, all tests pass) - No new warnings introduced (all warnings are pre-existing) ## Implementation Summary ### Changes Made **Cargo.toml files (4 files)** - Added `hero_proc_sdk` and `clap` to workspace dependencies - Added workspace dependencies to `hero_whiteboard_server`, `hero_whiteboard_web`, `hero_whiteboard_ui` **hero_whiteboard_server/src/main.rs** - Added CLI with `serve`, `start`, `stop`, `status`, `logs` subcommands via clap - `start` — registers with hero_proc via ServiceBuilder and starts the service - `stop` — stops the hero_proc-managed service - `status` — queries and prints service status - `logs` — fetches and prints log entries from hero_proc - `serve` — runs the daemon (default, backward compatible), sends logs to hero_proc via `logs.insert` **hero_whiteboard_web/src/main.rs** - Same CLI subcommands and selfstart pattern as server - hero_proc logging integration in serve mode **hero_whiteboard_ui/src/main.rs** - Extended existing clap Args with subcommands (preserving `--hero-socket` and `--socket` flags) - Same selfstart pattern and hero_proc logging **scripts/run.sh** - Replaced `nohup` launches with `$binary start` (hero_proc selfstart) - Uses `$binary logs` for error output on failure **scripts/stop.sh** - Replaced `pkill -f` with `$binary stop` (hero_proc managed stop) **scripts/rundev.sh** - Updated to use selfstart via run.sh (socat proxies unchanged) ### Notes - Running without subcommand defaults to `serve` — fully backward compatible - hero_proc connection is best-effort — if hero_proc is unavailable, tracing_subscriber provides stderr fallback - All log entries use the binary name as `src` field (e.g. `hero_whiteboard_server`)
Author
Owner

Implementation committed: ce59496

Browse: ce59496

Implementation committed: `ce59496` Browse: https://forge.ourworld.tf/lhumina_code/hero_whiteboard/commit/ce59496
Sign in to join this conversation.
No labels
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_whiteboard#2
No description provided.