Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 2.91 KB

README.md

File metadata and controls

41 lines (34 loc) · 2.91 KB

Wi-DAQ

Non-npm dependencies

Wi-DAQ requires a mongoDB database and a MQTT broker. You can download mongoDB here and mosquitto, one of the most popular MQTT brokers, here. Both of these will allow you to run the broker and database locally. You can also run these using cloud services like Mongo Atlas and Scale Grid for the database and Rightech, Cloud MQTT, and a private Shifter.io instance for the broker.

Note: While you can run Wi-DAQ on a MQTT broker with other traffic, you can not run multiple Wi-DAQ instances on the same MQTT broker. In addition, anyone with access to this MQTT broker will have access to all live data and control. DO NOT USE A INSECURE MQTT BROKER.

MongoDB Pre-Installation

In addition to creating a mongoDB database, you will also need to add an number of collections to the database for Wi-DAQ to work. Please create empty collections with the following names:

  • alarms
  • buffer-info
  • data
  • devices
  • notifications
  • users

How to create collection depends on how you are running the database. If you're running mongoDB locally, this page explains how to do it. If you're cloud based database, some googling will quickly show you how to create new collections.

Installation

  • Once you have a mongoDB server and an MQTT broker and have configured the database appropriately run:
$ git clone https://github.com/henhen724/Wi-DAQ.git

Note: There will be a package version soon installable though npm, yarn and possibly other package managers.

  • Now you need to define a number of environment variables to tell Wi-DAQ how to connect to you're database and broker. The simplest way to do this is using a .env file, see .env.example. Once you've defined all you're environment variables in the .env file, change the file name to .env and Wi-DAQ will automatically load the file and set the environment variables. Make sure it defines the following variables:
    • MONGODB_URI
      • A URL/URI which resolves to your database. If you're running mongoDB locally this will usually be mongodb://localhost:27017/<name of my database>.
    • MONGODB_USERNAME
      • The username for your mongoDB server.
    • MONGODB_PASSWORD
      • The password for your mongoDB server.
    • MQTT_URI
      • A URL/URI which resolves to your MQTT broker. If you're running this locally, this will usually be mqtt://localhost:1883.
    • MQTT_USERNAME
      • The username for your MQTT broker.
    • MQTT_PASSWORD
      • The password for your MQTT broker.
    • TOKEN_SECRET
      • Any string, preferably between 64-256 charters long.