Wednesday, 28 February 2018

Checklist for setting up Hyperledger-Fabric block chain on Windows (local) and fixes - Sandeep Kanao

Checklist for setting up Hyperledger-Fabric block chain on Windows (local) and fixes - Sandeep Kanao

1.Docker
https://docs.docker.com/toolbox/toolbox_install_windows/
2. curl
https://curl.haxx.se/download.html

Add to  path
C:\curl\curl-7.58.0-win64-mingw\bin

lib
C:\curl\curl-7.58.0-win64-mingw\lib

3. GoLanguage
https://golang.org/dl/
https://golang.org/doc/install?download=go1.10.windows-amd64.msi

update path
PATH=%PATH%:C:/go/bin

update npm beofre installing windows build tools

4. npm install npm@5.6.0 -g

5. Node.js
https://nodejs.org/en/download/

6. npm install --global windows-build-tools (powershell admin)

7. npm install --global grpc (powershell admin)


8. git bash
https://git-scm.com/downloads (minggw64)

setx PATH=%PATH%;C:\Program Files\Docker Toolbox\

set
git config --global core.autocrlf false
git config --global core.longpaths true

open git and verify
git config --get core.autocrlf (should be false)
git config --get core.longpaths (should be true)

9. docker-machine create test (bash)

10 docker-machine.exe env test (bash)

11. eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env test)  --(bash-to-set all env vars)

12. Hyperledger
curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0-alpha

13. cd c:/Users/kanao/fabric-samples/first-network
git clone -b master https://github.com/hyperledger/fabric-samples.git
cd fabric-samples
git checkout v1.1.0-alpha

14 from bash
cd 
/c/Users/kanao/fabric-samples/first-network

 ./byfn.sh -m generate -c mychannel
./byfn.sh -m up -l node


**** To stop channel
./byfn.sh down



Check if anything fails


kill any stale or active containers
docker rm -f $(docker ps -aq)

2. Clear any cached networks
docker network prune

3. Remove chaincode image
docker rmi dev-peer0.org1.example.com-fabcar-1.0-

5c906e402ed29f20260ae42283216aa75549c571e2e380f3615826365d8269ba

4. export FABRIC_START_TIMEOUT=10

5. npm install

6. ./startFabric.sh -- if error use powershell and issue --  restart-service *docker*

7. Node.js implementation
./startFabric.sh node

8. In a new cmd window -
docker logs -f ca.example.com

9. node enrollAdmin.js (bash)
*** if any errors, replace localhost in js file with ip 192.168.99.100 keep the port

10 error when running js
npm install --global windows-build-tools
then rerun "npm install"

11. Clear 
docker rm -f $(docker ps -aq)

---------------------------------------------
Install chaincode with new name or incremented version
Same name, but updated version:

peer chaincode install -n fabcar -v 2.0 -p github.com/fabcar
or same version, but new name:

peer chaincode install -n tickets -v 1.0 -p github.com/fabcar
Cleanup old chaincode container and install updated version of alternated chaincode over again.
You can use following command to remove old chaincode container image:

docker images | grep fabcar | awk '{print $2}' | docker rmi
--------------------------------------------

Restart again
update tags in docker-compose.yml
couchdb tags : https://hub.docker.com/r/hyperledger/fabric-couchdb/tags/

----------------------------------------------------------------------------


No comments:

Post a Comment