diff --git a/hyperledger/1.0/kafka/README.md b/hyperledger/1.0/kafka/README.md index cd55aad7..3509ba7d 100644 --- a/hyperledger/1.0/kafka/README.md +++ b/hyperledger/1.0/kafka/README.md @@ -3,13 +3,22 @@ ## Start a network base on kafka ```bash -$ docker-compose -f orderer-kafka.yaml up +$ cd ~/docker-compose-files/tree/master/hyperledger/1.0/kafka +$ docker-compose -f orderer-kafka.yaml up (-d) ``` +When the fabric-network fully started, it takes about 15-20s. -### Chaincode +## Test chaincode ```bash $ docker exec -it fabric-cli bash -$ bash ./scripts/initialize.sh +$ bash ./scripts/initialize.sh # initialize the fabric network $ bash ./scripts/test_4peers.sh ``` + +>(Optional) If you want to use official images, you can run the following command first +> +> ```bash +> $ cd ~/docker-compose-files/tree/master/hyperledger/1.0 +> $ bash ./scripts/download_official_images.sh +> ``` diff --git a/hyperledger/1.0/kafka/orderer-base.yaml b/hyperledger/1.0/kafka/orderer-base.yaml index 74da487c..dad94c98 100644 --- a/hyperledger/1.0/kafka/orderer-base.yaml +++ b/hyperledger/1.0/kafka/orderer-base.yaml @@ -27,6 +27,9 @@ services: - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_KAFKA_RETRY_SHORTINTERVAL=1s + - ORDERER_KAFKA_RETRY_SHORTTOTAL=30s + - ORDERER_KAFKA_VERBOSE=true expose: - "7050" # command: orderer start diff --git a/hyperledger/1.0/kafka/orderer-kafka.yaml b/hyperledger/1.0/kafka/orderer-kafka.yaml index ce31ff33..bbe011a2 100644 --- a/hyperledger/1.0/kafka/orderer-kafka.yaml +++ b/hyperledger/1.0/kafka/orderer-kafka.yaml @@ -187,7 +187,7 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp volumes: - #- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples + - ../e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples # only need when you use official images - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ../scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts @@ -206,4 +206,4 @@ services: - peer0.org2.example.com - peer1.org2.example.com working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer - command: bash -c 'while true; do sleep 20170504; done' \ No newline at end of file + command: bash -c 'while true; do sleep 20170504; done' diff --git a/hyperledger/1.0/scripts/download_official_images.sh b/hyperledger/1.0/scripts/download_official_images.sh new file mode 100644 index 00000000..a5d334a4 --- /dev/null +++ b/hyperledger/1.0/scripts/download_official_images.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +if [ -f ./header.sh ]; then + source ./header.sh +elif [ -f scripts/header.sh ]; then + source scripts/header.sh +else + alias echo_r="echo" + alias echo_g="echo" + alias echo_b="echo" +fi + +echo_b "===Download official images from https://hub.docker.com/u/hyperledger/" + +# pull fabric images +ARCH=x86_64 +BASEIMAGE_RELEASE=0.3.1 +PROJECT_VERSION=1.0.0 +IMG_TAG=1.0.0 + +echo_b "===Pulling fabric images... with tag = ${IMG_TAG}" +docker pull hyperledger/fabric-peer:$ARCH-$IMG_TAG +docker pull hyperledger/fabric-tools:$ARCH-$IMG_TAG +docker pull hyperledger/fabric-orderer:$ARCH-$IMG_TAG +docker pull hyperledger/fabric-ca:$ARCH-$IMG_TAG +docker pull hyperledger/fabric-ccenv:$ARCH-$IMG_TAG +docker pull hyperledger/fabric-baseimage:$ARCH-$BASEIMAGE_RELEASE +docker pull hyperledger/fabric-baseos:$ARCH-$BASEIMAGE_RELEASE +docker pull hyperledger/fabric-couchdb:$ARCH-$IMG_TAG +docker pull hyperledger/fabric-kafka:$ARCH-$IMG_TAG +docker pull hyperledger/fabric-zookeeper:$ARCH-$IMG_TAG + +echo_b "===Re-tagging images to *latest* tag" +docker tag hyperledger/fabric-peer:$ARCH-$IMG_TAG hyperledger/fabric-peer +docker tag hyperledger/fabric-tools:$ARCH-$IMG_TAG hyperledger/fabric-tools +docker tag hyperledger/fabric-orderer:$ARCH-$IMG_TAG hyperledger/fabric-orderer +docker tag hyperledger/fabric-ca:$ARCH-$IMG_TAG hyperledger/fabric-ca +docker tag hyperledger/fabric-zookeeper:$ARCH-$IMG_TAG hyperledger/fabric-zookeeper +docker tag hyperledger/fabric-kafka:$ARCH-$IMG_TAG hyperledger/fabric-kafka +docker tag hyperledger/fabric-couchdb:$ARCH-$IMG_TAG hyperledger/fabric-couchdb + +echo_b "Done, now can startup the network using docker-compose..."