Basic heartbeat service (as a sammler strategy).
strategy-heartbeat is basically a super boring and useless service.
All it does is:
- Providing an API to store settings.
- Listen to nats for
HeartBeatRequests
(per user)- And then store a
HeartBeatResponse
- To be exposed again by the API
- And then store a
- So, bottom line we could also describe this service as a ping-pong service
In its final state, strategy-heartbeat is meant to be a reference implementation of a strategy in sammler.io, implementing patterns such as:
- Configuration
- API exposure
- Loosely coupled/event-driven architecture using a message-bus such as nats.io
- Logging
- Error Handling
- Handling scheduled per-user data collection operations
- Authentication
- Role based access control
- Testing
- CircleCI integration
- Development environment
- etc.
As this is a node.js service, it is planned to create a similar reference implementation for Go. Future change to how to handle the different patterns - following best practices and trying out new technologies - will be implemented in this service first.
$ docker pull sammlerio/strategy-heartbeat
See docker-compose.yml file.
strategy-heartbeat can be configured by the following environment variables:
General:
PORT
- The port to run the REST API (defaults to3101
).JWT_SECRET
- The secret used for JWT.
MongoDB:
MONGODB_DEBUG
- Whether to use the Mongoose debug mode or not, defaults tofalse
.MONGODB_HOST
- MongoDB host, defaults tolocalhost
.MONGODB_PORT
- MongoDB port, defaults to27017
.MONGODB_DATABASE
- The MongoDB database, defaults tosammlerio
.
NATS-Streaming:
NATS_STREAMING_HOST
- The host of the nats-streaming server, defaults tolocalhost
.NATS_STREAMING_PORT
- The port of the nats-streaming server, defaults to4222
.
Resources:
JOBS_SERVICE_URI
- The URI for the jobs-service, defaults tohttp://localhost:3003
.
Behavior of the service:
ENABLE_AUDIT_LOG
- Whether to enable the audit log or not, can betrue
orfalse
, defaults totrue
.
Stefan Walther
MIT
This file was generated by verb-generate-readme, v0.6.0, on January 27, 2019.