Telemetry Development - Hyp-ed/hyped-2024 GitHub Wiki

Running Telemetry

With Docker

Telemetry can be run simply using the command:

./telemetry.sh dev -b -m

The usage for this script is:

./telemetry.sh <pnpm_script> [OPTIONS]

Options:
-h, --help              Display this help message
-b, --build             Build the docker image before running the container
-m, --with-mqtt-broker  Run the MQTT broker along with the container

Without Docker

Alternatively, if you want to run without Docker you can follow these steps to install everything required:

  • Install node
  • Install pnpm:
npm install -g pnpm
  • You can now run Telemetry:
cd telemetry
pnpm install
pnpm build
pnpm dev

To run the full Telemetry system, you will also need InfluxDB and an MQTT broker running locally.

The above tools are also available as Docker images: mosquitto, influxdb.

For Mosquitto, the following config file mosquitto.conf is needed:

# mqtt protocol
listener 1883
protocol mqtt

# websockets protocol (for GUI)
listener 8080
protocol websockets
allow_anonymous true

To use this config file, run mosquitto with the following argument -c <path to moquitto.conf>.

Development Environment

We highly recommend using https://code.visualstudio.com/ as your code editor when working on Telemetry. The following VSCode extensions are required:

  • TailwindCSS IntelliSense - gives you autocompletion for Tailwind classes
  • Prettier - code formatter (you can enable this to run on save and never think about formatting again)
  • ESLint - shows ESLint errors in VSCode

And the following are recommended:

  • Pretty TypeScript Errors - formats TypeScript errors to make them easier to read and understand
  • PostCSS Language Support - gets rid of TailwindCSS errors in CSS files
  • JSDoc Markdown Highlighting
  • Import Cost - displays the size of imported packages
  • Error Lens - inline error messages
  • DotENV - syntax highlighting in .env files
  • GitLens - shows git history in VSCode

Optional

MQTTX

If you want a GUI for sending and subscribing to custom MQTT messages, we recommend MQTTX which can be installed from https://mqttx.app/.