😀
Notes
  • My Notes
  • Software Development
    • Getting Started
    • VSCodium
    • Go
  • System Administration
    • Networking cheatsheet
    • Infra security check tools
    • Using Ubuntu as a workstation
  • Application Infrastructure
    • Message Brokers
      • Kafka
      • NATS
    • Databases
      • MongoDB
      • MySQL
      • PostgreSQL
      • Redis
    • Kubernetes
      • Standard resources cheatsheet
      • Istio
      • Prometheus
    • Workflow Orchestrators
      • Airflow
  • Cloud Infrastructure
    • Terraform
      • AWS
        • Kubernetes IAM roles
  • Climbing
    • Overview of Climbing
    • Singapore
  • Crypto
    • Introduction to Crypto
    • Web3 terminology
  • Guides
    • Beginner's Guide to Personal Operational Security
Powered by GitBook
On this page
  • Reference Links
  • Configuration
  • NKey generation
  • Server
  • Docker
  • Image
  • Compose
  1. Application Infrastructure
  2. Message Brokers

NATS

Reference Links

Description
URL

Official website

DockerHub image

NATS Go SDK

NATS JS SDK

NATS Python SDK

NKeys repository

NATS CLI tool

Configuration

NKey generation

nats-nkey:
	nk -gen user -pubout

Server

This file should be available on the system running NATS. NATS should be started using the --config or -c flag pointing to the path of this file (eg. nats-server -c /path/to/this.conf

accounts: {
  $SYS: {
    users: [
      # generate using `nk-gen user -pubout`
      {nkey: "..."},
    ]
  }
}

authorization: {
  users: [
    # generate using `nk-gen user -pubout`
    {nkey: "..."},
  ]
}

cluster: {
  name: "example"
}

jetstream: {
  max_memory_store: 2GB
  max_file_store: 8GB
}

Docker

Image

Compose

The following starts NATS using the leanest image base (scratch) and with JetStream enabled:

version: "3.7"
services:
  nats: # access with `nats server info`
    # image reference: https://hub.docker.com/_/nats
    image: library/nats:2.9.20-scratch
    entrypoint:
      - /nats-server
      - -js
      - -c
      - /etc/nats/server.conf
    ports:
      - "4222:4222"
      # # enable as needed
      # - "6222:6222"
      # - "8222:8222"
    network_mode: host
    volumes:
      - ./.data/nats/config/server.conf:/etc/nats/server.conf
PreviousKafkaNextDatabases

Last updated 1 year ago

https://nats.io/
https://hub.docker.com/_/nats
https://github.com/nats-io/nats.go
https://github.com/nats-io/nats.js
https://github.com/nats-io/nats.py
https://github.com/nats-io/nkeys
https://github.com/nats-io/natscli
nats - Official Image | Docker Hub
Logo