MING project (MQTT, InfluxDB, NodeRED and Grafana)

@diverjoe this is an amazing use case using the MING stack! Good job it’s beautiful :slight_smile:

I would love to see this Application for fish tanks on the balenaHub. Let me know if you need any help!

BTW look at this @ajlennon :slight_smile:

1 Like

Who that’s fantastic @diverjoe !!! Great work !!! From Diver Alex :wink:

1 Like

Hi @marc, let’s see if you can help me…

I’ve added a new service (Thigsboard) to the project. My docker-compose file is as below:

version: '2'

volumes:
  node-red-data:
  grafana-data:
  influxdb-data:
  influxdb-etc:
  mytb-data:
  mytb-logs:

services:

  # ------------------------------------------------------------------------------------
  # BalenaLabs WiFi-Connect
  # ------------------------------------------------------------------------------------
  # wifi-connect:
  #   image: bh.cr/balenalabs/wifi-connect-rpi
  #   container_name: wifi-connect
  #   network_mode: "host"
  #   labels:
  #       io.balena.features.dbus: '1'
  #       io.balena.features.firmware: '1'
  #   cap_add:
  #       - NET_ADMIN
  #   environment:
  #       DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"

  # ------------------------------------------------------------------------------------
  # Node-RED
  # ------------------------------------------------------------------------------------
  node-red:
    image: bh.cr/balenalabs/balena-node-red
    container_name: node-red
    privileged: true
    restart: unless-stopped
    volumes:
        - 'node-red-data:/data'
    labels:
        io.balena.features.dbus: '1'
        io.balena.features.sysfs: '1'
        io.balena.features.supervisor-api: '1'
        io.balena.features.balena-api: '1'
    ports:
        - 80:80
    environment:
        PORT: 80
        USERNAME: "balena"
        PASSWORD: "balena"
        ENCRIPTION_KEY: "balena"        
    cap_add:
        - SYS_RAWIO
    devices:
        - "/dev/mem:/dev/mem"
        - "/dev/gpiomem:/dev/gpiomem"
        - "/dev/i2c-1:/dev/i2c-1"

  # ------------------------------------------------------------------------------------
  # Influxdb
  # ------------------------------------------------------------------------------------
  influxdb:
    image: influxdb:1.8.10
    container_name: influxdb
    restart: unless-stopped
    volumes:
        - influxdb-data:/var/lib/influxdb
        - influxdb-etc:/etc/influxdb

  # ------------------------------------------------------------------------------------
  # Grafana
  # ------------------------------------------------------------------------------------
  grafana:
    image: bh.cr/balenalabs/dashboard
    container_name: grafana
    restart: unless-stopped
    ports:
        - "8080:80"
    volumes:
        - "grafana-data:/data"

  # ------------------------------------------------------------------------------------
  # MQTT
  # ------------------------------------------------------------------------------------
  mqtt:
    image: eclipse-mosquitto
    network_mode: host
    ports:
      - "1883:1883"
    restart: always

  # ------------------------------------------------------------------------------------
  # Thingsboard
  # ------------------------------------------------------------------------------------
  thingsboard:
    image: thingsboard/tb-postgres:latest
    container_name: thingsboard
    restart: unless-stopped
    ports:
      - "9090:9090"
      - "1884:1883"
      - "7070:7070"
      - "5683-5688:5683-5688/udp"
    environment:
      TB_QUEUE_TYPE: in-memory
    volumes:
      - mytb-data:/data
      - mytb-logs:/var/log/thingsboard

I’ve setup my device as Local Mode. Then I pushed the changes through Balena CLI with balena push Device_IP_address.

The first time the services built and I could see the logs, but due some config missing (I guess) the Thingsboard service did not brought up.

Now, issuing the same command (with docker-compose.yml attached), the build works, but I can´t see the Thingsboard service.

I’m missing something? Some configuration is wrong? Thanks in advance!

2 Likes

This is awesome @alexcorvis84

BTW how are you trying to access to thingsboard? local ip address to which port?

1 Like

@alexcorvis84 just tested on my side and it worked using the port 9090 with my local ip address!

Could you please confirm if this works on your side?

In case that you might need the Public Device URL, my recommendation is to redirect the port 9090 to 8080 or 443 as they are the only ports available (plus the 80 which is being used by NodeRED now).

1 Like

Hi @mpous ,

I was not able to test it again as I had issues as per above. The first time I did the balena push command I checked that the Thingsboard service tried to built but failed. Then the following attempts I tried to push the code with balena push it did not work and I couldn’t see any logs pointing to the service.

Q: Working in local mode, what is the best way to ‘clean’ the services to re-install the project? Or is it automatically cleaned (removed containers and images) with every new push? :thinking: This part is not clear to me.

I might need to delete the device and load again de imageOS into SD, due not sure what’s happening…

Anyway, will give you feedback when I’ll be at home and try it again.

Thank you in advance! :wink:

1 Like

mmmm that’s weird! could you please share more logs next time @alexcorvis84 ?

Finally I deleted the device and started again, burnt the SD, pushed the release…and it’s working now.

Just to note !!! , I had issues to connect the RPI via WiFi to balena due:

  1. I had to change the WiFi channel below 12 (even working with a RPi 4!)
  2. I had to change manually the WiFi password on SD, as it included a ‘#’ character and it wasn’t saved correctly
1 Like

Hi @mpous

I’m working in a modified version of this project.

Here is my docker-compose.yml

Services starts ok and everything works fine BUT after some days, I can’t access to the URLs provided by the different services (yet I can see in the Logs window they’re running).

Device is connected to a 2.4GHz WiFi and I checked that inside Host Os it has IP on wlan0.

What could be happening? What can I check?

Thank you in advance

1 Like

Thanks for sharing! I will test this today @alexcorvis84

@alanb128 did you have this behaviour before?

1 Like

I think we should :pushpin: the fabulous Blog Tutorial @mpous has published as reference! :wink:

:pushpin: :link: Use the MING stack to accelerate your IoT application development

Thanks a lot for your work! Let’s continue promoting the MING stack!

2 Likes

Hello, is there a way to update, for example, the version of Nodejs in Node Red from Balena, or the version of Grafana or Influx? In node red there are some nodes that the v16 version of node js is not supported

Hello @rojasyal

did you try to change the version of the nodeJS from these Dockerfile templates?

Let me know if you try to update the version from here and test!

1 Like

hello @mpous Yes it worked for me.

grafana is not saving the changes, that is, I create a dashboard and after entering the changes, the changes are not saved. I think it is due to the volume. The path is fine.

@rojasyal yes! i also suffered from this in the past…

maybe you get inspired by this project with the Grafana dashboards being copied in the filesystem → balena-weather/dashboard/Dockerfile at master · hferentschik/balena-weather · GitHub