Skip to main content
Skip table of contents

Notifier / Notification Service

What is the Notifier?

Notifier is a cluster-level central service that provides an in-tenant notification service. Currently, we use it internally to send out Triggered Alerts notifications. From thingshub 5.4 onwards, the notifier is also used to send out password recovery emails. We plan to use the notifier for all of our notification needs in the future.

Installation/deployment

From Thingshub 5.4, Notifier is no longer an optional service. It MUST be deployed on the same cluster the tenants are deployed in.

Pre-requisites

  1. Jetstream enabled NATS:
    The notifier depends on Jetstream enabled NATS (HA-NATS preferred). So, a Jetstream installed NATS installation is expected. Refer the NATS Documentation or the Artifact Hub NATS Server Package page for installing Jetstream enabled NATS. The thingshub’s HA-NATS can also be configured to be used by the thingshub notifier. Please refer to the updated documentation for the guide.

Config file:

Prepare the notifier Config file notifier.yaml with your intended options and customizations

YAML
global:
  log:
    level: debug
    formatter: stackdriver
  smtp: # change to your SMTP server configuration
    enabled: true
    address: your.smtp.host:587
    user: mail@yourdomain.de
    password: Password
    host: your.smtp.host
    from: mail@domain.de
    insecure: false
    ca_cert: YourSmtpCaCertificate # set insecure to true and omit ca_cert if you don't have a CA Certificate set up
  rest:
    port: 8000
  nats:
    nats_url: nats://nats:4222 # change it to your NATS instance
    is_cluster_wide: true
    replicas: 3
    user: test-njs
    password: a
  stream:
    prefix: notifier
  tenant_credentials: #change to your credentials
    dev:
      token: DEV_TOKEN
      api_key: APIKeyFromDEVTenant
      comment: tenant credentials for dev
    qa:
      token: QA_TOKEN
      api_key: APIKeyFromQATenant
      comment: tenant credentials for qa
    demo:
      token: DEMO_TOKEN
      api_key: APIKeyFromDemoTenant
      comment: tenant credentials for demo

Configurations:

  • log : Set the log level and formatter for logging messages of Notifier Service.

  • rest : Set the port for notifier service to expose its APIs to.

  • smtp : Set the SMTP settings for your SMTP configuration

  • stream:

    • prefix: Prefix to be appended to the stream name while creating the stream. This is to isolate multiple notifier instances. Default value is th

  • nats: Configuration for connection to Jetstream enabled NATS

    • nats_url: URL exposed by Service of Jetstream enabled NATS

    • is_cluster_wide: Boolean value to indicate if the NATS installation is Highly Available or Not.

    • replicas: Number of replicas set for the Stream created by Notifier in the Jetstream.(https://docs.nats.io/nats-concepts/jetstream/streams#:~:text=Replicas,Yes )

    • user and password : the NATS username and password defined for the notifier user in jetstream enabled NATS.

  • tenant_credentials: Credentials to register thingshub tenant to notifier.

    • xyz: Subdomain of the tenant to register.

      • token: Randomly generated string that thingshub tenant uses as push token while requesting notifier to send notifier.

      • api_key: API key generated in thingshub tenant that notifier uses to get user data for processing the notifier.

      • comment: Additional information for the tenant operator

Deployment

With these dependencies resolved, now the Notifier can be installed by following the below steps

  1. Add notifier chart repo:

    CODE
    helm repo add smartmakers http://helm.smartmakers.de
  2. Update helm local repo

    CODE
    helm repo update
  3. Run the following command to install a new Notifier deployment with a given version tag

CODE
helm install {name} smartmakers/thub-notifier --namespace {name} --create-namespace --version {version} -f notifier.yaml

Tips & Tricks

TBA

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.