PM2M Docker


 * 1) NodeRED app for collect sensors data

name_to_ipaddress{ ifconfig | grep "inet " |awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' | grep -v "127.0.0.1" | head -1 }

NODERED_WEB_PORT=1880 NODERED_ADMIN_PASSWORD="MUST_BE_CHANGED"
 * 1) Note : Password can be crypt and set into settings.js with node-red-admin hash-pw

GF_PORT=3600 GF_PASSWORD="MUST_BE_CHANGED"

MQTT_BROKER_1=mqtt01 MQTT_BROKER_2=mqtt02 MQTT_BROKER_1=test.mosquitto.org MQTT_BROKER_2=test.mosquitto.org LOCAL_HOST=$(name_to_ipaddress localhost) echo $LOCAL_HOST


 * 1) Clean
 * 1) Clean

docker rm -f influxdb_for_lorawan docker rm -f mongodb_for_lorawan docker rm -f nodered_for_lorawan docker rm -f grafana_for_lorawan docker rm -f chronograf_for_lorawan

rm -fr influxdb mongo grafana chronograf rm -f lib/flows/*

mkdir influxdb docker pull influxdb docker run -d --name influxdb_for_lorawan \ -p 8086:8086 \ -p 8083:8083 \ -v influxdb:/var/lib/influxdb \ influxdb
 * 1) Influx DB
 * 1) Influx DB

docker run -d --name mongodb_for_lorawan \ -p 27017:27017 \ mongo
 * 1) MongoDB
 * 1) MongoDB

docker pull nodered/node-red-docker
 * 1) Influx DB
 * 1) Influx DB

LOCALDIR=$(pwd) docker run -d --name nodered_for_lorawan \ -v $LOCALDIR:/data \ -p $NODERED_WEB_PORT:1880 \ --add-host=influxdb-1:$LOCAL_HOST \ --add-host=mongodb-1:$LOCAL_HOST \ -e FLOWS=lora.flow.json \ -e NODE_OPTIONS="--max_old_space_size=128" \ nodered/node-red-docker

npm install node-red-contrib-influxdb npm install node-red-node-mongodb npm install node-red-contrib-pubnub npm install node-red-contrib-ifttt npm install node-red-contrib-kafka-node npm install node-red-contrib-web-worldmap

npm install -g node-red-admin node-red-admin target http://localhost:$PORT node-red-admin list node-red-admin install node-red-contrib-influxdb


 * 1) Grafana
 * 1) Grafana

docker run -d --name grafana_for_lorawan \ -p $GF_PORT:3000 \ --add-host=influxdb-1:$LOCAL_HOST \ -e "GF_SECURITY_ADMIN_PASSWORD=$GF_PASSWORD" \ grafana/grafana


 * 1) Chronograf
 * 1) Chronograf

mkdir chronograf docker run -d --name chronograf_for_lorawan \ -p 18888:8888 \ --add-host=influxdb-1:$LOCAL_HOST \ -v chronograf:/var/lib/chronograf \ chronograf

docker logs --follow nodered_for_lorawan tail -f logfile.txt
 * 1) Logs
 * 1) Logs


 * 1) Stop then Start
 * 1) Stop then Start

docker stop influxdb_for_lorawan docker stop mongodb_for_lorawan docker stop nodered_for_lorawan docker stop grafana_for_lorawan docker stop chronograf_for_lorawan

docker start influxdb_for_lorawan docker start mongodb_for_lorawan docker start nodered_for_lorawan docker start grafana_for_lorawan docker start chronograf_for_lorawan