From 4e0683f31b2d85f8935720534fb9b03a37cdfc18 Mon Sep 17 00:00:00 2001 From: Baohua Yang Date: Fri, 18 Nov 2016 17:18:41 +0800 Subject: [PATCH] Add hyperledger with blockchain-explorer project --- hyperledger/README.md | 24 +++ hyperledger/noops/docker-compose-1.yml | 27 ++- .../noops/docker-compose-with-membersrvc.yml | 178 +++++++++--------- hyperledger/noops/docker-compose.yml | 93 ++++----- hyperledger/noops/peer-noops.yml | 41 ++-- .../pbft/docker-compose-with-explorer.yml | 76 ++++++++ .../pbft/docker-compose-with-membersrvc.yml | 146 +++++++------- hyperledger/pbft/docker-compose.yml | 102 +++++----- hyperledger/pbft/peer-pbft.yml | 69 ++++--- 9 files changed, 454 insertions(+), 302 deletions(-) create mode 100644 hyperledger/pbft/docker-compose-with-explorer.yml diff --git a/hyperledger/README.md b/hyperledger/README.md index 0a361e59..d668b493 100644 --- a/hyperledger/README.md +++ b/hyperledger/README.md @@ -6,6 +6,8 @@ You can use the following script to install docker and start a 4-node PBFT clust $ bash setupPbft.sh ``` +## Preparation + ## Download Images If you want to start it manually, follow the steps: @@ -20,6 +22,15 @@ $ docker tag yeasy/hyperledger-fabric:0.6-dp hyperledger/fabric-baseimage:latest $ docker tag yeasy/hyperledger-fabric:0.6-dp hyperledger/fabric-membersrvc:latest ``` +### Setup network +If you want to enable the external network options in the compose files, please create two Docker networks for usage. Otherwise, just ignore. +```sh +$ docker network create fabric_noops +$ docker network create fabric_pbft +``` + +## Usage + ### Start 4 Noops node cluster ```sh @@ -34,9 +45,22 @@ $ 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. +```sh +$ docker exec -it pbft_vp0_1 bash +# peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}' +``` + See [hyperledger-fabric](https://github.com/yeasy/docker-hyperledger-fabric) if you've not familiar on those operations. +### Start 4 PBFT node cluster with blockchain explorer + +```sh +$ cd pbft; docker-compose -f docker-compose-with-explorer.yml up +``` + +Then visit the 9090 port on the host using Web. + ### Start 4 PBFT node cluster with member service ```sh diff --git a/hyperledger/noops/docker-compose-1.yml b/hyperledger/noops/docker-compose-1.yml index ecc1b7f2..135b7eef 100644 --- a/hyperledger/noops/docker-compose-1.yml +++ b/hyperledger/noops/docker-compose-1.yml @@ -5,18 +5,25 @@ # vp3: validating node as peer # https://github.com/yeasy/docker-compose-files +version: '2' + +services: # validating node as the root # vp0 will also be used for client interactive operations # If you want to run fabric command on the host, then map 7051:7051 to host # port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. -vp0: - extends: - file: peer-noops.yml - service: vp - hostname: vp0 - environment: - - CORE_PEER_ID=vp0 - ports: - - "7050:7050" - #- "7051:7051" + vp0: + extends: + file: peer-noops.yml + service: vp + hostname: vp0 + environment: + - CORE_PEER_ID=vp0 + ports: + - "7050:7050" + #- "7051:7051" +#networks: +# default: +# external: +# name: fabric_noops diff --git a/hyperledger/noops/docker-compose-with-membersrvc.yml b/hyperledger/noops/docker-compose-with-membersrvc.yml index 78791de7..799904a9 100644 --- a/hyperledger/noops/docker-compose-with-membersrvc.yml +++ b/hyperledger/noops/docker-compose-with-membersrvc.yml @@ -8,92 +8,100 @@ # vp3: validating node as peer # https://github.com/yeasy/docker-compose-files -membersrvc: - image: hyperledger/fabric-membersrvc:latest - restart: unless-stopped - expose: - - "7054" - volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT - - /var/run/docker.sock:/var/run/docker.sock - command: membersrvc # this repeats the default cmd to make sure +version: '2' -# validating node as the root -# vp0 will also be used for client interactive operations -# If you want to run fabric command on the host, then map 7051:7051 to host -# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. -vp0: - extends: - file: peer-noops.yml - service: vp - hostname: vp0 - environment: - - CORE_PEER_ID=vp0 - - CORE_SECURITY_ENABLED=true - - CORE_SECURITY_ENROLLID=test_vp0 - - 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: - - "7050:7050" - - "7051:7051" - links: - - membersrvc - command: sh -c "sleep 5; peer node start" +services: + membersrvc: + image: hyperledger/fabric-membersrvc:latest + restart: unless-stopped + expose: + - "7054" + volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT + - /var/run/docker.sock:/var/run/docker.sock + command: membersrvc # this repeats the default cmd to make sure -vp1: - extends: - file: peer-noops.yml - service: vp - hostname: vp1 - environment: - - CORE_PEER_ID=vp1 - - CORE_SECURITY_ENABLED=true - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - - CORE_SECURITY_ENROLLID=test_vp1 - - 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: - - membersrvc - - vp0 - command: sh -c "sleep 5; peer node start" + # validating node as the root + # vp0 will also be used for client interactive operations + # If you want to run fabric command on the host, then map 7051:7051 to host + # port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. + vp0: + extends: + file: peer-noops.yml + service: vp + hostname: vp0 + environment: + - CORE_PEER_ID=vp0 + - CORE_SECURITY_ENABLED=true + - CORE_SECURITY_ENROLLID=test_vp0 + - 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: + - "7050:7050" + - "7051:7051" + links: + - membersrvc + command: sh -c "sleep 5; peer node start" -vp2: - extends: - file: peer-noops.yml - service: vp - hostname: vp2 - environment: - - CORE_PEER_ID=vp2 - - CORE_SECURITY_ENABLED=true - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - - CORE_SECURITY_ENROLLID=test_vp2 - - 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: - - membersrvc - - vp0 - command: sh -c "sleep 5; peer node start" + vp1: + extends: + file: peer-noops.yml + service: vp + hostname: vp1 + environment: + - CORE_PEER_ID=vp1 + - CORE_SECURITY_ENABLED=true + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp1 + - 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: + - membersrvc + - vp0 + command: sh -c "sleep 5; peer node start" -vp3: - extends: - file: peer-noops.yml - service: vp - hostname: vp3 - environment: - - CORE_PEER_ID=vp3 - - CORE_SECURITY_ENABLED=true - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - - CORE_SECURITY_ENROLLID=test_vp3 - - 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: - - membersrvc - - vp0 - command: sh -c "sleep 5; peer node start" + vp2: + extends: + file: peer-noops.yml + service: vp + hostname: vp2 + environment: + - CORE_PEER_ID=vp2 + - CORE_SECURITY_ENABLED=true + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp2 + - 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: + - membersrvc + - vp0 + command: sh -c "sleep 5; peer node start" + + vp3: + extends: + file: peer-noops.yml + service: vp + hostname: vp3 + environment: + - CORE_PEER_ID=vp3 + - CORE_SECURITY_ENABLED=true + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp3 + - 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: + - membersrvc + - vp0 + command: sh -c "sleep 5; peer node start" + +#networks: +# default: +# external: +# name: fabric_noops diff --git a/hyperledger/noops/docker-compose.yml b/hyperledger/noops/docker-compose.yml index edc2c2fc..e2457c64 100644 --- a/hyperledger/noops/docker-compose.yml +++ b/hyperledger/noops/docker-compose.yml @@ -5,54 +5,61 @@ # vp3: validating node as peer # https://github.com/yeasy/docker-compose-files +version: '2' + +services: # validating node as the root # vp0 will also be used for client interactive operations # If you want to run fabric command on the host, then map 7051:7051 to host # port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. -vp0: - extends: - file: peer-noops.yml - service: vp - hostname: vp0 - environment: - - CORE_PEER_ID=vp0 - ports: - - "7050:7050" - #- "7051:7051" + vp0: + extends: + file: peer-noops.yml + service: vp + hostname: vp0 + environment: + - CORE_PEER_ID=vp0 + ports: + - "7050:7050" + #- "7051:7051" -# validating node -vp1: - extends: - file: peer-noops.yml - service: vp - hostname: vp1 - environment: - - CORE_PEER_ID=vp1 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - links: + # validating node + vp1: + extends: + file: peer-noops.yml + service: vp + hostname: vp1 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + + # validating node + vp2: + extends: + file: peer-noops.yml + service: vp + hostname: vp2 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: - vp0 -# validating node -vp2: - extends: - file: peer-noops.yml - service: vp - hostname: vp2 - environment: - - CORE_PEER_ID=vp2 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - links: - - vp0 + # validating node + vp3: + extends: + file: peer-noops.yml + service: vp + hostname: vp3 + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 - -# validating node -vp3: - extends: - file: peer-noops.yml - service: vp - hostname: vp3 - environment: - - CORE_PEER_ID=vp3 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - links: - - vp0 +#networks: +# default: +# external: +# name: fabric_pbft diff --git a/hyperledger/noops/peer-noops.yml b/hyperledger/noops/peer-noops.yml index 40e16c31..8aed56f8 100644 --- a/hyperledger/noops/peer-noops.yml +++ b/hyperledger/noops/peer-noops.yml @@ -7,22 +7,25 @@ # This utilizes the noops as consensus # See https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devnet-setup.md#using-consensus-plugin for more details. -vp: - image: hyperledger/fabric-peer:latest - restart: unless-stopped - environment: - - CORE_PEER_ADDRESSAUTODETECT=true - - CORE_PEER_NETWORKID=dev - - CORE_LOGGING_LEVEL=info #critical, error, warning, notice, info, debug - # The following section enables pbft consensus - - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=noops # noops, pbft - - CORE_NOOPS_BLOCK_TIMEOUT=2s - - CORE_NOOPS_BLOCK_WAIT=2s - expose: - - "7051" - - "7052" - - "7053" - volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT - - /var/run/docker.sock:/var/run/docker.sock - 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 +version: '2' + +services: + vp: + image: hyperledger/fabric-peer:latest + restart: unless-stopped + environment: + - CORE_PEER_ADDRESSAUTODETECT=true + - CORE_PEER_NETWORKID=dev + - CORE_LOGGING_LEVEL=info #critical, error, warning, notice, info, debug + # The following section enables pbft consensus + - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=noops # noops, pbft + - CORE_NOOPS_BLOCK_TIMEOUT=2s + - CORE_NOOPS_BLOCK_WAIT=2s + expose: + - "7051" + - "7052" + - "7053" + volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT + - /var/run/docker.sock:/var/run/docker.sock + 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 diff --git a/hyperledger/pbft/docker-compose-with-explorer.yml b/hyperledger/pbft/docker-compose-with-explorer.yml new file mode 100644 index 00000000..057dc817 --- /dev/null +++ b/hyperledger/pbft/docker-compose-with-explorer.yml @@ -0,0 +1,76 @@ +# This compose file will start a cluster with 4 hyperledger peer nodes +# vp0: validating node as root +# vp1: validating node as peer +# vp2: validating node as peer +# vp3: validating node as peer +# https://github.com/yeasy/docker-compose-files + +version: '2' + +services: + # blockchain-explorer + explorer: + image: yeasy/blockchain-explorer:latest + restart: unless-stopped + hostname: explorer + environment: + - HYP_REST_ENDPOINT=http://vp0:7050 + ports: + - "9090:9090" + + # validating node as the root + vp0: + extends: + file: peer-pbft.yml + service: vp + hostname: vp0 + environment: + - CORE_PEER_ID=vp0 + ports: + - "7050:7050" + #- "7051:7051" + + # validating node + vp1: + extends: + file: peer-pbft.yml + service: vp + hostname: vp1 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + + # validating node + vp2: + extends: + file: peer-pbft.yml + service: vp + hostname: vp2 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + + + # validating node + # vp3 will also be used for client interactive operations + # If you want to run fabric command on the host, then map 7051:7051 to host + # port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. + vp3: + extends: + file: peer-pbft.yml + service: vp + hostname: vp3 + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +#networks: +# default: +# external: +# name: fabric_pbft \ No newline at end of file diff --git a/hyperledger/pbft/docker-compose-with-membersrvc.yml b/hyperledger/pbft/docker-compose-with-membersrvc.yml index e8ff934b..89a175fc 100644 --- a/hyperledger/pbft/docker-compose-with-membersrvc.yml +++ b/hyperledger/pbft/docker-compose-with-membersrvc.yml @@ -8,76 +8,84 @@ # vp3: validating node as peer # https://github.com/yeasy/docker-compose-files -membersrvc: - image: hyperledger/fabric-membersrvc:latest - restart: unless-stopped - expose: - - "7054" - volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT - - /var/run/docker.sock:/var/run/docker.sock - command: membersrvc # this repeats the default cmd to make sure +version: '2' -# validating node as the root -vp0: - extends: - file: peer-pbft.yml - service: vp_sec - hostname: vp0 - environment: - - CORE_PEER_ID=vp0 - - CORE_SECURITY_ENROLLID=test_vp0 - - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT - ports: - - "7050:7050" - - "7051:7051" - links: - - membersrvc - command: sh -c "sleep 5; peer node start" +services: + membersrvc: + image: hyperledger/fabric-membersrvc:latest + restart: unless-stopped + expose: + - "7054" + volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT + - /var/run/docker.sock:/var/run/docker.sock + command: membersrvc # this repeats the default cmd to make sure -vp1: - extends: - file: peer-pbft.yml - service: vp_sec - hostname: vp1 - environment: - - CORE_PEER_ID=vp1 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - - CORE_SECURITY_ENROLLID=test_vp1 - - CORE_SECURITY_ENROLLSECRET=5wgHK9qqYaPy - links: - - membersrvc - - vp0 - command: sh -c "sleep 5; peer node start" + # validating node as the root + vp0: + extends: + file: peer-pbft.yml + service: vp_sec + hostname: vp0 + environment: + - CORE_PEER_ID=vp0 + - CORE_SECURITY_ENROLLID=test_vp0 + - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT + ports: + - "7050:7050" + - "7051:7051" + links: + - membersrvc + command: sh -c "sleep 5; peer node start" -vp2: - extends: - file: peer-pbft.yml - service: vp_sec - hostname: vp2 - environment: - - CORE_PEER_ID=vp2 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - - CORE_SECURITY_ENROLLID=test_vp2 - - CORE_SECURITY_ENROLLSECRET=vQelbRvja7cJ - links: - - membersrvc - - vp0 - command: sh -c "sleep 5; peer node start" + vp1: + extends: + file: peer-pbft.yml + service: vp_sec + hostname: vp1 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp1 + - CORE_SECURITY_ENROLLSECRET=5wgHK9qqYaPy + links: + - membersrvc + - vp0 + command: sh -c "sleep 5; peer node start" -# vp3 will be used for client interactive operations -# If you want to run fabric command on the host, then map 7051:7051 to host -# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. -vp3: - extends: - file: peer-pbft.yml - service: vp_sec - hostname: vp3 - environment: - - CORE_PEER_ID=vp3 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - - CORE_SECURITY_ENROLLID=test_vp3 - - CORE_SECURITY_ENROLLSECRET=9LKqKH5peurL - links: - - membersrvc - - vp0 - command: sh -c "sleep 5; peer node start" + vp2: + extends: + file: peer-pbft.yml + service: vp_sec + hostname: vp2 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp2 + - CORE_SECURITY_ENROLLSECRET=vQelbRvja7cJ + links: + - membersrvc + - vp0 + command: sh -c "sleep 5; peer node start" + + # vp3 will be used for client interactive operations + # If you want to run fabric command on the host, then map 7051:7051 to host + # port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. + vp3: + extends: + file: peer-pbft.yml + service: vp_sec + hostname: vp3 + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp3 + - CORE_SECURITY_ENROLLSECRET=9LKqKH5peurL + links: + - membersrvc + - vp0 + command: sh -c "sleep 5; peer node start" + +#networks: +# default: +# external: +# name: fabric_pbft diff --git a/hyperledger/pbft/docker-compose.yml b/hyperledger/pbft/docker-compose.yml index 3c080949..325ff58e 100644 --- a/hyperledger/pbft/docker-compose.yml +++ b/hyperledger/pbft/docker-compose.yml @@ -5,54 +5,62 @@ # vp3: validating node as peer # https://github.com/yeasy/docker-compose-files -# validating node as the root -vp0: - extends: - file: peer-pbft.yml - service: vp - hostname: vp0 - environment: - - CORE_PEER_ID=vp0 - ports: - - "7050:7050" - #- "7051:7051" +version: '2' -# validating node -vp1: - extends: - file: peer-pbft.yml - service: vp - hostname: vp1 - environment: - - CORE_PEER_ID=vp1 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - links: - - vp0 +services: + # validating node as the root + vp0: + extends: + file: peer-pbft.yml + service: vp + hostname: vp0 + environment: + - CORE_PEER_ID=vp0 + ports: + - "7050:7050" + #- "7051:7051" -# validating node -vp2: - extends: - file: peer-pbft.yml - service: vp - hostname: vp2 - environment: - - CORE_PEER_ID=vp2 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - links: - - vp0 + # validating node + vp1: + extends: + file: peer-pbft.yml + service: vp + hostname: vp1 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + + # validating node + vp2: + extends: + file: peer-pbft.yml + service: vp + hostname: vp2 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 -# validating node -# vp3 will also be used for client interactive operations -# If you want to run fabric command on the host, then map 7051:7051 to host -# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. -vp3: - extends: - file: peer-pbft.yml - service: vp - hostname: vp3 - environment: - - CORE_PEER_ID=vp3 - - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 - links: - - vp0 + # validating node + # vp3 will also be used for client interactive operations + # If you want to run fabric command on the host, then map 7051:7051 to host + # port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr. + vp3: + extends: + file: peer-pbft.yml + service: vp + hostname: vp3 + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +#networks: +# default: +# external: +# name: fabric_pbft \ No newline at end of file diff --git a/hyperledger/pbft/peer-pbft.yml b/hyperledger/pbft/peer-pbft.yml index 3fa2dabc..cf684af2 100644 --- a/hyperledger/pbft/peer-pbft.yml +++ b/hyperledger/pbft/peer-pbft.yml @@ -7,33 +7,44 @@ # This utilized the pbft as consensus # See https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devnet-setup.md#using-consensus-plugin for more details. -vp: - image: hyperledger/fabric-peer:latest - restart: unless-stopped - environment: - - CORE_PEER_ADDRESSAUTODETECT=true - - CORE_PEER_NETWORKID=dev - - CORE_LOGGING_LEVEL=info #critical, error, warning, notice, info, debug - # The following section enables pbft consensus - - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft # noops, pbft - - CORE_PBFT_GENERAL_MODE=batch # batch. classic and sieve will be not supported again. - - CORE_PBFT_GENERAL_N=4 - - CORE_PBFT_GENERAL_BATCHSIZE=2 # only useful when in batch mode - - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=2s - expose: - - "7051" - - "7052" - - "7053" - volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT - - /var/run/docker.sock:/var/run/docker.sock - 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 +version: '2' -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 +services: + vp: + image: hyperledger/fabric-peer:latest + restart: unless-stopped + environment: + - CORE_PEER_ADDRESSAUTODETECT=true + - CORE_PEER_NETWORKID=dev + - CORE_LOGGING_LEVEL=info #critical, error, warning, notice, info, debug + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_ + # The following section enables pbft consensus + - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft # noops, pbft + - CORE_PBFT_GENERAL_MODE=batch # batch. classic and sieve will be not supported again. + - CORE_PBFT_GENERAL_N=4 + - CORE_PBFT_GENERAL_BATCHSIZE=2 # only useful when in batch mode + - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=2s + expose: + - "7050" # Rest + - "7051" # Grpc + - "7052" # Peer CLI + - "7053" # Peer Event + - "7054" # eCAP + - "7055" # eCAA + - "7056" # tCAP + - "7057" # eCAA + - "7058" # tlsCAP + - "7059" # tlsCAA + volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT + - /var/run/docker.sock:/var/run/docker.sock + 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 + + 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