Skip to content

feat: add 'hermes node restart' command + token reload on bind#96

Merged
blaspat merged 1 commit into
mainfrom
fix/restart-command
Jul 20, 2026
Merged

feat: add 'hermes node restart' command + token reload on bind#96
blaspat merged 1 commit into
mainfrom
fix/restart-command

Conversation

@blaspat

@blaspat blaspat commented Jul 20, 2026

Copy link
Copy Markdown
Owner

What

  • hermes node restart — POSTs to /admin/restart, drains and restarts the WSS server in-place
  • Server re-reads token from ~/.hermes/nodes-internal-token on every start()
  • Manual token edits are picked up without gateway restart

How it works

  1. Edit ~/.hermes/nodes-internal-token
  2. Run hermes node restart
  3. Server drains, restarts, reads the new token

Changed files

  • wsserver/server.pyPOST /admin/restart endpoint (auth-gated)
  • lifecycle.py — token read-before-generate logic; store runner on app.state
  • cli.pyrestart subcommand + _cmd_restart implementation

Three changes:

1. runner.start() now always reads the token from disk first.
   Generates a fresh one only when the file is missing/empty AND
   we own the port. Manual edits to ~/.hermes/nodes-internal-token
   are picked up on next restart without a gateway restart.

2. POST /admin/restart endpoint drains and restarts the WSS
   server in-place. WebSocket connections are closed during drain.
   Authenticated via the internal token.

3. 'hermes node restart' CLI command POSTs to /admin/restart,
   reads the current token from the shared file to authenticate.

Flow: edit token file -> hermes node restart -> server reads it.
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
@blaspat
blaspat merged commit 8ed2656 into main Jul 20, 2026
2 checks passed
@blaspat
blaspat deleted the fix/restart-command branch July 20, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant