overview/03-nats-cluster.md

37 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 3. Central Verae NATS.IO 3-server cluster
All durable messaging for this product is **NATS JetStream**, not Zapier queues and not a public TCP API.
## Cluster
Three `nats-server -js` nodes form the Verae cluster (routes between them, JetStream replication). Clients (middleware, poller, aggregator, WORM, tree nodes, and any new process cloned from `verae-nats-process`) connect with a **cluster URL list**, for example:
```text
nats://127.0.0.1:4222,nats://127.0.0.1:4223,nats://127.0.0.1:4224
```
On a given machine the listener stays on **loopback** (or a private interface). Operators reach it with `scripts/nats-tunnel.sh` / `ssh -L 14222:127.0.0.1:4222`. **Do not bind 4222 on `0.0.0.0` without auth.**
Todays NS1 box (`NS1.GEORGELAMBERT.ORG`, `70.88.205.138`) already runs JetStream on `127.0.0.1:4222`. The **target** is three clustered nodes so losing one server does not lose the stream. Fleet SSH hosts (`ns1`, later `lan-134`) run **workers**, not extra public NATS listeners.
![NATS cluster](diagrams/nats-cluster.svg)
## Who may connect
| Allowed | Forbidden |
|---------|-----------|
| verae-middleware, fleet workers, WORM, tree nodes, `verae-nats-process` clones | Zapier cloud, browsers, zappier-edge |
## Address families already in use
| Address | Kind | Notes |
|---------|------|--------|
| `verae.zapier.jobs.watch` | work queue | poller |
| `verae.zapier.jobs.events` | events | wait + webhooks |
| `verae.zapier.webhooks.deliver` | work queue | HTTPS to Zapier REST Hook |
| `verae.zapier.usage` | optional | metering |
| `verae.archive.put` | JetStream | splitter / merkle builder |
| `verae.archive.query` | **broadcast** (no queue group) | every WORM and tree node |
| `verae.archive.reply.<correlationId>` | replies | **only on bloom hit** |
New functions get new `verae.<area>.<resource>.<action>` addresses — see [06-address-routing.md](06-address-routing.md).