Code for the IoT+ BigchainDb + MSFT + VW PoC at the hackfest in Berlin held from 28 Feb to 03 Mar 2017
NOTE: You may have to use different the public and private keys than those
used below.
docker run \
--detach \
--name=rethinkdb \
--publish=172.17.0.1:28015:28015 \
--publish=172.17.0.1:8080:8080 \
--restart=always \
--volume "$HOME/bigchaindb_docker:/data" \
rethinkdb:2.3
To check the logs: docker logs -f rethinkdb
Note: You do not need to do this step if you have done this already
docker run \
--interactive \
--rm \
--tty \
--volume "$HOME/bigchaindb_docker:/data" \
bigchaindb/bigchaindb \
-y configure \
rethinkdb
Change the database.host
param in ~/bigchaindb_docker/.bigchaindb
file
from localhost
to 172.17.0.1
docker run \
--detach \
--name=bigchaindb \
--publish=172.17.0.1:9984:9984 \
--restart=always \
--volume=$HOME/bigchaindb_docker:/data \
bigchaindb/bigchaindb \
start
To check the logs: docker logs -f bigchaindb
cd IoT-hackfest-berlin-2017/bdb-web-api/nginx
docker build -t bdb-nginx .
docker run \
--detach \
--name=bdb-nginx \
--publish=80:80 \
--restart=always \
bdb-nginx
To check the logs: docker logs -f bdb-nginx
cd IoT-hackfest-berlin-2017/bdb-web-api/lungo_tavolo
python3 lungo_tavolo.py \
--bdb-ip localhost \
--bdb-port 80 \
--public-key F911cpKsZTP3Fxzx243mJqUh15CtGDTRuVBaw5xnvGXh \
--private-key 6H6g4c6fwc5MCDMT4cmTgDDuij9Yhr6FXVJ7G2sMoztJ \
--file ["Product Data Lungo Tavolo - Skirt.csv" |
"Product Data Lungo Tavolo - Top.csv" |
"Product Data Lungo Tavolo - Pants.csv" ]
Note the transaction id for each product. We will need them later.
Use the transaction id in the code, as this is hardcoded for the PoC.
cd IoT-hackfest-berlin-2017/front-end/lt
docker build -t hackfest-lt .
docker run \
--detach \
--name=hackfest-lt \
--publish=172.17.0.1:8002:8002 \
--restart=always \
hackfest-lt
To check the logs: docker logs -f hackfest-lt
cd IoT-hackfest-berlin-2017/front-end/vw
docker build -t hackfest-vw .
docker run \
--detach \
--name=hackfest-vw \
--publish=172.17.0.1:8001:8001 \
--restart=always \
hackfest-vw
To check the logs: docker logs -f hackfest-vw
cd IoT-hackfest-berlin-2017/vw-web-api
docker build -t vw-web-api .
docker run \
--detach \
--name=vw-web \
--publish=5000:5000 \
--restart=always \
vw-web-api
cd IoT-hackfest-berlin-2017/bdb-web-api/vw
docker build -t vw-backend-api .
docker run \
--detach \
--name=vw-backend-api \
--publish=5000:5000 \
--restart=always \
vw-web-api
python3 rest_api.py
--bdb-ip localhost
--bdb-port 9984
--public-key F911cpKsZTP3Fxzx243mJqUh15CtGDTRuVBaw5xnvGXh
--private-key 6H6g4c6fwc5MCDMT4cmTgDDuij9Yhr6FXVJ7G2sMoztJ
groupadd -r mongodb && useradd -r -g mongodb mongodb
docker run
--detach
--name=mongodb
--publish=172.17.0.1:27017:27017
--restart=always
--volume=/tmp/mongodb_docker/db:/data/db
--volume=/tmp/mongodb_docker/configdb:/data/configdb
mongo:3.4.1
--replSet=bigchain-rs
curl -X POST
-H "Content-Type: application/json"
--data "@test-telemetry-data.json"
http://bcdbhack.westeurope.cloudapp.azure.com:5000/telemetry