Hyperledger Fabric in Windows 10 WSL

Updated . Posted . Visible to the public.

Install WSL, Ubuntu, Docker

Install WSL Ubuntu, see instructions here Show archive.org snapshot

Note: important to choose Ubuntu as this will make installing Fabric much easier.

Install Docker, see instructions here Show archive.org snapshot

All instructions are issued in WSL Ubuntu terminal.

Install Golang

Use a helper script to install the latest Golang in $HOME:

$ cd
$ git clone https://github.com/udhos/update-golang
$ cd update-golang
$ sudo ./update-golang.sh

Update the go command:

$ sudo update-alternatives --install "/usr/bin/go" "go" "/usr/local/go/bin/go" 0
update-alternatives: using /usr/local/go/bin/go to provide /usr/bin/go (go) in auto mode
$ sudo update-alternatives --set go /usr/local/go/bin/go

Make a new directory for $GOPATH, which is the workspace directory for Go programs. When we use import, Go looks for src in the $GOPATH directory to find the packages. Fabric build framework requires us to set and export $GOPATH, and it must contain only the single directory name for your Go workspace.

$ mkdir $HOME/go
$ export GOPATH=$HOME/go

Check installation:

$ go version
go version go1.11.1 linux/amd64
$ which go
/usr/bin/go
$ go env

Note: need to enable Hyper-V in BIOS.

Install Hyperladger Fabric Samples, Binaries and Docker Images

Follow the instruction here Show archive.org snapshot .

Once you are ready, and in the directory into which you will install the Fabric Samples and binaries, go ahead and execute the following command:

$ curl -sSL http://bit.ly/2ysbOFE | bash -s 1.3.0

Install Hyperledger Composer

Check pre-requisites Show archive.org snapshot for Hyperledger Composer:

kiatng@win10:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic
kiatng@win10:~$ docker --version
Docker version 18.06.1-ce, build e68fc7a
kiatng@win10:~$ docker-compose --version
docker-compose version 1.13.0, build 1719ceb
kiatng@win10:~$ node --version
v10.13.0
kiatng@win10:~$ npm --version
6.4.1
kiatng@win10:~$ git --version
git version 2.19.1
kiatng@win10:~$ python --version
Python 2.7.15rc1

If we have the pre-requisites, follow the instruction here Show archive.org snapshot to install Hyperledger Composer:

$ npm install -g composer-cli@0.20
$ npm install -g composer-rest-server@0.20
$ npm install -g generator-hyperledger-composer@0.20
$ npm install -g yo

Install fabric-dev-servers

My fabric-dev-servers is in d: drive.

$ cd /mnt/d/Work/Fabric/fabric-dev-servers
$ curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz
$ tar -xvf fabric-dev-servers.tar.gz
$ export FABRIC_VERSION=hlfv12
$ ./downloadFabric.sh
$ ./startFabric.sh
$ ./createPeerAdminCard.sh

Init Fabric with startFabric.sh

  1. Mark the variable FABRIC_VERSION to be passed to child processes: export FABRIC_VERSION=hlfv12
  2. Start Fabric: ./startFabric.sh,which will create 4 containers
    1. peer node: peer0.org1.example.com
    2. couchdb
    3. certificate authority: ca.org1.example.com
    4. orderer: orderer.example.com
    5. network "net_default" with the default driver

Uninstalling Development Environment

Follow the instructions here Show archive.org snapshot

Destroy a Previous Setup

If you've previously used an older version of Hyperledger Composer and are now setting up a new install, you may want to kill and remove all previous Docker containers, which you can do with these commands:

$ docker kill $(docker ps -q)
$ docker rm $(docker ps -aq)
$ docker rmi $(docker images dev-* -q)

Error

Error response from daemon: Container 43c12a501d7139c83e0715ee1d282b60b5fa9f7505e0218ab690abbbb8c91c1c is not running
kiatng@win10:/mnt/d/Work/Fabric/fabric-dev-servers$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
43c12a501d71 hyperledger/fabric-peer:1.2.1 "peer node start" About a minute ago Exited (1) About a minute ago peer0.org1.example.com
18cbafb2248f hyperledger/fabric-couchdb:0.4.10 "tini -- /docker-ent…" About a minute ago Up About a minute 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
77687a5cb4be hyperledger/fabric-orderer:1.2.1 "orderer" About a minute ago Exited (1) About a minute ago orderer.example.com
3d449b3aa5ef hyperledger/fabric-ca:1.2.1 "sh -c 'fabric-ca-se…" About a minute ago Up About a minute 0.0.0.0:7054->7054/tcp ca.org1.example.com

docker logs e183dd

Output:

Cannot run peer because error when setting up MSP of type bccsp from directory /etc/hyperledger/peer/msp: could not load a valid signer certificate from directory /etc/hyperledger/peer/msp/signcerts: stat /etc/hyperledger/peer/msp/signcerts: no such file or directory

kiatng
Last edit
kiatng
Tags
Posted by kiatng to Fabric (2018-10-23 08:56)