https://github.com/hackuarium/mqtt
https://github.com/hackuarium/mqtt
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hackuarium/mqtt
- Owner: Hackuarium
- Created: 2018-08-15T20:37:19.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-19T20:00:06.000Z (almost 4 years ago)
- Last Synced: 2025-12-08T09:50:53.607Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 20.2 MB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## mqtt
The goal of this project is to create a fast setup of a docker mqtt broker in javascript.
In this project we are using 4 different docker images:
- node-red
- mosquitto (mqtt broker)
- mongo
- influxdb
## setup a new server
This documentation is for a CentOS 7.x
### Install docker
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
### Install iptables
Add the following rule in iptables:
`-A INPUT -p tcp -m tcp -m multiport --dports http,https,1883 -j ACCEPT`
### Using an apache proxy
Using an apache proxy allows to play with the hostname.
vi /etc/httpd/conf.d/mqtt.conf
```
ServerName mqtt.beemos.org
ProxyRequests off
ProxyPreserveHost on
ProxyPass "/comms" "ws://localhost:1880/comms"
ProxyPassReverse "/comms" "ws://localhost:1880/comms"
ProxyPass "/" "http://localhost:1880/"
ProxyPassReverse "/" "http://localhost:1880/"
```
### Starting the server
`docker-compose up -d`
## Testing
## Some other tools
Node-red will save all the data in the folder `node-red/data`
Using GRAFANA for output: https://www.hackster.io/naresh-krish/visualizing-lora-node-data-with-node-red-and-grafana-8960d3
http://localhost:1880/
The UI
http://localhost:1880/ui/
mosquitto_pub --retain -t "random" -m $RANDOM
Add continously data:
`while true; do mosquitto_pub --retain -t "random" -m $RANDOM; sleep 2; done`
## Mosquitto
Test MQTT server using mosquitto
mosquitto_pub --retain -m "Test" -t "abcd/efgh"
mosquitto_sub -h "localhost" -t "abcd/efgh"
## Connect to influxdb for debug
`docker-compose exec influxdb bash`
`influx -username user -password user`
`show databases`
`use data`
`select * from random`
## Problems with Fedora 31
https://github.com/docker/for-linux/issues/219
$ sudo dnf install -y grubby
$ sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
$ sudo reboot