Coder Social home page Coder Social logo

zmtig's Introduction

DigitalOcean IoT Docker


Logo

DigitalOcean | IoT Docker

One-click Droplet for Mosquitto, InfluxDB, Telegraf & Grafana

Eclipse Mosquitto - An open source MQTT broker to collect your data via MQTT protocol
InfluxDB - The Time Series Data Platform to store your data in time series database
Telegraf - The open source server agent to connect Mosquitto and InfluxDB together
Grafana - The open observability platform to draw some graphs and more

Based on: https://github.com/Miceuz/docker-compose-mosquitto-influxdb-telegraf-grafana

Getting Started

Architecture diagram

Prerequisites

  1. A DigitalOcean account - Sign up here
  2. doctl CLI - Installation guide

Running on an Existing Droplet

Instead of manually deploying a new Droplet, you can run scripts/install.sh on an existing DigitalOcean Droplet to set up the environment. This script automates the installation process.

  1. Update package lists and upgrade all packages
apt-get update && apt-get upgrade
  1. Download and install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
  1. Install docker-compose and git
apt-get update && apt-get install -y docker-compose git
  1. Run the installation script for this project
curl -sSL https://github.com/DO-Solutions/iot-docker/raw/master/scripts/install.sh | bash

Deploying a New Droplet

To deploy a new Droplet with the necessary software installed:

  1. Clone this repo: git clone https://github.com/DO-Solutions/iot-docker
  2. Enter the directory: cd iot-docker
  3. Deploy the Droplet using the following command:
doctl compute droplet create iot-droplet \
--size s-2vcpu-4gb --image ubuntu-23-10-x64 \
--region lon1 --enable-backups \
--user-data-file cloudinit.yml
  1. To check on your deployment SSH into your Droplet and run tail -f /var/log/cloud-init-output.log
  2. To check the running services run cd /iot-docker && docker ps
  3. To shutdown the whole thing cd /iot-docker && docker-compose down

Test your setup

  1. Post messages into Mosquitto to see data in Grafana:
sudo docker container exec mosquitto mosquitto_pub -t 'paper_wifi/test/' -m '{"humidity":21, "temperature":21, "battery_voltage_mv":3000}'
  1. Access Grafana at http://<your-server-ip>:3000. Username: admin, Password: /iot-docker/grafanapassword.txt.
  2. Explore InfluxDB at http://<your-server-ip>:8086. Credentials in docker-compose.yml.

Grafana

Open in your browser: http://<your-server-ip>:3000

Username is admin

Password can be found in /iot-docker/grafanapassword.txt

You should see a graph of the data you have entered with the mosquitto_pub command.

InfluxDB

You can poke around your InfluxDB setup here: http://<your-server-ip>:8086

Username and password are found in docker-compose.yml

Configuration

Mosquitto

  • Allows anonymous connections.
  • Configured to listen on port 1883.
listener 1883
allow_anonymous true

InfluxDB

  • Configuration details are available in docker-compose.yml.

Telegraf

  • Set up to pipe MQTT messages to InfluxDB.
  • Listens for topic paper_wifi/test.
  • Configuration can be modified as per the official documentation.

Grafana data source

  • Comes with a default data source pointing to InfluxDB.
  • Configuration: grafana-provisioning/datasources/automatic.yml.
  • Default dashboard setup in grafana-provisioning/dashboards.

Contact

Jack Pearce, Solutions Engineer - [email protected]

(back to top)

zmtig's People

Contributors

akajuliaan avatar jkpe avatar miceuz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.