# Deploying Multiple Organizations in Hyperledger Fabric Version 2.0, and Monitoring containers via cAdvisor

We have seen till now the **Hyperledger Architecture**, we will go into depth of working in the consequent blogs.This blog helps you get started with **Hyperledger Fabric Version 2.0 along with container monitoring via Googles Cadvisor** , I will also discuss the differences in Flow as compared to Version 1.0 . Lets get started !!

I have referred the Standard Hyperledger Fabric Documentation , and followed the relevant and optimized steps.

The prerequisites for executing this will be installing :**docker ,curl ,wget,npm,Go and Python**,I will give give you commands for **Ubuntu Systems to install Prerequisites.**

**Commands to install Docker and Docker-Compose**

~$ **sudo apt update**

~$ **sudo apt install docker-compose**

**Commands to install curl,python and wget**

~$ **sudo apt install curl python wget**

**Command to install go and npm**

To install the GO Language:

~$ wget [https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz](https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz)

**Set the environment variable in the .bashrc file in Home directory**

`export GOPATH=$HOME/go   export PATH=$PATH:$GOPATH/bin`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052956588/8afb91f9-75a9-4bda-88f4-bd6a53416aa2.png align="left")

One done : You just have to source the file : **source .bashrc**

$ vi .bashrc ###do the necessary changes and edits  
$ source .bashrc

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052958152/b8c4862f-dc02-4dd5-be43-1a765824c720.png align="left")

**Install the npm and nvm by the following commands**

`1)curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -   2)sudo apt-get install nodejs   3)wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash 4)npm install npm@5**.**6.0 **-**g`

**Install Hyperledger Fabric Version 2.0**

We will go for a stable release in Hyperledger with components mentioned with versions of (Certificate Authority)

curl -sSL [https://bit.ly/2ysbOFE](https://bit.ly/2ysbOFE) | bash -s — &lt;fabric\_version&gt; &lt;fabric-ca\_version&gt; &lt;thirdparty\_version&gt;

`curl **-sSL https://bit.ly/**2ysbOFE | bash **-s -- 2.0.1 1.4.6 0.4.**18`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052959691/e966e88f-4b45-47db-b60a-09e4a7bdc9c2.png align="left")

Installing Hyperledger Fabric

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052961593/5a77616d-98cf-4033-ad40-5ec021b46bb3.png align="left")

Downloading the docker images

**Once the Download is over you can do “docker ps”**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052963298/68713b3b-fb42-412e-a0b4-cfa4e0de5dc7.png align="left")

To see the containers running

[You can navigate to to the network directory and make the network](https://in.linkedin.com/in/anubhav-chaturvedi-a7465a72)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052965215/2e8d8423-8828-4b10-89d3-28b106d11ef4.png align="left")

Once inside the test network directory

**Make the network down by(if running) : “./network.sh down”**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052966627/0d070ada-eea5-4f75-aca9-6a88f8b8d7d8.png align="left")

**You will see all the peers,orderers and nodes coming down if running.**

As compared to Fabric 1.0 latest releases they have reduced the complications by making only 1 file for certificate generations and Deployment which is “network.sh”, instead of multiple files like “cryptogen and byfn” in the previous one.

**Make it up again: “./network.sh up”**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052968163/8408e92d-336c-42d9-9be5-079609c37053.png align="left")

YAML files bringing up container

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052969892/ca64173d-c7a9-40c0-9129-48edbbcb4003.png align="left")

Containers and Network Coming up

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052971534/63fecdfd-b5bb-4dce-8995-8d4f1630865e.png align="left")

docker ps results

**Lets now create one channel and run the chaincode**

`**./network.**sh createChannel -c mychannel`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052973121/1d0b9bcd-0077-421d-bde8-3bee0b8206a0.png align="left")

Mychannel deployed

**Lets run the Fabcar smart contract: “./network.sh deployCC”**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052974651/03231b2f-8c12-4a69-a107-8ff5bd8a7c66.png align="left")

Lets run the Fabcar Chain code

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052975938/d7a37525-11db-4180-bd8a-e94a1601b8df.png align="left")

Chaincode deployed in Peers

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052977871/2e4f6185-a1b5-404f-aedc-882e4b648e1f.png align="left")

Finally running the “QueryAllCars”

Lets **monitor** the deployed **nod**e via **Goolgle’s container monitoring too**l **Cadvisor**.Install it using:

anubhav@anubhav-VirtualBox:~/fabric-samples/test-network$ VERSION=v0.35.0 # use the latest release version from

anubhav@anubhav-VirtualBox:~/fabric-samples/test-network$ sudo docker run — volume=/:/rootfs:ro — volume=/var/run:/var/run:ro — volume=/sys:/sys:ro — volume=/var/lib/docker/:/var/lib/docker:ro — volume=/dev/disk/:/dev/disk:ro — publish=8080:8080 — detach=true — name=cadvisor gcr.io/google-containers/cadvisor:$VERSION

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052979634/572c3651-18b5-4b49-b18b-f82005736daf.png align="left")

You will see after some time Cadvisor coming up on port 8080 (ss -tln)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052981618/7efab5b4-a2d3-4821-a7f2-eb372322cdf5.png align="left")

ss -tln port

You can open **localhost:8080** , to see all the listed containers and Monitor its metrics and usages:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052983188/ab4efd4b-06f4-4ad2-b7f2-091c2f27531c.png align="left")

In the next post we will see how to increase the network traffic and test the limits of **Hyperledger Fabric**, also to monitor the network traffic

For any further Queries or anything related to Blockchain or Devops you can DM me on Linkedin.

[**Anubhav Chaturvedi - Devops Program Mentor - CodeAsylums | LinkedIn**  
\*Working as an Independent Contractor for roles like Blockchain Development(Hyperledger ) and Devops Engineer including…\*in.linkedin.com](https://in.linkedin.com/in/anubhav-chaturvedi-a7465a72)

> [Get Best Software Deals Directly In Your Inbox](https://coincodecap.com?utm_source=coinmonks)

[![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703052984384/a2d59d52-23c5-4161-92ee-6e16882909b0.png align="left")](https://coincodecap.com?utm_source=coinmonks)
