autopilotpattern / nats

NATS on Autopilot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NATS on Autopilot

This image uses ContainerPilot to register NATS with Consul. As you scale out the number of NATS containers they will be automatically clustered together. Furthermore, a health check is also performed in the container to ensure that each NATS instance is healthy.

Environment Variables

  • CONSUL hostname where consul can be found
  • CONSUL_AGENT determines if the consul agent is executed in the container
  • LOG_LEVEL ContainerPilot specific log level to use, defaults to INFO
  • NATS_USER username to use for cluster authorization, defaults to ruser
  • NATS_PASSWORD password to user for cluster authorization, defaults to T0pS3cr3t

Prerequisites

Please either run setup.sh to create a _env file or create one manually. The setup.sh script expects that the triton-cli is installed and a profile is setup for docker to connect to a Triton datacenter.

Example Usage

docker-compose -f local-compose.yml up -d
docker-compose -f local-compose.yml scale nats=3

Look at the monitoring page for routez for one of the NATS servers and observe that they are clustered.

About

NATS on Autopilot

License:Mozilla Public License 2.0


Languages

Language:Shell 45.4%Language:Python 31.7%Language:Makefile 23.0%