Skip to content

Latest commit

 

History

History
204 lines (136 loc) · 6.77 KB

README.md

File metadata and controls

204 lines (136 loc) · 6.77 KB

Network Launcher

Attention

  1. each of container arguments in network.json must end with container_name
  2. zookeeper "volumes":["/data/docker-entrypoint.sh:/docker-entrypoint.sh"],

test network usage ./networkLauncher.sh -o 1 -x 2 -r 2 -p 2 -n 1 -t solo -f test -w 0.0.0.0 -S enabled -c 2s -l INFO -q INFO -B 2000

  • ./networkLauncher.sh -o 1 -x 2 -r 2 -p 2 -n 1 -t solo -f test -S enabled -c 2s -l INFO -q INFO -B 2000
  • ./networkLauncher.sh -o 1 -x 4 -r 4 -p 1 -n 2 -t solo -f test -S enabled -c 2s -l INFO -q INFO -B 2000

networkLauncher.sh

This is the main script to execute all tasks.

Usage:

./networkLauncher.sh [opt] [value]
   options:
     -a: network action [up|down], default=up
     -x: number of ca, default=0
     -d: ledger database type, default=goleveldb
     -f: profile string, default=test
     -h: hash type, default=SHA2
     -k: number of kafka, default=0
     -z: number of zookeepers, default=0
     -n: number of channels, default=1
     -o: number of orderers, default=1
     -p: number of peers per organization, default=1
     -r: number of organizations, default=1
     -s: security type, default=256
     -t: ledger orderer service type [solo|kafka], default=solo
     -w: host ip 1, default=0.0.0.0
     -l: core logging level [CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG], default=ERROR
     -q: orderer logging level [CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG], default=ERROR
     -c: batch timeout, default=2s
     -B: batch size, default=10
     -F: local MSP base directory, default=$GOPATH/src/github.com/hyperledger/fabric-test/fabric/common/tools/cryptogen
     -G: src MSP base directory, default=/opt/hyperledger/fabric/msp/crypto-config
     -S: TLS enablement [enabled|disabled], default=disabled
     -C: company name, default=example.com

Note that when -a down is invoked to clean network, the company name is used as a key word in searching for docker images to be deleted. The company name can be set using -C. The default company name is example.com.

Example:

The following commands will clean a network with containers and docker images:

./networkLauncher.sh -a down -C example.com
./networkLauncher.sh -a down

The above commands invoke cleanNetwork.sh.

The following commands will generate a network:

./networkLauncher.sh -o 1 -x 2 -r 2 -p 2 -k 1 -z 1 -n 2 -t kafka -f test -w 10.120.223.35
./networkLauncher.sh -o 1 -x 2 -r 2 -p 2 -n 1 -f test -w localhost
./networkLauncher.sh -o 3 -x 6 -r 6 -p 2 -k 3 -z 3 -n 3 -t kafka -f test -w localhost -S enabled

The above command will invoke cryptogen, cfgtxgen, generate orderer block, channel transaction and launch network.

cleanNetwork.sh

The script is used to clean a network.

Usage

./cleanNetwork.sh [docker image key word]

Example

./cleanNetwork.sh sample

cryptogen

The executable is in $GOPATH/src/github.com/hyperledger/fabric/common/tools/cryptogen and is used to create crypto

cd $GOPATH/src/github.com/hyperledger/fabric/common/tools/cryptogen
apt-get install libltdl-dev
go build

Usage

./cryptogen generate --output=<cryptogen dir> --config=<crypto config>

gen_configtx_cfg.sh

The script is used to create configtx.yaml.

Usage

./gen_configtx_cfg.sh [opt] [value]

options:
   -o: number of orderers, default=1
   -k: number of kafka, default=0
   -p: number of peers per organiztion, default=1
   -h: hash type, default=SHA2
   -r: number of organization, default=1
   -s: security service type, default=256
   -t: orderer service [solo|kafka], default=solo
   -f: profile name, default=test
   -b: MSP directory, default=$GOPATH/src/github.com/hyperledger/fabric-test/fabric/common/tools/cryptogen/crypto-config
   -w: host ip 1, default=0.0.0.0
   -c: batch timeout, default=2s
   -B: batch size, default=10
   -v: array of organization name, default=0
   -C: company name, default=example.com

Example:

./gen_configtx_cfg.sh -o 1 -k 1 -p 2 -r 6 -h SHA2 -s 256 -t kafka -b /root/gopath/src/github.com/hyperledger/fabric-test/fabric/common/tools/cryptogen/crypto-config -w 10.120.223.35

configtx.yaml-in

This is a sample of configtx.yaml to be used to generate the desired configtx.yaml. The key words in the sample file are:

  • &ProfileString: the profile string
  • *Org0: used by the script to list all organizations
  • &OrdererOrg: used by the script to list all Organization with its attributes
  • &Org0: used for the list of peers in organization
  • OrdererType: used for the orderer service type

gen_network.sh

The script is used to create a docker-compose.yml and launch the network with specified number of peers, orderers, orderer service type etc.

Usage

gen_network.sh [opt] [value]

options:
   network variables
   -a: action [create|add]
   -p: number of peers per organization
   -o: number of orderers
   -k: number of brokers
   -z: number of zookeeper
   -r: number of organiztions
   -S: TLS enablement [enabled|disabled], default=disabled
   -x: number of ca
   -F: local MSP base directory, default=$GOPATH/src/github.com/hyperledger/fabric-test/fabric/common/tools/cryptogen/crypto-config
   -G: src MSP base directory, default=/opt/hyperledger/fabric/msp/crypto-config
   -C: company name, default=example.com

   peer environment variables
   -l: core logging level [(default = not set)|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG]
   -d: core ledger state DB [goleveldb|couchdb]

   orderer environment variables
   -t: orderer type [solo|kafka]
   -q: orderer logging level [(default = not set)|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG]

Example

./gen_network.sh -a create -z 2 -p 2 -r 2 -o 1 -k 1 -t kafka -d goleveldb -F /root/gopath/src/github.com/hyperledger/fabric-test/fabric/common/tools/cryptogen/crypto-config -G /opt/hyperledger/fabric/msp/crypto-config

IP address and port

All IP addresses and ports of orderer, peer, event hub are specified in network.json.

"caAddress": "0.0.0.0",
"caPort": "7054",
"ordererAddress": "0.0.0.0",
"ordererPort": "7050",
"couchdbAddress": "0.0.0.0",
"couchdbPort": "5984",
"vp0Address": "0.0.0.0",
"vp0Port": "7061",
"evtAddress": "0.0.0.0",
"evtPort": "9061",

Images

All images (peer, kafka, and orderer etc) path (location) are specified in network.json

    "ca": {
         "image": "hyperledger/fabric-ca",

    "zookeeper": {
        "image": "hyperledger/fabric-zookeeper",


    "kafka": {
        "image": "hyperledger/fabric-kafka",


    "orderer": {
        "image": "hyperledger/fabric-orderer",


    "peer": {
        "image": "hyperledger/fabric-peer",