Update with more example operations

pull/16/head
Baohua Yang 2016-09-14 16:58:02 +08:00
parent 54a3c7adad
commit d053f8fd5f
3 changed files with 46 additions and 33 deletions

View File

@ -1,14 +1,15 @@
# Hyperledger fabric # Hyperledger fabric
You can use the following script to install docker and start PBFT cluster in one instruction. You can use the following script to install docker and start a 4-node PBFT cluster in one instruction.
```sh ```sh
$ bash setupPbft.sh $ bash setupPbft.sh
``` ```
## Download Images
If you want to start it manually, follow the steps: If you want to start it manually, follow the steps:
First, pull an `openblockchain/baseimage:latest` first. First, pull necessary images first.
```sh ```sh
$ docker pull yeasy/hyperledger:latest && docker tag yeasy/hyperledger:latest hyperledger/fabric-baseimage:latest $ docker pull yeasy/hyperledger:latest && docker tag yeasy/hyperledger:latest hyperledger/fabric-baseimage:latest
@ -16,9 +17,13 @@ $ docker pull yeasy/hyperledger-peer:latest
$ docker pull yeasy/hyperledger-membersrvc:latest $ docker pull yeasy/hyperledger-membersrvc:latest
``` ```
Then go into the specific consensus directory, then you can start a 4 nodes hyperledger cluster. ### Start 4 Noops node cluster
E.g., for pbft consensus, use ```sh
$ cd noops; docker-compose up
```
### Start 4 PBFT node cluster
```sh ```sh
$ cd pbft; docker-compose up $ cd pbft; docker-compose up
@ -26,14 +31,29 @@ $ cd pbft; docker-compose up
After the cluster is synced, you can validate by deploying, invoking or querying chaincode from the container or from the host. After the cluster is synced, you can validate by deploying, invoking or querying chaincode from the container or from the host.
See [hyperledger-peer](https://github.com/yeasy/docker-hyperledger-peer) if you've not familiar on that. See [hyperledger-peer](https://github.com/yeasy/docker-hyperledger-peer) if you've not familiar on those operations.
### Start 4 PBFT node cluster with member service
```sh
$ cd pbft; docker-compose -f docker-compose-with-membersrvc.yml up
```
Then go to vp0, login and deploy a chaincode.
```sh
$ docker exec -it pbft_vp0_1 bash
# peer network login jim
08:23:13.604 [networkCmd] networkLogin -> INFO 001 CLI client login...
08:23:13.604 [networkCmd] networkLogin -> INFO 002 Local data store for client loginToken: /var/hyperledger/production/client/
Enter password for user 'jim': 6avZQLwcUe9b
...
# peer chaincode deploy -u jim -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'
```
4 new chaincode containers will be built up automatically.
## Acknowledgement
This refers the example from the [hyperledger](https://github.com/hyperledger/fabric/tree/master/consensus/docker-compose-files) project. This refers the example from the [hyperledger](https://github.com/hyperledger/fabric/tree/master/consensus/docker-compose-files) project.
## noops
Use the noops as consensus, i.e., no consensus.
## pbft
Use pbft as consensus.

View File

@ -21,16 +21,12 @@ membersrvc:
vp0: vp0:
extends: extends:
file: peer-pbft.yml file: peer-pbft.yml
service: vp service: vp_sec
hostname: vp0 hostname: vp0
environment: environment:
- CORE_PEER_ID=vp0 - CORE_PEER_ID=vp0
- CORE_SECURITY_ENABLED=true
- CORE_SECURITY_ENROLLID=test_vp0 - CORE_SECURITY_ENROLLID=test_vp0
- CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
ports: ports:
- "7050:7050" - "7050:7050"
#- "7051:7051" #- "7051:7051"
@ -41,17 +37,13 @@ vp0:
vp1: vp1:
extends: extends:
file: peer-pbft.yml file: peer-pbft.yml
service: vp service: vp_sec
hostname: vp1 hostname: vp1
environment: environment:
- CORE_PEER_ID=vp1 - CORE_PEER_ID=vp1
- CORE_SECURITY_ENABLED=true
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
- CORE_SECURITY_ENROLLID=test_vp1 - CORE_SECURITY_ENROLLID=test_vp1
- CORE_SECURITY_ENROLLSECRET=5wgHK9qqYaPy - CORE_SECURITY_ENROLLSECRET=5wgHK9qqYaPy
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
links: links:
- membersrvc - membersrvc
- vp0 - vp0
@ -60,17 +52,13 @@ vp1:
vp2: vp2:
extends: extends:
file: peer-pbft.yml file: peer-pbft.yml
service: vp service: vp_sec
hostname: vp2 hostname: vp2
environment: environment:
- CORE_PEER_ID=vp2 - CORE_PEER_ID=vp2
- CORE_SECURITY_ENABLED=true
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
- CORE_SECURITY_ENROLLID=test_vp2 - CORE_SECURITY_ENROLLID=test_vp2
- CORE_SECURITY_ENROLLSECRET=vQelbRvja7cJ - CORE_SECURITY_ENROLLSECRET=vQelbRvja7cJ
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
links: links:
- membersrvc - membersrvc
- vp0 - vp0
@ -82,17 +70,13 @@ vp2:
vp3: vp3:
extends: extends:
file: peer-pbft.yml file: peer-pbft.yml
service: vp service: vp_sec
hostname: vp3 hostname: vp3
environment: environment:
- CORE_PEER_ID=vp3 - CORE_PEER_ID=vp3
- CORE_SECURITY_ENABLED=true
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
- CORE_SECURITY_ENROLLID=test_vp3 - CORE_SECURITY_ENROLLID=test_vp3
- CORE_SECURITY_ENROLLSECRET=9LKqKH5peurL - CORE_SECURITY_ENROLLSECRET=9LKqKH5peurL
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
links: links:
- membersrvc - membersrvc
- vp0 - vp0

View File

@ -28,3 +28,12 @@ vp:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
command: peer node start # this repeats the default cmd to make sure command: peer node start # this repeats the default cmd to make sure
# command: sh -c "sleep 5; peer node start" # peer node should have booting delay with CA # command: sh -c "sleep 5; peer node start" # peer node should have booting delay with CA
vp_sec:
extends:
service: vp
environment:
- CORE_SECURITY_ENABLED=true
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054