NM Integration:
Scope:
1. Service Initialization
2. Service Monitoring
3. Service Termination
Service Initialization:
Create an entry for the service in the denim configurations.
1. NM will start the service based on the denim configuration
(in etc/nm/DEFAULT.cfg and etc/nm/ALL.cfg).
2. Provide the Service launch script to starts the service.
NOTE: No need to compile the denim, denim restart will start the service and
service entry should be available in nmctl list.
Service Monitoring:
Once the service is started, NM expects 1st health check msg from service
within "HealthCheckStartupDelay" secs (specified in DEFAULT.cfg).
All the service should send the Health check message at every 10s interval,
else NM will assume the process is unhealth and will restart it.
Each service should do following task:
1. Send the Health check message to NM at every 10s
2. Handle the service shutdown message from NM.
Service Termination:
NM can instruct any service to terminate using NM protobuf message.
NMClient will listen for these messages and on receiving such event will do
the graceful shutdown of the service.
NM Integrations in NodeJS Service
Configurations:
1. Create an entry in the DEFAULT.cfg & ALL.cfg.
2. Provide the Service launch script.
Each NodeJS service will uses the JS Module (NMClient) from the local NPM
module.
NMClient Module
This is an independent module, which provide the implementation for Service
monitoring based on NM.
Libraries:
1. NMTimer: It will start the NMClient timer for sending the Health check
messages at every 10s.
2. NMClient: It will do the following tasks:
a. Initiate the ProtoMsgBus library to create the socket connections.
b. Do the healthcheck (both common & service specific) at the trimmer
expire event.
c. Create the specific NM Health Check message using ProtoMsgBuilder.
d. Send the message using ProtoMsgBus.
e. Handle the shutdown message from NM and do the graceful shutdown of
the service.
3. ProtoMsgBus: It will create/maintain the socket connections to NM and
sends any specified protobuf message to NM.
4. ProtoMsgBuilder: Create the different type of Protobuf message based on
protobuf definition
5. Protobuffer: It is wrapper on thirdparty Protobuf library for abstraction
Build Dependencies
1. Denim build will convert the proto to json/js modules(file)
2. Jenkin build will build the NMClient module using the json/js file.
3. Seam build will uses the NMClient module and build the NodeJS services
(eg. Carder & Event-service)
This build dependency is required, since the NM server and client (NodeJs services) need to share the same protobuf message format.