Nomploy Nomad Packs

← All packs

nats v0.1.0

Messaging

NATS — a lightweight, high-performance messaging system (pub/sub, request-reply, queues) with JetStream persistence enabled. Deployed as a host-networked Nomad service with a persistent Docker volume for the JetStream store and the HTTP monitoring endpoint on.

nomad-pack run nats --registry nomploy
1 task client 4222monitoring 8222 1 volume image nats:2
Variables 11
values.hcl

Save as values.hcl, edit, then run:

nomad-pack run nats -f values.hcl --registry nomploy
# The name of the Nomad job.
job_name = "nats"

# The Nomad namespace to deploy into.
namespace = "default"

# The datacenters to deploy to.
datacenters = ["*"]

# The NATS server container image.
image = "nats:2"

# Host port for client connections (nats:// protocol).
client_port = 4222

# Host port for the HTTP monitoring endpoint (/varz, /healthz, etc.).
monitoring_port = 8222

# Enable JetStream (persistence: streams, KV, object store). When true, the data volume is mounted at /data as the store dir.
jetstream = true

# Optional connection token. Empty = no auth (open on the trusted network). Set it and clients connect as nats://<token>@host:port.
auth_token = ""

# Docker named volume for the JetStream store (/data). NATS runs as root, so a fresh volume is writable. Ignored when jetstream = false.
data_volume = "nats_data"

# Placement constraints — pin to one node so the JetStream local volume stays put. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
constraints = []

# The task resources.
resources = {
    cpu    = 300
    memory = 256
  }
NameTypeDefaultDescription
job_name string
"nats"
The name of the Nomad job.
namespace string
"default"
The Nomad namespace to deploy into.
datacenters list
["*"]
The datacenters to deploy to.
image string
"nats:2"
The NATS server container image.
client_port number
4222
Host port for client connections (nats:// protocol).
monitoring_port number
8222
Host port for the HTTP monitoring endpoint (/varz, /healthz, etc.).
jetstream bool
true
Enable JetStream (persistence: streams, KV, object store). When true, the data volume is mounted at /data as the store dir.
auth_token key string
""
Optional connection token. Empty = no auth (open on the trusted network). Set it and clients connect as nats://<token>@host:port.
data_volume string
"nats_data"
Docker named volume for the JetStream store (/data). NATS runs as root, so a fresh volume is writable. Ignored when jetstream = false.
constraints list
[]
Placement constraints — pin to one node so the JetStream local volume stays put. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
resources object
{
    cpu    = 300
    memory = 256
  }
The task resources.
Readme

nats

NATS — a lightweight, high-performance messaging system: pub/sub, request-reply, and queue groups, with JetStream for persistence (streams, key-value, object store). A cloud-native alternative to the heavier rabbitmq broker.

Host-networked Nomad service with a persistent volume for the JetStream store and the HTTP monitoring endpoint enabled.

Usage

nomad-pack registry add nomploy github.com/Nomploy/nomad-packs
nomad-pack run nats --registry nomploy

In nomploy: create a Compose service, type Nomad Pack, pack nats, custom registry github.com/Nomploy/nomad-packs, then Deploy.

Key variables

Variable Default Notes
image nats:2 Pin a tag in production.
client_port 4222 Client connections.
monitoring_port 8222 HTTP monitoring.
jetstream true Persistence. When true, /data is the store on the volume.
auth_token "" Empty = open. Set it → nats://<token>@host:4222.
data_volume nats_data JetStream store. Back it up.
constraints [] Pin to a node so the local volume stays put.
resources cpu 300 / mem 256 Lightweight.

Notes