Skip to main content

NATS (clusters)

warning

This guide was created for Autonomys Taurus Testnet and will be updated once mainnet is launched.

Prerequisites

Helpful Guides

NATS will run in Docker, and is best managed with Portainer.

Docker network

NATS will be deployed on the autonomys-network Docker network which I create for all Autonomys related containers. If that container does not exist, make sure to create it

Create the network

sudo docker network create \
--driver bridge \
--subnet 172.25.0.0/16 \
--gateway 172.25.0.1 \
autonomys-network

network-create

This creates a new network called "autonomys-network" using the subnet 172.25.0.0/16 and the gateway 172.25.0.1.

NATS Config

In order to deploy NATS, a config file must be created. Because NATS is only used with a cluster, I usually add it under the "autonomys" directory that is created when configuring a cluster.

Create the nats folder to store the config

mkdir -p ~/autonomys/nats

The -p will create the "autonomys" folder automatically if it does not exist. Then create the nats config

echo "max_payload = 2MB" > ~/autonomys/nats

Make note of the full path to the nats.config as it will be needed when deploying the container

pwd

Stack File

In Portainer, create a new Stack file called "nats". I prefer to give NATS it's own stack file, however it could be included in your cluster stack file. Next, open up the NATS example file and copy the contents and paste it into Portainer.

Updates

Make sure to update the following

  1. Update the path to your nats.config
  2. (optional) Update the Spaceport Labels
  3. If not using the autonomys-network update it to the appropriate network

Example

example-nats