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
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
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 configurationstream
:prefix
: Prefix to be appended to the stream name while creating the stream. This is to isolate multiple notifier instances. Default value isth
nats
: Configuration for connection to Jetstream enabled NATSnats_url
: URL exposed by Service of Jetstream enabled NATSis_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
andpassword
: 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
Add notifier chart repo:
CODEhelm repo add smartmakers http://helm.smartmakers.de
Update helm local repo
CODEhelm repo update
Run the following command to install a new Notifier deployment with a given version tag
helm install {name} smartmakers/thub-notifier --namespace {name} --create-namespace --version {version} -f notifier.yaml
Tips & Tricks
TBA