完成イメージ

仕組みはこんな感じ

※dockerコンテナをホスト側から操作するので各gethのポート番号は異なります。
監視対象はこちらで作成したdockerコンテナ
API(eth-net-intelligence-api)とWeb(eth-netstats)はdockerのホスト上に設置します(dockerコンテナ化出来たらまた刷新するかも)
共通
・npmのパッケージインストール
sudo npm install -g grunt-cli
sudo npm install -g pm2
sudo npm install -g primus
eth-net-intelligence-apiのインストール
cd ~/
git clone https://github.com/cubedro/eth-net-intelligence-api
cd eth-net-intelligence-api
bin/update.sh
※rootの実行権限が必要なのでsudoできるユーザかrootで実行要
cd eth-net-inteligence-api
npm install
cat - > process.json
---
[
{
"name" : "node01",
"cwd" : "/home/yosshi/eth-net-intelligence-api",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"log_file" : "/home/yosshi/logs/node01-app-log.log",
"out_file" : "/home/yosshi/logs/node01-app-out.log",
"error_file" : "/home/yosshi/logs/node01-app-err.log",
"merge_logs" : false,
"watch" : false,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "cluster_mode",
"env":
{
"NODE_ENV" : "test",
"RPC_HOST" : "localhost",
"RPC_PORT" : "8546",
"LISTENING_PORT" : "30304",
"INSTANCE_NAME" : "node01",
"CONTACT_DETAILS" : "",
"WS_SERVER" : "http://127.0.0.1:53000",
"WS_SECRET" : "secret",
"VERBOSITY" : 2
}
},
{
"name" : "node02",
"cwd" : "/home/yosshi/eth-net-intelligence-api",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"log_file" : "/home/yosshi/logs/node02-app-log.log",
"out_file" : "/home/yosshi/logs/node02-app-out.log",
"error_file" : "/home/yosshi/logs/node02-app-err.log",
"merge_logs" : false,
"watch" : false,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "cluster_mode",
"env":
{
"NODE_ENV" : "test",
"RPC_HOST" : "localhost",
"RPC_PORT" : "8547",
"LISTENING_PORT" : "30305",
"INSTANCE_NAME" : "node02",
"CONTACT_DETAILS" : "",
"WS_SERVER" : "http://127.0.0.1:53000",
"WS_SECRET" : "secret",
"VERBOSITY" : 2
}
}
]
---
※各pathやWS_SECRETは環境にあわせてください
pm2 start process.json
・その他のコマンド
pm2 list
pm2 monit
pm2 show node01
pm2 restart node01
pm2 kill
eth-netstats
cd ~/
git clone https://github.com/cubedro/eth-netstats
cd eth-netstats
npm install
grunt all
export PORT=53000; export WS_SECRET=secret; npm start
ブラウザで http://localhost:53000/ で接続できる。