Home

Awesome

openSenseMap MQTT Integration

MQTT client service for openSenseMap API. Connects to remote MQTT brokers and stores incoming messages in the database of openSenseMap. Communication with the main openSenseMap API is done through gRPC calls. You can find the .proto file in the osem-protos repository.

Configuration

Configuration is handled by node-config.

See config/default.json. You should at least configure the connection to the database and the certificates for GRPC. Certificates can either configured directly as strings or can take a path to a file in pem format.

{
  "grpc": {
    "certificates": {
      // example for path
      "ca_cert": "/etc/ssl/certs/My_CA.pem",
      // example for stringified certificate (sed -z 's/\n/\\n/g' < certificate.crt)
      "server_cert": "-----BEGIN CERTIFICATE-----\nMIIE9DCCAtygAwIBA ... ",
      "server_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIJKQIBAAKCAg ..."
    }
  },
  "openSenseMap-API-models": {
    "db": {
      // See example config json of @sensebox/opensensemap-api-models
      "mongo_uri"
    }
  }
}

Development

To get up and running for development run the following steps:

Environment variables

Its possible to supply your configuration json through the NODE_CONFIG environment variable. It is also possible to configure through custom environment variables:

Config keyEnvironment VariableDescription
mqtt_client.num_retriesOSEM_MQTT_NUM_RETRIESNumber of retries which the MQTT client takes until backing off
mqtt_client.retry_after_minutesOSEM_MQTT_RETRY_AFTER_MINUTESMinutes after the MQTT clients restarts connecting after errors
grpc.portOSEM_MQTT_GRPC_PORTPort on which the gRPC server listens
grpc.certificates.ca_certOSEM_MQTT_GRPC_CA_CERTCA certificate for gRPC TLS client authentication. Can be specified either as path to a certificate file or the certificate directly.
grpc.certificates.server_certOSEM_MQTT_GRPC_SERVER_CERTServer certificate for gRPC TLS client authentication. Can be specified either as path to a certificate file or the certificate directly.
grpc.certificates.server_keyOSEM_MQTT_GRPC_SERVER_KEYServer certificate key for gRPC TLS client authentication. Can be specified either as path to a key file or the key directly.

Container images and Versions

Container images for this service are created on each push on Github Container Registry.

Stable versions should be tagged using npm version and git push --follow-tags origin master