Skip to content

Commit

Permalink
Fix example
Browse files Browse the repository at this point in the history
Signed-off-by: Byron Ruth <byron@nats.io>
  • Loading branch information
bruth committed Mar 28, 2023
1 parent 351f73a commit 81c4b1c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
36 changes: 18 additions & 18 deletions examples/topologies/multi-region/cli/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ version: '3'
services:
n1.east.example.net:
container_name: n1-east
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n1-east
ADVERTISE: localhost:10000
REGION: region:east
volumes:
- "./configs/cluster-east.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-east.conf:/nats-server.conf"
ports:
- 10000:4222
- 10100:7422
n2.east.example.net:
container_name: n2-east
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
labels:
com.docker-tc.enabled: '1'
Expand All @@ -27,105 +27,105 @@ services:
ADVERTISE: localhost:10001
REGION: region:east
volumes:
- "./configs/cluster-east.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-east.conf:/nats-server.conf"
ports:
- 10001:4222
- 10101:7422
n3.east.example.net:
container_name: n3-east
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n3-east
ADVERTISE: localhost:10002
REGION: region:east
volumes:
- "./configs/cluster-east.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-east.conf:/nats-server.conf"
ports:
- 10002:4222
- 10102:7422
n1.central.example.net:
container_name: n1-central
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n1-central
ADVERTISE: localhost:10003
REGION: region:central
volumes:
- "./configs/cluster-central.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-central.conf:/nats-server.conf"
ports:
- 10003:4222
- 10103:7422
n2.central.example.net:
container_name: n2-central
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n2-central
ADVERTISE: localhost:10004
REGION: region:central
volumes:
- "./configs/cluster-central.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-central.conf:/nats-server.conf"
ports:
- 10004:4222
- 10104:7422
n3.central.example.net:
container_name: n3-central
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n3-central
ADVERTISE: localhost:10005
REGION: region:central
volumes:
- "./configs/cluster-central.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-central.conf:/nats-server.conf"
ports:
- 10005:4222
- 10105:7422
n1.west.example.net:
container_name: n1-west
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n1-west
ADVERTISE: localhost:10006
REGION: region:west
volumes:
- "./configs/cluster-west.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-west.conf:/nats-server.conf"
ports:
- 10006:4222
- 10106:7422
n2.west.example.net:
container_name: n2-west
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n2-west
ADVERTISE: localhost:10007
REGION: region:west
volumes:
- "./configs/cluster-west.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-west.conf:/nats-server.conf"
ports:
- 10007:4222
- 10107:7422
n3.west.example.net:
container_name: n3-west
image: synadia/nats-server:nightly-main
image: nats:2.9.15
dns_search: example.net
environment:
GATEWAY: c1
NAME: n3-west
ADVERTISE: localhost:10008
REGION: region:west
volumes:
- "./configs/cluster-west.conf:/nats/conf/nats-server.conf"
- "./configs/cluster-west.conf:/nats-server.conf"
ports:
- 10008:4222
- 10108:7422
Expand Down
19 changes: 6 additions & 13 deletions examples/topologies/multi-region/cli/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ nats context save central \
# Report the servers.
nats --context east-sys server list

nats --context east stream add ORDERS_EAST --tag region:east --replicas 3 --subjects js.in.orders_east --defaults
nats --context west stream add ORDERS_WEST --tag region:west --replicas 3 --subjects js.in.orders_west --defaults
nats --context central stream add ORDERS_CENTRAL --tag region:central --replicas 3 --subjects js.in.orders_central --defaults

# Creating a region-local stream requires setting a tag for the desired region.
nats --context east stream edit ORDERS_EAST --force --config /app/ORDERS_EAST.json
nats --context west stream edit ORDERS_WEST --force --config /app/ORDERS_WEST.json
nats --context central stream edit ORDERS_CENTRAL --force --config /app/ORDERS_CENTRAL.json
nats --context east stream add --config /app/ORDERS_EAST.json
nats --context west stream add --config /app/ORDERS_WEST.json
nats --context central stream add --config /app/ORDERS_CENTRAL.json

# Ensure the stream sourcing retries catch up.
sleep 5

# Creating a global stream involves ommitting the --tag option.
nats --context east stream add --config /app/GLOBAL.json
Expand All @@ -51,11 +50,5 @@ nats --context west req js.in.orders 1
# Publish a message to the global stream.
nats --context east req js.in.global.orders 1

sleep 1

# Let's see the stream report again.
nats --context east stream report

nats --context east stream view ORDERS_EAST
nats --context central stream view ORDERS_CENTRAL
nats --context west stream view ORDERS_WEST

1 comment on commit 81c4b1c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for nats-by-example ready!

✅ Preview
https://nats-by-example-i8dpp7rwk-connecteverything.vercel.app

Built with commit 81c4b1c.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.