The intent of this guide in this section primary focus on the client environment to create Node-Red to connect to the IoT Websocket services in order to get the data from the device.
Before your start this guide in this section, assume you completed some pre-condition, which include: 1) User already have Bluemix account, space, and already in some organization 2) User already have some knowledge about node-red and already knew how to use it
If you are not satisfied the pre-condition, please following the guide in the invitation letter to have your own Bluemix account.
The node-red starter template default to binding Node-RED app and Cloudant DB. The initial process will take some time, since the Bluemix need to initial the environment and grant the database service authority.
1) On the first page, just click 'Next' Button, to move the next page.
2) The second page required your security strategy and ask you to provide the name/password to access the app, just choose the 'Allow anyone to access the editor' option in order to simplified the step.
3) Leave the the third page and just click the 'Next' Button, not choose any option from the page.
4) Click the 'Finish' Button to complete the initialization process and waiting for your Node-RED getting started.
1) Drag 'Websocket' node from the 'Input' section.
2) Double Click the 'Websocket' node, it will open the configuration page.
3) 'Type' Options => 'Connect to', click 'Edit' button right behind 'URL'.
4) 'URL' input box value is 'ws://sensoriot.mybluemix.net/ws/iot', select 'Send/Recieve Payload' options, then click 'Update' button, it will move to the previous page, then you can input the nick name for node or leave it as empty. Then, click 'Done' button to finish the configuration.(I input the nick name 'iot-device' for this node in my sample)
5) From function section drag 'json' node in order to format the incoming data from string to json
6) Drag the 'Debug' node from output section, it will be renamed to 'msg.payload' automatiically, and connect 'iot-device' node, 'json' node, and 'msg.payload' node by drag from entry point to the other. Like the sample I provided below.
7) Drag another 'Websocket' node from output
section, double click to edit.
8) 'Type' options => 'Linsen on', click edit URL for defining your Websocket service path. (My sample is '/ws/client/blockchain') Select 'Send/Recieve entire message' and then click 'Update' Button, then it move to the previous page, then click 'Done' button.
9) Drag the entry point and connect the nodes betwee 'jason' and 'Websocket' node your created just now. Then click the 'Deploy' button on the top of righ side.
10) please remember we will use the websocket link in this page in later step.
#
https://github.com/yidlhu/blockchaindemo/blob/master/GuideForVirtualBoxVM.MD
# # # #
The goal is to deploy blockchain demo on local blockchain docker images. It is a blockchain demo for 2017 innovation day training.
### (Mac/Linux)
open Terminal and execute the file: * fabric_import.sh * by the commands:
eg:
` ./fabric_import.sh `
### (Windows)
(1) Start Menu at All Apps > Windows System > Run
(2) run command line interface by input: * cmd *
(3) go to the folder you stored the tar file and execute the batch file.
eg:
` ./fabric_import.bat `
` docker images `
(should include 3 images as below: hyperledger/fabric-membersrvc:x86_64-0.6.1-preview , hyperledger/fabric-peer:x86_64-0.6.1-preview , fabric_client:v0.6.1 )
(Keep the below file in the current folder)
docker-compose.yml
docker-compose up
run the command
docker ps
(should include 3 containers as below: client_dev_s , peer_dev_s , ca_dev_s)
run the command
docker exec -it client_dev_s /bin/bash
cd $WORKSPACE/apps/DEMO root@xxx:~/workspace/apps/DEMO/startup.sh
docker exec -it client_dev_s /bin/bash
cd $GOPATH/src/chaincodes/hello
go build
go test
docker exec -it client_dev_s /bin/bash
cd $GOPATH/src/chaincodes/hello/scripts
./startup.sh
docker exec -it client_dev_s /bin/bash
cd $GOPATH/src/chaincodes/hello/scripts
./enroll.sh
./deploy.sh
./invoke.sh
./query.sh
guide: https://github.com/yidlhu/blockchaindemo/blob/master/readme%40bluemix.txt
workspace: https://ibm.box.com/s/dj4p2dzxw02ibvt8ppubigcangzqvk69