Skip to content
Drydock
ConfigurationActions & NotificationsNATS

NATS

The nats trigger lets you publish container update events to a NATS subject.

Pre-release docs

These docs cover v1.9, a release candidate that isn't generally available yet. Running the stable release? Read the docs for v1.7.

The nats trigger publishes container update events as JSON messages to a NATS subject. Drydock keeps one connection open, reconnects when it is closed and drains it on shutdown.

Variables

Env varRequiredDescriptionSupported valuesDefault value when missing
DD_NOTIFICATION_NATS_{trigger_name}_SERVERS🔴Comma-separated server urlsnats://host:4222,nats://host2:4222
DD_NOTIFICATION_NATS_{trigger_name}_SUBJECT⚪Subject to publish toAny valid NATS subjectdrydock.container
DD_NOTIFICATION_NATS_{trigger_name}_USER⚪User name. Used together with PASSWORD
DD_NOTIFICATION_NATS_{trigger_name}_PASSWORD⚪Password. Used together with USER
DD_NOTIFICATION_NATS_{trigger_name}_TOKEN⚪Authentication token. Used when no user and password pair is set
DD_NOTIFICATION_NATS_{trigger_name}_NKEY⚪NKey seed. Used when no user, password or token is setA seed starting with SU
DD_NOTIFICATION_NATS_{trigger_name}_DISABLETITLE⚪Send an empty title fieldtrue, falsefalse
This trigger also supports the common configuration variables.

Message format

Each message is a JSON object. A single update carries title, message, mode set to simple, and the full container. A batch carries title, message, mode set to batch, eventKind, count and the containers array.

Credentials are tried in this order: user and password, then token, then NKey. Only the first complete set is used.

Examples

Publish with user and password

services:
  drydock:
    image: codeswhat/drydock:1.9.0-rc.6
    ...
    environment:
      - DD_NOTIFICATION_NATS_BUS_SERVERS=nats://nats.local:4222
      - DD_NOTIFICATION_NATS_BUS_SUBJECT=drydock.updates
      - DD_NOTIFICATION_NATS_BUS_USER=drydock
      - DD_NOTIFICATION_NATS_BUS_PASSWORD=your-password