スクリーンショット_2019-05-12_22

enebular agentをバージョンアップ(2.5.0)してみた。

enebularの更新(2.10.0)でAWS IoT接続の仕様が変わって、Connectionの設定にIAM Role ARNの設定が必要となって、いままでのenebular agentが使用できなくなったので、新しいenebular agent(2.5.0)を再インストールすることにした。

手順1. AWS IoTのConnection作成

マニュアルのとおりにIAM Role ARNを作成し、
・Connection情報① (ロール ARN)
 arn:aws:iam::************:role/enebular_status_push_role
・Connection情報② (ユーザの作成)
 ユーザー: enebular-conn-user
 アクセスキー ID: **********
 シークレットアクセスキー: **********
・Connection情報③ (エンドポイント)
 **********.iot.ap-northeast-1.amazonaws.com
の情報を控えます。

手順2. enebularでConnection作成

enebularへログインし、Projectを選択(または作成)して左側のサイドメニューからConnectionsを選択する。右下の「+」を押して設定を追加する。(これもマニュアルのとおりですね。)

手順3. enebular agent(2.5.0) のインストール

最初、マニュアルのとおりに実行したらエラーになりました。
enebular_aws_iot_shadow_updateのroleを取得するところでエラーとなっています。

pi@starter-kit-1:~ $ wget -qO- https://enebular.com/agent-install | sudo -E bash -s -- \
--aws-iot-thing-name=****** \
--aws-access-key-id=********** \
--aws-secret-access-key=********** \
--aws-iot-region=ap-northeast-1
===========================================================================================================================================================================
 enebular-agent installation:
   - Device name:         starter-kit-1
   - System:              Linux 4.14.79-v7+ armv7l GNU/Linux
   - Install user:        enebular
   - Install destination: /home/enebular/enebular-runtime-agent
   - Agent port:          awsiot
   - Agent version:       latest-release
===========================================================================================================================================================================
==== Checking dependencies ====
OK
==== Creating user enebular ====
OK
==== Downloading enebular-agent ====
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4467  100  4467    0     0   1129      0  0:00:03  0:00:03 --:--:--  1129
OK
==== Installing enebular-agent 2.5.0 ====
OK
==== Checking node.js version ====
main: 行 479: nodejs: コマンドが見つかりません
Found Node.js version: , but v9.2.1 is required.
OK
==== Checking existing node.js v9.2.1 installation ====
OK
==== Downloading https://nodejs.org/dist/v9.2.1/node-v9.2.1-linux-armv7l.tar.gz ====
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16.1M  100 16.1M    0     0  1946k      0  0:00:08  0:00:08 --:--:-- 2180k
OK
==== Checking integrity ====
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3671    0  3671    0     0   1075      0 --:--:--  0:00:03 --:--:--  1075
OK
==== Installing Node.js v9.2.1 to /home/enebular/nodejs-v9.2.1 ====
OK
==== Checking build environment for enebular-agent prebuilt package ====
Build environment nodejs: v9.2.1 (npm 5.5.1)
OK
==== Building AWSIoT thing creator ====
OK
==== Building enebular-agent(It may take a few minutes) ====
OK
==== Adding enebular to gpio group ====
OK
==== Creating AWS IoT thing ====
ERROR:   Command return error(1): run_as_user enebular (cd /home/enebular/enebular-runtime-agent/tools/awsiot-thing-creator && npm run start) PATH=/home/enebular/nodejs-v9.2.1/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin DISABLE_RULE_CREATION=false AWS_IOT_THING_NAME=***** AWS_IOT_REGION=ap-northeast-1 AWS_ACCESS_KEY_ID=********** AWS_SECRET_ACCESS_KEY=**********
ERROR:   Stdout: 
> awsiot-thing-creator@2.5.0 start /home/enebular/enebular-runtime-agent/tools/awsiot-thing-creator
> node lib/index.js

Creating thing: *****
Failed to get role, reason: User: arn:aws:iam::************:user/enebular-conn-user is not authorized to perform: iam:GetRole on resource: role enebular_aws_iot_shadow_update
ERROR:   Stderr: npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! awsiot-thing-creator@2.5.0 start: `node lib/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the awsiot-thing-creator@2.5.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/enebular/.npm/_logs/2019-05-12T07_15_26_760Z-debug.log
ERROR: Creating AWS IoT thing failed.
See details in full install log file: /tmp/enebular-agent-install-log.QVjQvB
pi@starter-kit-1:~ $

インストールスクリプトの中身を確認して、エラーとなっている箇所をスキップするため、--aws-iot-disable-rule-creationオプションを指定して実行することにしました。(マニュアルに記載がないけど)

pi@starter-kit-1:~ $ wget -qO- https://enebular.com/agent-install | sudo -E bash -s -- \
--aws-iot-thing-name=***** \
--aws-access-key-id=********** \
--aws-secret-access-key=********** \
--aws-iot-region=ap-northeast-1 \
--aws-iot-disable-rule-creation
===========================================================================================================================================================================================
 enebular-agent installation:
   - Device name:         starter-kit-1
   - System:              Linux 4.14.79-v7+ armv7l GNU/Linux
   - Install user:        enebular
   - Install destination: /home/enebular/enebular-runtime-agent
   - Agent port:          awsiot
   - Agent version:       latest-release
===========================================================================================================================================================================================
==== Checking dependencies ====
OK
==== Downloading enebular-agent ====
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4467  100  4467    0     0   5604      0 --:--:-- --:--:-- --:--:--  5604
OK
==== Installing enebular-agent 2.5.0 ====
OK
==== Checking node.js version ====
main: 行 479: nodejs: コマンドが見つかりません
Found Node.js version: , but v9.2.1 is required.
OK
==== Checking existing node.js v9.2.1 installation ====
Node.js v9.2.1 is already installed
OK
==== Checking build environment for enebular-agent prebuilt package ====
Build environment nodejs: v9.2.1 (npm 5.5.1)
OK
==== Building AWSIoT thing creator ====
OK
==== Building enebular-agent(It may take a few minutes) ====
OK
==== Adding enebular to gpio group ====
OK
==== Creating AWS IoT thing ====
OK
==== Registering startup service ====
OK
===========================================================================================================================================================================================
 enebular-agent has been successfully installed ✔
   - Version: 2.5.0
   - Location: /home/enebular/enebular-runtime-agent
   - User: enebular
   - Service name: enebular-agent-enebular

 AWS IoT Thing jetson01 has been created.
 enebular-agent is running as a system service.
 To check the status of agent, run the following command on the target device:
   sudo journalctl -ex -u enebular-agent-enebular.service
===========================================================================================================================================================================================
See details in full install log file: /tmp/enebular-agent-install-log.xRxHCC
pi@starter-kit-1:~ $

enebularのdeploy機能とenebular editorのローカル編集機能が使えたので良しとします。)

ラズパイの情報です。

pi@starter-kit-1:~ $ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@starter-kit-1:~ $ uname -a
Linux starter-kit-1 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
pi@starter-kit-1:~ $


この記事が気に入ったらサポートをしてみませんか?