Skip to content

xeniumlee/iotedge.skynet

Repository files navigation

Design

  • Control processor: console, MQTT, etc.
  • Data processor: To fetch, process, and publish data
  • Pipeline: To link data processors together

Feature

  • MQTT controller (Plain/TLS/Websocket)
  • Console controller (Authentication)
  • Websocket controller (Authentication)
  • System/Appliation Upgrade (Remote SW repository)
  • Configuration storage
  • Data storage (Data retention)
  • Json/MessagePack pack
  • Zlib compressor
  • COV(change of value) publish
  • Buffer/Group publish
  • Log rotate
  • Proxy support by FRP
  • Monitor by NodeExporter
  • VPN by WireGuard
  • Websocket proxy (e.g. for noVNC)
  • Modbus TCP/RTU(ASCII)/RTU(ASCII) over TCP
  • Simens S7
  • Kafka publisher
  • MQTT publisher
  • File publisher
  • OPCUA: Binding open62541
  • Python runtime
  • HTTP data acquisition
  • BACnet: Binding bacnet-stack

Build & Run

Build

Build python

apt-get install libbz2-dev liblzma-dev zlib1g-dev libffi-dev
https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
./configure --enable-shared
make
cp libpython3.8.a ../iotedge/bin/prebuilt/libpython.a.3.8

Build openssl

https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz
./config no-tests
make
cp libcrypto.a ../iotedge/bin/prebuilt/libcrypto.a.1.1.1g
cp libssl.a ../iotedge/bin/prebuilt/libssl.a.1.1.1g

Build snap7

cd 3rd/snap7-1.4.2/build/unix
make -f x86_64_linux.mk clean|all|install
make -f arm_v7_linux.mk clean|all|install
cp ../bin/x86_64/libsnap7.a ../../../../bin/prebuilt/libsnap7.a.1.4.2

Build open62541

https://github.com/open62541/open62541/archive/v1.1.tar.gz
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_ENCRYPTION_OPENSSL=ON -DOPENSSL_CRYPTO_LIBRARY="../../iotedge/bin/prebuilt/libcrypto.a.1.1.1g" -DOPENSSL_SSL_LIBRARY="../../iotedge/bin/prebuilt/libssl.a.1.1.1g" -DOPENSSL_INCLUDE_DIR="../../iotedge/3rd/openssl-1.1.1g" ..
make
cp bin/libopen62541.a ../../iotedge/bin/prebuilt/libopen62541.a.1.1

Install dependency

https://luarocks.org/releases/luarocks-3.3.1.tar.gz
./configure --with-lua-bin=../iotedge/skynet/3rd/lua --with-lua-include=../iotedge/skynet/3rd/lua --with-lua=../iotedge/skynet/3rd/lua
make bootstrap

luarocks install luafilesystem
luarocks install lsqlite3complete

git clone https://github.com/cloudwu/lua-cjson.git
make LUA_VERSION=5.4 LUA_INCLUDE_DIR=../iotedge/skynet/3rd/lua

Run

  • cp config.xx config
  • Edit config
  • ./bin/skynet iotedge.config
  • telnet localhost 30000
  • Type help

Production

  • ./dev/release.sh x86_64|arm_v7 host:path
  • ./scripts/install.sh install config.tb host id uri username
  • ./scripts/install.sh install config.local host
  • ./scripts/install.sh upgrade config.tb dir port
  • ./scripts/install.sh upgrade config.local dir port

Dependences

  • github.com/cloudwu/lua-cjson
  • github.com/keplerproject/luafilesystem
  • github.com/brimworks/lua-zlib
  • github.com/fatedier/frp
  • github.com/prometheus/node_exporter
  • lua.sqlite.org: lsqlite3complete
  • git.zx2c4.com/wireguard-go