From bb959ad87bf0fffb6d8b437840b1a235b7bca38c Mon Sep 17 00:00:00 2001 From: Nicola Peditto Date: Tue, 23 Oct 2018 10:45:38 +0200 Subject: [PATCH] v2.3.0: revert updates, moved in the new release v2.3.1. --- Dockerfile | 6 ++---- docs/docker.md | 4 ++-- docs/raspberrypi2.md | 2 +- docs/raspberrypi3.md | 2 +- docs/ubuntu1404.md | 2 +- docs/ubuntu1604.md | 2 +- lightning-rod.js | 4 +--- package.json | 4 ++-- scripts/postinst | 21 ++++--------------- .../install/arancino/configure_LR_arancino.sh | 2 +- utils/install/docker/configure_LR_docker.sh | 19 ++++++++--------- utils/patches/authentication.patch | 13 ------------ 12 files changed, 25 insertions(+), 56 deletions(-) delete mode 100644 utils/patches/authentication.patch diff --git a/Dockerfile b/Dockerfile index a2195b2..7d871af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ RUN apt-get update && apt-get install -y \ socat dsniff fuse libfuse-dev git ntpdate python pkg-config build-essential gdb \ && rm -rf /var/lib/apt/lists/* -RUN npm install -g --unsafe gyp autobahn@18.10.2 ws@6.1.0 nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net node-red lsof\ + +RUN npm install -g --unsafe gyp autobahn nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net node-red lsof\ && npm install -g --unsafe https://github.com/PlayNetwork/node-statvfs/tarball/v3.0.0 \ && npm cache --force clean @@ -22,13 +23,10 @@ RUN git clone --depth=1 git://github.com/MDSLab/s4t-lightning-rod.git ./@mdslab/ ENV NODE_PATH=/usr/local/lib/node_modules ENV IOTRONIC_HOME=/var/lib/iotronic ENV LIGHTNINGROD_HOME=/usr/local/lib/node_modules/@mdslab/iotronic-lightning-rod -ENV NODE_TLS_REJECT_UNAUTHORIZED=0 RUN cp /usr/local/lib/node_modules/@mdslab/iotronic-lightning-rod/modules/plugins-manager/plugins.example.json /var/lib/iotronic/plugins/plugins.json \ && cp /usr/local/lib/node_modules/@mdslab/iotronic-lightning-rod/modules/drivers-manager/drivers.example.json /var/lib/iotronic/drivers/drivers.json -RUN cp /usr/local/lib/node_modules/@mdslab/iotronic-lightning-rod/etc/logrotate.d/lightning-rod.log /etc/logrotate.d/lightning-rod.log - WORKDIR /usr/local/lib/node_modules/@mdslab/iotronic-lightning-rod/ VOLUME /var/lib/iotronic diff --git a/docs/docker.md b/docs/docker.md index c8f75c3..93e9006 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -52,10 +52,10 @@ points at the folder that you created in the first step (e.g: /etc/iotronic/): * for "x86_64": ``` -docker run -d -v lr_data:/var/lib/iotronic -v /settings.json:/var/lib/iotronic/settings.json -v /authentication.json:/etc/iotronic/authentication.json --net=host --name=lightning-rod mdslab/iotronic-lightning-rod +docker run -d -v lr_data:/var/lib/iotronic -v /settings.json:/var/lib/iotronic/settings.json -v /authentication.json:/etc/iotronic/authentication.json -net=host --name=lightning-rod mdslab/iotronic-lightning-rod ``` * for "ARMv7l" on Raspberry Pi 3: ``` -docker run -d -v lr_data:/var/lib/iotronic -v /settings.json:/var/lib/iotronic/settings.json -v /authentication.json:/etc/iotronic/authentication.json --net=host --name=lightning-rod mdslab/rpi-iotronic-lightning-rod +docker run -d -v lr_data:/var/lib/iotronic -v /settings.json:/var/lib/iotronic/settings.json -v /authentication.json:/etc/iotronic/authentication.json -net=host --name=lightning-rod mdslab/rpi-iotronic-lightning-rod ``` diff --git a/docs/raspberrypi2.md b/docs/raspberrypi2.md index 853c9b0..ea2ee55 100644 --- a/docs/raspberrypi2.md +++ b/docs/raspberrypi2.md @@ -57,7 +57,7 @@ reboot ##### Install required NodeJS modules via npm: ``` -npm install -g --unsafe gyp autobahn@18.10.2 ws@6.1.0 nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof +npm install -g --unsafe gyp autobahn nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof npm install -g --unsafe https://github.com/PlayNetwork/node-statvfs/tarball/v3.0.0 ``` diff --git a/docs/raspberrypi3.md b/docs/raspberrypi3.md index 2a0b9fd..2334981 100644 --- a/docs/raspberrypi3.md +++ b/docs/raspberrypi3.md @@ -57,7 +57,7 @@ reboot ##### Install required NodeJS modules via npm: ``` -npm install -g --unsafe gyp autobahn@18.10.2 ws@6.1.0 nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof +npm install -g --unsafe gyp autobahn nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof npm install -g --unsafe https://github.com/PlayNetwork/node-statvfs/tarball/v3.0.0 ``` diff --git a/docs/ubuntu1404.md b/docs/ubuntu1404.md index 54a7afe..8b0b0c8 100644 --- a/docs/ubuntu1404.md +++ b/docs/ubuntu1404.md @@ -52,7 +52,7 @@ reboot ##### Install required NodeJS modules via npm: ``` -npm install -g --unsafe gyp autobahn@18.10.2 ws@6.1.0 nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof +npm install -g --unsafe gyp autobahn nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof npm install -g --unsafe https://github.com/PlayNetwork/node-statvfs/tarball/v3.0.0 ``` diff --git a/docs/ubuntu1604.md b/docs/ubuntu1604.md index bc2a1ea..f796cee 100644 --- a/docs/ubuntu1604.md +++ b/docs/ubuntu1604.md @@ -54,7 +54,7 @@ reboot ##### Install required NodeJS modules via npm: ``` -npm install -g --unsafe gyp autobahn@18.10.2 ws@6.1.0 nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof +npm install -g --unsafe gyp autobahn nconf @mdslab/wstun fuse-bindings requestify is-running connection-tester log4js@1.1.1 q fs-access mknod jsonfile md5 python-shell net lsof npm install -g --unsafe https://github.com/PlayNetwork/node-statvfs/tarball/v3.0.0 ``` diff --git a/lightning-rod.js b/lightning-rod.js index a16c189..24b44f6 100644 --- a/lightning-rod.js +++ b/lightning-rod.js @@ -130,7 +130,6 @@ manageBoard.Init_Ligthning_Rod(function (check) { wampConnection = new autobahn.Connection({ url: wampUrl, realm: wampRealm, - tlsConfiguration: {}, max_retries: -1 }); @@ -474,8 +473,7 @@ manageBoard.Init_Ligthning_Rod(function (check) { logger.info("[SYSTEM] - Lightning-rod "+ lyt_device.name +" starting..."); lyt_device.Main(wampConnection, logger); - } - catch (e) { + }catch (e) { logger.error('[SYSTEM] - Loading IoT device failure: ', e); logger.error('[SYSTEM] - Device "' + device + '" not supported!'); diff --git a/package.json b/package.json index 01fe0d1..ac8fff1 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "uninstall": "./scripts/postuninst" }, "dependencies": { - "autobahn": "18.10.2", - "ws":"6.1.0", + "autobahn": "17.5.2", + "ws":"4.1.0", "connection-tester": ">=0.1.1", "fs-access": ">=1.0.1", "fuse-bindings": "2.8.1", diff --git a/scripts/postinst b/scripts/postinst index 1ae98a5..7f65a71 100755 --- a/scripts/postinst +++ b/scripts/postinst @@ -44,10 +44,6 @@ IOTRONIC_AUTH="/etc/iotronic" if [ -d "$IOTRONIC_AUTH" ]; then - - LR_INSTALLED_VERSION=`cat /var/lib/iotronic/patches/package.json | grep \"version\" | awk '{print $2}' | tr -d , | tr -d \"` - logger -t DEBUG "Authentication settings file already present (LR v$LR_INSTALLED_VERSION)" - rm_check= echo -n "Do you want to keep Lightning-rod authentication settings (in /etc/iotronic) ? (yes/no) " read rm_check @@ -56,22 +52,15 @@ if [ -d "$IOTRONIC_AUTH" ]; then echo "--> Lightning-rod authentication settings are save!" - - if [ "$LR_INSTALLED_VERSION" == "2.2.0" ]; then - echo "--> APPLY THE 2.3.0 PATCH" - patch /etc/iotronic/authentication.json $NODE_PATH/@mdslab/iotronic-lightning-rod/utils/patches/authentication.patch - fi - - fi - if [ "$rm_check" = "no" ] || [ ! -d "$IOTRONIC_HOME" ]; then +fi - mkdir -p /etc/iotronic/ +if [ "$rm_check" = "no" ] || [ ! -d "$IOTRONIC_HOME" ]; then - cp $NODE_PATH/@mdslab/iotronic-lightning-rod/utils/templates/authentication.example.json /etc/iotronic/authentication.json + mkdir -p /etc/iotronic/ - fi + cp $NODE_PATH/@mdslab/iotronic-lightning-rod/utils/templates/authentication.example.json /etc/iotronic/authentication.json fi @@ -80,8 +69,6 @@ fi - - echo "Configuring..." # Set Environment variables diff --git a/utils/install/arancino/configure_LR_arancino.sh b/utils/install/arancino/configure_LR_arancino.sh index fa4ee38..43e4d10 100755 --- a/utils/install/arancino/configure_LR_arancino.sh +++ b/utils/install/arancino/configure_LR_arancino.sh @@ -26,7 +26,7 @@ sed -i "s/\"bin\":.*\"wstun\"/\"bin\":\"\/usr\/lib\/node_modules\/@mdslab\/wstun echo " - authentication.json file configured." -#cp /etc/init-cfg/lightning-rod /etc/init.d/ +cp /etc/init-cfg/lightning-rod /etc/init.d/ /etc/init.d/lightning-rod enable echo " - Lightning-rod enabled at boot." diff --git a/utils/install/docker/configure_LR_docker.sh b/utils/install/docker/configure_LR_docker.sh index 027c9d1..d0788ae 100755 --- a/utils/install/docker/configure_LR_docker.sh +++ b/utils/install/docker/configure_LR_docker.sh @@ -1,21 +1,20 @@ #!/bin/sh if [ "$#" -ne 3 ]; then - echo "Usage: ./configure_LR_arancino.sh " - exi + echo "Usage: ./configure_LR_arancino.sh " + exit fi echo "Stack4Things Lightning-rod configuration with the following parameters:" echo " --> Device UUID: "$1 echo " --> Device password: "$2 echo " --> WAMP URL: "$3 -echo " --> WSTUN URL: "$4 -echo " --> Configuration file path: "$5 +echo " --> Configuration file path: "$4 -sed -i "s/\"layout\":.*\"\"/\"layout\": \"server\"/g" $5 -sed -i "s/\"code\":.*\"\"/\"code\": \"$1\"/g" $5 -sed -i "s/\"password\":.*\"\"/\"password\": \"$2\"/g" $5 -sed -i "s,\"url_wamp\":.*,\"url_wamp\": \"$3\"\,,g" $5 -sed -i "s,\"ws_url\":.*,\"ws_url\": \"$4\"\,,g" $5 -sed -i "s/\"bin\":.*\"\"/\"bin\": \"\/usr\/lib\/node_modules\/@mdslab\/wstun\/bin\/wstun.js\"/g" $5 +sed -i "s/\"layout\":.*\"\"/\"layout\": \"server\"/g" $4 +sed -i "s/\"code\":.*\"\"/\"code\": \"$1\"/g" $4 +sed -i "s/\"password\":.*\"\"/\"password\": \"$1\"/g" $4 +sed -i "s,\"url_wamp\":.*,\"url_wamp\": \"$3\"\,,g" $4 +sed -i "s,\"ws_url\":.*,\"ws_url\": \"$3\"\,,g" $4 +sed -i "s/\"bin\":.*\"\"/\"bin\": \"\/usr\/lib\/node_modules\/@mdslab\/wstun\/bin\/wstun.js\"/g" $4 echo -e "\nauthentication.json file configured." diff --git a/utils/patches/authentication.patch b/utils/patches/authentication.patch deleted file mode 100644 index 215713f..0000000 --- a/utils/patches/authentication.patch +++ /dev/null @@ -1,13 +0,0 @@ -@@ -14,8 +14,9 @@ - "url_wamp": "", - "port_wamp": "8181", - "realm": "s4t", -- "wifi_force_reconnect": "true", -- "wifi_force_reconnect_time": 60 -+ "wamp_socket_recovery": "true", -+ "rpc_alive_time": 600, -+ "check_skt_time": 30 - }, - "wstun": - { -