From 6db52f952869435eb0cbab29d610b87d78c5a4cd Mon Sep 17 00:00:00 2001 From: Baohua Yang Date: Fri, 15 Apr 2016 16:45:57 +0800 Subject: [PATCH] Add hyperledger cluster --- README.md | 15 ++++++++++ hyperledger/compose-defaults.yml | 19 ++++++++++++ hyperledger/docker-compose.yml | 50 ++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 hyperledger/compose-defaults.yml create mode 100644 hyperledger/docker-compose.yml diff --git a/README.md b/README.md index eb149bfc..e8088adb 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,21 @@ docker-compose scale es=3 ## [haproxy_web](haproxy_web) A simple haproxy and web applications cluster. +## [hyperledger](hyperledger) +Demo the hyperledger cluster with 4 validator nodes. This refers the example + from the [hyperledger](https://github.com/hyperledger/fabric) project. + +Note, currently you should manually create an `openblockchain/baseimage:latest` first. The +easiest way to do so is: +```sh +$ docker pull yeasy/hyperledger:latest +$ docker tag yeasy/hyperledger:latest openblockchain/baseimage:latest +$ docker pull yeasy/hyperledger-peer:latest +``` + +After the cluster is synced, you can validate from the container or from the +host. See [hyperledger-peer](https://github .com/yeasy/docker-hyperledger-peer). + ## [mongo_cluster](mongo_cluster) Start 3 mongo instance to make a replica set. diff --git a/hyperledger/compose-defaults.yml b/hyperledger/compose-defaults.yml new file mode 100644 index 00000000..a6ad5a5f --- /dev/null +++ b/hyperledger/compose-defaults.yml @@ -0,0 +1,19 @@ +# This is the default base file to config env and command +# Notice that chaincode is executed inside docker in default net mode +# https://github.com/yeasy/docker-compose-files + +# validating node as a root +vp: + image: yeasy/hyperledger-peer:latest + restart: unless-stopped + environment: + - CORE_PEER_ADDRESSAUTODETECT=true + #- CORE_PEER_VALIDATOR_CONSENSUS=obcpbft + expose: + - "30303" + - "30304" + - "31315" + volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT + - /var/run/docker.sock:/var/run/docker.sock + command: fabric peer + diff --git a/hyperledger/docker-compose.yml b/hyperledger/docker-compose.yml new file mode 100644 index 00000000..df49ccd0 --- /dev/null +++ b/hyperledger/docker-compose.yml @@ -0,0 +1,50 @@ +# This compose file will 4 hyperledger peer nodes for testing +# 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 + +# validating node as the root +vp0: + extends: + file: compose-defaults.yml + service: vp + hostname: vp0 + environment: + - CORE_PEER_ID=vp0 + #- CORE_VM_ENDPOINT=tcp://172.17.42.1:2375 + +vp1: + extends: + service: vp0 + hostname: vp1 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:30303 + links: + - vp0 + +vp2: + extends: + service: vp0 + hostname: vp2 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:30303 + links: + - vp0 + +vp3: # vp3 will be used for client interactive operations + extends: + service: vp0 + container_name: vp3 + hostname: vp3 + ports: + - "5000:5000" + - "30303:30303" + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:30303 + links: + - vp0