[fabric combat guide 1] Fabric v1.0 deployment steps

The blockchain brother community, the pioneer of blockchain technology professional Q&A, the gathering place for Chinese blockchain technology enthusiasts

Author: Wu Shouhe

Source: Blockchain Brothers

Original link: http://www.blockchainbrother.com/article/17

Copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.
 

The following commands work correctly in fabric v1.0

Preparation before deployment:

  • docker 1.12.6
  • docker-compose 1.11.2
  • group 1.8
  • git

 

The deployment environment of fabric1.0 is a bit complicated, and a lot of docker commands are needed during the deployment and operation of fabric1.0. For this reason, we have published two articles to discuss this issue, you can refer to it.

Preparation of related environment and components before fabric1.0 installation and deployment

Docker commands needed during fabric1.0 installation

 

Next we will start running an example of e2e_cli that comes with fabric

The following figure is the network structure diagram in our example:

attachments-2017-07-nuuBGHw5596d7025d63c1.png


Download Fabric source code

mkdir -p $GOPATH/src/github.com/hyperledger/

cd $GOPATH/src/github.com/hyperledger/

git clone https://github.com/hyperledger/fabric.git

git reset --hard f56a82e36e040e1c1a986edfceac014ba1516571

make release
 
#Generate all docker images
make docker

cd $GOPATH/src/github.com/hyperledger/fabric/examples

cp -R e2e_cli e2e_demo # for the purpose of this tutorials
cd e2e_demo

tree

├── base # Docker base template file
│ ├── docker-compose-base.yaml
└── └── peer-base.yaml
├── channel-artifacts # Channel artifacts that will be generated and saved in this directory
├── configtx.yaml
├── crypto-config.yaml
├── docker-compose-cli.yaml
├── docker-compose-couch.yaml
├── docker-compose-e2e-template.yaml
├── docker-compose-e2e.yaml
├── download-dockerimages.sh
├── end-to-end.rst
├── examples
│ └── chaincode
│ └── go
│ └── chaincode_example02
│ └── chaincode_example02.go
├── generateArtifacts.sh # Generates channel artifacts and stores them under channel-artifacts folder
├── network_setup.sh # Fully automated script to stop/start a Fabric network
└── scripts
└── script.sh # Step by Step
 
Generate orderer and peer certificates (Identities)

Please make sure that the following operations are in the e2e_demo directory

os_arch=$(echo "$(uname -s)-amd64" | awk '{print tolower($0)}')
cp -R ./../../release/$os_arch/bin.
./bin/cryptogen generate --config=./crypto-config.yaml
tree crypto-config

├── ordererOrganizations
│ └── example.com
│ ├── ca
├── ├── msp
│ ├── orderers
│ │ └── orderer.example.com
...

└── peerOrganizations
├── org1.example.com
│ ├── ca
├── ├── msp
admincerts
│ │ ├── cacerts
│ │ └── tlscacerts
...
│ ├── peers
│ │ ├── peer0.org1.example.com

│ └── users
│ ├── [email protected]
│ └── [email protected]
...
└── org2.example.com
│ ├── ca
├── ├── msp
admincerts
│ │ ├── cacerts
│ │ └── tlscacerts
...
│ ├── peers
│ │ ├── peer0.org1.example.com
...
│ └── users
│ ├── [email protected]
│ └── [email protected]
 
生成 Channel Configuration and Gensis Block

Please make sure that the following operations are in the e2e_demo directory

CHANNEL_ID=my-channel
FABRIC_CFG_PATH=$PWD

# Create the orderer genesis block:
./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

# Create the channel transaction artifact:
./bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_ID
 
Generate Anchor Peers for each Org (Org1 & Org2)
./bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_ID -asOrg Org1MSP

./bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_ID -asOrg Org2MSP

ls -rtl ./channel-artifacts

-rw-r--r-- 1 shouhewu shouhewu 9076 Jul 17 15:21 genesis.block
-rw-r--r-- 1 shouhewu shouhewu 369 Jul 17 15:21 channel.tx
-rw-r--r-- 1 shouhewu shouhewu 250 Jul 17 15:21 Org1MSPanchors.tx
-rw-r--r-- 1 shouhewu shouhewu 250 Jul 17 15:21 Org2MSPanchors.tx
 
run e2e_demo
sed -i -e 's/e2ecli_default/e2edemo_default/' $PWD/base/peer-base.yaml

CHANNEL_NAME=my-channel TIMEOUT=10000000 docker-compose -f docker-compose-cli.yaml up -d

docker logs -f cli

docker logs -f orderer.example.com


# The chaincode logs
docker logs dev-peer0.org1.example.com-mycc-1.0
docker logs dev-peer0.org2.example.com-mycc-1.0
 
All in one
# START
./network_setup.sh up $CHANNEL_ID 1000000 # network_setup.sh up 
# STOP
./network_setup.sh down $CHANNEL_ID
 
REFERENCES

The article is published only to share the technical content of the blockchain, and the copyright belongs to the original author. The opinions only represent the author himself, and do not mean that the blockchain brothers agree with their views or confirm their descriptions

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324638584&siteId=291194637