The speech model now lives in a worker thread (whisperWorker.mjs), so loading and transcribing no longer block the bridge's HTTP server or its Hermes polling. Measured longest event-loop pause during transcription: 387 ms before, 3 ms after. A dead worker is replaced on the next request; closing the bridge terminates it. Polling: bridge to Hermes every 150 ms (was 500). The app polls the bridge every 200 ms for the first 8 s of a turn, 400 ms until 30 s, then 1 s (was a fixed 700 ms). Tests: 131 unit/integration, 7 real-speech, 9 real-Hermes, 6 simulator, all passing. Effect on a phone or a droplet is not measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
4.4 KiB
Running the bridge on a DigitalOcean droplet
Status: written, not run. These steps have not been executed on a droplet. The bridge, the built-in speech model and the Hermes adapter have only been run on the development desktop. Creating the droplet, pointing DNS at it and starting services are Dan's actions.
What runs where
phone (Even app) --HTTPS--> Caddy :443 --> bridge 127.0.0.1:8787 --> Hermes 127.0.0.1:8642
|
built-in Whisper (in the bridge process)
The bridge listens on loopback only. Caddy is the only thing exposed, and it provides the certificate. Speech is transcribed inside the bridge, so recordings never leave the droplet.
Hermes can run on the same droplet (shown above) or elsewhere; if elsewhere, HERMES_BASE_URL
must be https://.
Sizing
Measured on the development desktop (Intel i7-13850HX), bridge with whisper-base, 8-bit
weights:
| Measurement | Value |
|---|---|
| Memory after loading the model | about 0.5 GB |
| Memory after transcribing | about 0.8 GB |
| 11 s of speech, process pinned to one core | about 1.7 s |
Same, whisper-tiny |
about 1.2 s, about 0.6 GB |
| Model download on first start | about 80 MB (base), cached afterwards |
| Longest pause of the bridge's event loop while transcribing | 3 ms (the model runs in a worker thread) |
Pinning to one core made no difference to speed, so extra cores will not help; a single droplet vCPU is the relevant unit. A shared droplet vCPU is slower than that desktop core by an amount that has not been measured. If it were three times slower, 11 s of speech would take about 5 s, well inside the 30 s deadline.
Suggested starting point, to be confirmed by measuring on the droplet: 2 GB RAM, 1 to 2 vCPU for the bridge alone. 1 GB is likely too tight alongside the OS. If Hermes shares the droplet, add whatever Hermes needs; that was not measured.
If transcription is too slow on the droplet, set STT_MODEL=onnx-community/whisper-tiny
(faster, less accurate) or, for English only, onnx-community/whisper-base.en.
Steps
- Droplet and DNS. Ubuntu LTS. Point a hostname at it (for example
bridge.example.com). Firewall: allow 22, 80 and 443 only. - Packages. Node.js 22.13 or later, git, Caddy.
- User and directories.
useradd --system --home /opt/hermeven --shell /usr/sbin/nologin hermeven mkdir -p /opt/hermeven /var/lib/hermeven /etc/hermeven chown hermeven:hermeven /var/lib/hermeven - Code. Clone the repository into
/opt/hermeven, thennpm ci. (The dev dependencies are needed: the bridge runs throughtsx.) - Configuration. Copy
deploy/bridge.env.exampleto/etc/hermeven/bridge.env, fill it in,chmod 600,chown hermeven. - Hermes. Enable its API server with a key, bound to
127.0.0.1. Use a read-only or test profile first. - Service. Copy
deploy/hermeven-bridge.serviceto/etc/systemd/system/, thensystemctl daemon-reload && systemctl enable --now hermeven-bridge. Watchjournalctl -u hermeven-bridge -fforstt.ready(the first start downloads the model). - TLS. Put
deploy/Caddyfile.exampleat/etc/caddy/Caddyfilewith your hostname, reload Caddy, then checkcurl https://bridge.example.com/healthz. - App build. On your own machine:
HERMEVEN_BRIDGE_ORIGIN=https://bridge.example.com npm run -w @hermeven/even-client pack. - Pair. On the droplet, as the service user with the same environment:
sudo -u hermeven HERMEVEN_ENV_FILE=/etc/hermeven/bridge.env npm --prefix /opt/hermeven run bridge:cli -- pair - Origin. Open the phone page, read Diagnostics, "Page origin", put it in
HERMEVEN_ALLOWED_ORIGINS, restart the service.
Things to check on the droplet and write down
- Time from
stt.loadingtostt.ready, and memory of the service after a few questions. transcribe_msfor a few real questions (the phone page shows it per question).- That
curl http://<droplet-ip>:8787/healthzfrom outside fails (bridge not exposed). - That the unit's hardening options do not stop the model loading.
ProtectSystem=strictandMemoryMaxin particular are untested with ONNX Runtime.
Not covered yet
Backups of /var/lib/hermeven, log rotation, upgrades, monitoring, and a compiled build that
would remove the need for dev dependencies on the droplet.