Hands-on NATS labs focused on hub/leaf topologies, subject interest propagation, permissions, system account visibility, and JetStream edge patterns.
Each runnable lab keeps its own NATS server configs. The workshop.sh helper
starts the same nats-server -c <config> commands shown in the lab READMEs.
- NATS server 2.12+ for most labs; 2.14+ is recommended.
- NATS CLI.
jqfor the inspection commands used in several labs.- Go (for some labs)
- Bash, for the local process helper.
Most labs use these contexts:
nats context add hub --server a:x@:4222
nats context add l1 --server e:x@:4232
nats context add l2 --server e:x@:4242
nats context add l3 --server e:x@:4252
nats context add syshub --server s:x@:4222
nats context add sysl1 --server s:x@:4232
nats context add sysl2 --server s:x@:4242
nats context add sysl3 --server s:x@:4252See Lab 00 - Setup for the original setup notes.
| Directory | Lab |
|---|---|
| Lab 00 - Setup | General setup |
| Lab 01 - Same Cluster Name | Leafs using same cluster name |
| Lab 02 - Different Cluster Names | Leafs using different cluster names |
| Lab 03 - Interest Propagation | Subject interest propagation side lab |
| Lab 04 - Isolate | Isolate east-west traffic |
| Lab 05 - Isolate and Request Isolation | More on isolate and request_isolation |
| Lab 06 - Remote Leaf Isolation (Reverse Hub) | Reverse leaf connections with remote isolation |
| Lab 07 - Block Subjects | Block subjects north-south |
| Lab 08 - SYS Account | SYS account leaf connection |
| Lab 09 - SYS Account Limits | SYS account leaf connection with restrictions |
| Lab 10 - JetStream Subject Leak | JetStream captured-subject leak |
| Lab 11 - JetStream Domain Lottery | JetStream domain lottery |
| Lab 12 - Locked Down Leafs | Locked down leafs |
| Lab 13 - Reserved | Reserved |
| Lab 14 - Remote Leaf Streams | Hub remote access to leaf streams |
| Lab 15 - Stream Sources | Hub sources and merges leaf streams |
| Lab 16 - Explicit Consumers | Hub sources and merges leaf streams with explicit consumers |
| Lab 17 - Device Target Republish | Target devices individually with stream republish |
| Lab 18 - Leaf Connect Disconnect | Hot reload leaf connection changes |
| Lab 19 - JWT Default User | Decentralized auth default user behavior |
| Lab 20 - Muxed Request Responders | Use one wildcard subscription to mux request handlers |
| Lab 21 - Device Target Core NATS | Target devices individually (core nats) |
Use the bash helper from the repository root:
./workshop.sh start 1
./workshop.sh logs
./workshop.sh status 1
./workshop.sh stop 1The helper runs nats-server -c <config> in the lab directory, so relative
JetStream stores such as ./js/l1 behave the same as when you run the commands
by hand.
The direct equivalent, from a lab directory, is to run each server in its own terminal:
nats-server -c hub.conf
nats-server -c l1.conf
nats-server -c l2.conf
nats-server -c l3.confRuntime pid files and logs are written under the repository .workshop/
directory. ./workshop.sh logs follows the current running lab's logs and
prints the lab name at the top of the output.
The monitor gives a watch-like view of /varz and /leafz?subs=1
scripts/monitor.sh
scripts/monitor.sh --once
scripts/monitor.sh --interval 5-
subscription-load: creates many unique subscriptions and holds them open.
-
responders: hosts simulated request responders with and without muxing.
For local processes:
./workshop.sh clean 1JetStream labs write stores under each lab's js/ directory. The local helper's
clean command removes that store for the selected lab.