Use latest e2e scripts and minor update makefile
parent
5a50c84461
commit
facb83948e
|
@ -1,33 +1,64 @@
|
||||||
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
|
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
|
sleep 2
|
||||||
|
|
||||||
make start
|
make start
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
make init
|
make init
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
make test
|
make test
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
make stop
|
make stop
|
||||||
|
|
||||||
|
ready:
|
||||||
|
make start
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
make init
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
make test
|
||||||
|
echo "Now the fabric network is ready to play"
|
||||||
|
echo "run 'make cli' to enter into the fabric-cli container."
|
||||||
|
echo "run 'make stop' when done."
|
||||||
|
|
||||||
setup: # setup the environment
|
setup: # setup the environment
|
||||||
bash scripts/setup_Docker.sh # Install Docker, Docker-Compose
|
bash scripts/setup_Docker.sh # Install Docker, Docker-Compose
|
||||||
bash scripts/download_images.sh # Pull required Docker images
|
bash scripts/download_images.sh # Pull required Docker images
|
||||||
|
|
||||||
start: # bootup the fabric network
|
start: # bootup the fabric network
|
||||||
|
echo "Start a fabric network with 2-org-4-peer"
|
||||||
docker-compose -f ${COMPOSE_FILE} up -d # Start a fabric network
|
docker-compose -f ${COMPOSE_FILE} up -d # Start a fabric network
|
||||||
|
|
||||||
init: # initialize the fabric network
|
init: # initialize the fabric network
|
||||||
|
echo "Install and instantiate cc example02 on the fabric network"
|
||||||
docker exec -it fabric-cli bash ./scripts/initialize.sh
|
docker exec -it fabric-cli bash ./scripts/initialize.sh
|
||||||
|
|
||||||
test: # test chaincode
|
test: # test chaincode
|
||||||
|
echo "Invoke and query cc example02"
|
||||||
docker exec -it fabric-cli bash ./scripts/test_4peers.sh
|
docker exec -it fabric-cli bash ./scripts/test_4peers.sh
|
||||||
|
|
||||||
|
qscc: # test qscc quries
|
||||||
|
docker exec -it fabric-cli bash ./scripts/test_qscc.sh
|
||||||
|
|
||||||
stop: # stop the fabric network
|
stop: # stop the fabric network
|
||||||
|
echo "Stop the fabric network"
|
||||||
docker-compose -f ${COMPOSE_FILE} down # Stop a fabric network
|
docker-compose -f ${COMPOSE_FILE} down # Stop a fabric network
|
||||||
|
|
||||||
clean: # clean up environment
|
clean: # clean up environment
|
||||||
|
echo "Clean all images and containers"
|
||||||
bash scripts/clean_env.sh
|
bash scripts/clean_env.sh
|
||||||
|
|
||||||
|
cli: # enter the cli container
|
||||||
|
docker exec -it fabric-cli bash
|
||||||
|
|
||||||
show: # show existing docker images
|
ps: # show existing docker images
|
||||||
docker ps -qa
|
docker ps -a
|
||||||
|
|
||||||
|
logs: # show logs
|
||||||
|
docker-compose logs -f --tail 200
|
||||||
|
|
|
@ -10,14 +10,22 @@ If you're not familiar with Docker and Blockchain technology yet, feel free to h
|
||||||
|
|
||||||
## Pass-through
|
## Pass-through
|
||||||
|
|
||||||
The following command will run the entire process pass-through.
|
The following command will run the entire process (start a fabric network, create channel, test chaincode and stop it.) pass-through.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ make
|
$ make setup # install docker/compose, and pull required images
|
||||||
|
$ make all
|
||||||
```
|
```
|
||||||
|
|
||||||
tldr :)
|
tldr :)
|
||||||
|
|
||||||
|
`make all` actually call following command sequentially.
|
||||||
|
|
||||||
|
* `make start`
|
||||||
|
* `make init`
|
||||||
|
* `make test`
|
||||||
|
* `make stop`
|
||||||
|
|
||||||
Otherwise, if u wanna know more or run the command manually, then go on reading the following part.
|
Otherwise, if u wanna know more or run the command manually, then go on reading the following part.
|
||||||
|
|
||||||
## Environment Setup
|
## Environment Setup
|
||||||
|
@ -42,7 +50,7 @@ The script actually uses docker-compose to boot up the fabric network with sever
|
||||||
There will be 7 running containers, include 4 peers, 1 cli, 1 ca and 1 orderer.
|
There will be 7 running containers, include 4 peers, 1 cli, 1 ca and 1 orderer.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make show
|
$ make ps
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
1dc3f2557bdc hyperledger/fabric-tools "bash -c 'while tr..." 25 minutes ago Up 25 minutes fabric-cli
|
1dc3f2557bdc hyperledger/fabric-tools "bash -c 'while tr..." 25 minutes ago Up 25 minutes fabric-cli
|
||||||
5e5f37a0ed3c hyperledger/fabric-peer "peer node start" 25 minutes ago Up 25 minutes 7050/tcp, 7054-7059/tcp, 0.0.0.0:8051->7051/tcp, 0.0.0.0:8052->7052/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
|
5e5f37a0ed3c hyperledger/fabric-peer "peer node start" 25 minutes ago Up 25 minutes 7050/tcp, 7054-7059/tcp, 0.0.0.0:8051->7051/tcp, 0.0.0.0:8052->7052/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
|
||||||
|
@ -61,9 +69,9 @@ $ make init # Start a fabric network
|
||||||
|
|
||||||
The command actually calls the `./scripts/initialize.sh` script in the `fabric-cli` container to:
|
The command actually calls the `./scripts/initialize.sh` script in the `fabric-cli` container to:
|
||||||
|
|
||||||
* create a new application channel
|
* create a new application channel `businesschannel`
|
||||||
* join all peers into the channel
|
* join all peers into the channel
|
||||||
* install and instantiate chaincodes for testing
|
* install and instantiate chaincode `example02` for testing
|
||||||
|
|
||||||
This script only needs to be executed once.
|
This script only needs to be executed once.
|
||||||
|
|
||||||
|
@ -85,7 +93,7 @@ Creating channel...
|
||||||
And there will be new chaincode container generated in the system, looks like
|
And there will be new chaincode container generated in the system, looks like
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make show
|
$ make ps
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
9971c9fd1971 dev-peer1.org2.example.com-mycc-1.0 "chaincode -peer.a..." 54 seconds ago Up 53 seconds dev-peer1.org2.example.com-mycc-1.0
|
9971c9fd1971 dev-peer1.org2.example.com-mycc-1.0 "chaincode -peer.a..." 54 seconds ago Up 53 seconds dev-peer1.org2.example.com-mycc-1.0
|
||||||
e3092961b81b dev-peer1.org1.example.com-mycc-1.0 "chaincode -peer.a..." About a minute ago Up About a minute dev-peer1.org1.example.com-mycc-1.0
|
e3092961b81b dev-peer1.org1.example.com-mycc-1.0 "chaincode -peer.a..." About a minute ago Up About a minute dev-peer1.org1.example.com-mycc-1.0
|
||||||
|
@ -97,7 +105,7 @@ c9974dbc21d9 dev-peer0.org1.example.com-mycc-1.0 "chaincode -peer.a..."
|
||||||
## Test Chaincode
|
## Test Chaincode
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make test # test with chaincode
|
$ make test # test invoke and query with chaincode
|
||||||
```
|
```
|
||||||
|
|
||||||
More details, see [chaincode test](docs/chaincode_test.md).
|
More details, see [chaincode test](docs/chaincode_test.md).
|
||||||
|
@ -117,7 +125,6 @@ Clean all related containers and images.
|
||||||
$ make clean # clean the environment
|
$ make clean # clean the environment
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## More to learn
|
## More to learn
|
||||||
|
|
||||||
Topics | Description
|
Topics | Description
|
||||||
|
|
|
@ -46,6 +46,7 @@ services:
|
||||||
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
||||||
- 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_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
|
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||||
|
- CHANNEL_NAME=businesschannel
|
||||||
volumes:
|
volumes:
|
||||||
#- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
#- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
||||||
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
|
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
|
||||||
|
|
|
@ -57,6 +57,7 @@ services:
|
||||||
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
||||||
- 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_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
|
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||||
|
- CHANNEL_NAME=businesschannel
|
||||||
volumes:
|
volumes:
|
||||||
#- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
#- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
||||||
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
|
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
|
||||||
|
|
|
@ -58,6 +58,7 @@ services:
|
||||||
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
||||||
- 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_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
|
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||||
|
- CHANNEL_NAME=businesschannel
|
||||||
volumes:
|
volumes:
|
||||||
- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
||||||
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
|
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
|
||||||
|
|
|
@ -63,6 +63,7 @@ services:
|
||||||
- CORE_PEER_ID=cli
|
- CORE_PEER_ID=cli
|
||||||
- CORE_PEER_ADDRESS=peer0:7051
|
- CORE_PEER_ADDRESS=peer0:7051
|
||||||
#- CORE_PEER_LOCALMSPID=Org0MSP
|
#- CORE_PEER_LOCALMSPID=Org0MSP
|
||||||
|
- CHANNEL_NAME=businesschannel
|
||||||
links:
|
links:
|
||||||
- peer0
|
- peer0
|
||||||
- orderer0
|
- orderer0
|
||||||
|
|
|
@ -101,7 +101,7 @@ Orderer: &OrdererDefaults
|
||||||
|
|
||||||
# Orderer Type: The orderer implementation to start
|
# Orderer Type: The orderer implementation to start
|
||||||
# Available types are "solo" and "kafka"
|
# Available types are "solo" and "kafka"
|
||||||
OrdererType: solo
|
OrdererType: kafka
|
||||||
|
|
||||||
Addresses:
|
Addresses:
|
||||||
- orderer.example.com:7050
|
- orderer.example.com:7050
|
||||||
|
@ -132,6 +132,7 @@ Orderer: &OrdererDefaults
|
||||||
- kafka0:9092
|
- kafka0:9092
|
||||||
- kafka1:9092
|
- kafka1:9092
|
||||||
- kafka2:9092
|
- kafka2:9092
|
||||||
|
- kafka3:9092
|
||||||
|
|
||||||
# Organizations is the list of orgs which are defined as participants on
|
# Organizations is the list of orgs which are defined as participants on
|
||||||
# the orderer side of the network
|
# the orderer side of the network
|
||||||
|
|
|
@ -6,12 +6,106 @@
|
||||||
version: '2'
|
version: '2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
zookeeper0:
|
||||||
|
container_name: zookeeper0
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=1
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
zookeeper1:
|
||||||
|
container_name: zookeeper1
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=2
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
zookeeper2:
|
||||||
|
container_name: zookeeper2
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=3
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
kafka0:
|
||||||
|
container_name: kafka0
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=0
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka1:
|
||||||
|
container_name: kafka1
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=1
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka2:
|
||||||
|
container_name: kafka2
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=2
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka3:
|
||||||
|
container_name: kafka3
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=3
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
orderer.example.com:
|
orderer.example.com:
|
||||||
extends:
|
extends:
|
||||||
file: base/docker-compose-base.yaml
|
file: base/docker-compose-base.yaml
|
||||||
service: orderer.example.com
|
service: orderer.example.com
|
||||||
container_name: orderer.example.com
|
container_name: orderer.example.com
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
- kafka0
|
||||||
|
- kafka1
|
||||||
|
- kafka2
|
||||||
|
- kafka3
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
container_name: peer0.org1.example.com
|
container_name: peer0.org1.example.com
|
||||||
|
|
|
@ -36,11 +36,103 @@ services:
|
||||||
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
||||||
container_name: ca_peerOrg2
|
container_name: ca_peerOrg2
|
||||||
|
|
||||||
|
zookeeper0:
|
||||||
|
container_name: zookeeper0
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=1
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
zookeeper1:
|
||||||
|
container_name: zookeeper1
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=2
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
zookeeper2:
|
||||||
|
container_name: zookeeper2
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=3
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
kafka0:
|
||||||
|
container_name: kafka0
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=0
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka1:
|
||||||
|
container_name: kafka1
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=1
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka2:
|
||||||
|
container_name: kafka2
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=2
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka3:
|
||||||
|
container_name: kafka3
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=3
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
orderer.example.com:
|
orderer.example.com:
|
||||||
extends:
|
extends:
|
||||||
file: base/docker-compose-base.yaml
|
file: base/docker-compose-base.yaml
|
||||||
service: orderer.example.com
|
service: orderer.example.com
|
||||||
container_name: orderer.example.com
|
container_name: orderer.example.com
|
||||||
|
depends_on:
|
||||||
|
- kafka0
|
||||||
|
- kafka1
|
||||||
|
- kafka2
|
||||||
|
- kafka3
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
container_name: peer0.org1.example.com
|
container_name: peer0.org1.example.com
|
||||||
|
|
|
@ -36,11 +36,103 @@ services:
|
||||||
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
||||||
container_name: ca_peerOrg2
|
container_name: ca_peerOrg2
|
||||||
|
|
||||||
|
zookeeper0:
|
||||||
|
container_name: zookeeper0
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=1
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
zookeeper1:
|
||||||
|
container_name: zookeeper1
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=2
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
zookeeper2:
|
||||||
|
container_name: zookeeper2
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: zookeeper
|
||||||
|
environment:
|
||||||
|
- ZOO_MY_ID=3
|
||||||
|
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
||||||
|
|
||||||
|
kafka0:
|
||||||
|
container_name: kafka0
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=0
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka1:
|
||||||
|
container_name: kafka1
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=1
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka2:
|
||||||
|
container_name: kafka2
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=2
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
|
kafka3:
|
||||||
|
container_name: kafka3
|
||||||
|
extends:
|
||||||
|
file: base/docker-compose-base.yaml
|
||||||
|
service: kafka
|
||||||
|
environment:
|
||||||
|
- KAFKA_BROKER_ID=3
|
||||||
|
- KAFKA_MIN_INSYNC_REPLICAS=2
|
||||||
|
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
||||||
|
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
||||||
|
depends_on:
|
||||||
|
- zookeeper0
|
||||||
|
- zookeeper1
|
||||||
|
- zookeeper2
|
||||||
|
|
||||||
orderer.example.com:
|
orderer.example.com:
|
||||||
extends:
|
extends:
|
||||||
file: base/docker-compose-base.yaml
|
file: base/docker-compose-base.yaml
|
||||||
service: orderer.example.com
|
service: orderer.example.com
|
||||||
container_name: orderer.example.com
|
container_name: orderer.example.com
|
||||||
|
depends_on:
|
||||||
|
- kafka0
|
||||||
|
- kafka1
|
||||||
|
- kafka2
|
||||||
|
- kafka3
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
container_name: peer0.org1.example.com
|
container_name: peer0.org1.example.com
|
||||||
|
|
|
@ -2,7 +2,7 @@ End-to-End Flow
|
||||||
===============
|
===============
|
||||||
|
|
||||||
The end-to-end verification provisions a sample Fabric network consisting of
|
The end-to-end verification provisions a sample Fabric network consisting of
|
||||||
two organizations, each maintaining two peers, and a “solo” ordering service.
|
two organizations, each maintaining two peers, and a Kafka-based ordering service.
|
||||||
|
|
||||||
This verification makes use of two fundamental tools, which are necessary to
|
This verification makes use of two fundamental tools, which are necessary to
|
||||||
create a functioning transactional network with digital signature validation
|
create a functioning transactional network with digital signature validation
|
||||||
|
@ -910,4 +910,3 @@ back and recreate your channel artifacts.
|
||||||
|
|
||||||
.. Licensed under Creative Commons Attribution 4.0 International License
|
.. Licensed under Creative Commons Attribution 4.0 International License
|
||||||
https://creativecommons.org/licenses/by/4.0/
|
https://creativecommons.org/licenses/by/4.0/
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ echo "|____/ |_| /_/ \_\ |_| \_\ |_| |_____| |_____| |_____|"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
CHANNEL_NAME="$1"
|
CHANNEL_NAME="$1"
|
||||||
: ${CHANNEL_NAME:="businesschannel"}
|
: ${CHANNEL_NAME:="mychannel"}
|
||||||
: ${TIMEOUT:="60"}
|
: ${TIMEOUT:="60"}
|
||||||
COUNTER=1
|
COUNTER=1
|
||||||
MAX_RETRY=5
|
MAX_RETRY=5
|
||||||
|
@ -54,9 +54,37 @@ setGlobals () {
|
||||||
env |grep CORE
|
env |grep CORE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkOSNAvailability() {
|
||||||
|
#Use orderer's MSP for fetching system channel config block
|
||||||
|
CORE_PEER_LOCALMSPID="OrdererMSP"
|
||||||
|
CORE_PEER_TLS_ROOTCERT_FILE=$ORDERER_CA
|
||||||
|
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp
|
||||||
|
|
||||||
|
local rc=1
|
||||||
|
local starttime=$(date +%s)
|
||||||
|
|
||||||
|
# continue to poll
|
||||||
|
# we either get a successful response, or reach TIMEOUT
|
||||||
|
while test "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0
|
||||||
|
do
|
||||||
|
sleep 3
|
||||||
|
echo "Attempting to fetch system channel 'testchainid' ...$(($(date +%s)-starttime)) secs"
|
||||||
|
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
||||||
|
peer channel fetch 0 -o orderer.example.com:7050 -c "testchainid" >&log.txt
|
||||||
|
else
|
||||||
|
peer channel fetch 0 -o orderer.example.com:7050 -c "testchainid" --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt
|
||||||
|
fi
|
||||||
|
test $? -eq 0 && VALUE=$(cat log.txt | awk '/Received block/ {print $NF}')
|
||||||
|
test "$VALUE" = "0" && let rc=0
|
||||||
|
done
|
||||||
|
cat log.txt
|
||||||
|
verifyResult $rc "Ordering Service is not available, Please try again ..."
|
||||||
|
echo "===================== Ordering Service is up and running ===================== "
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
createChannel() {
|
createChannel() {
|
||||||
setGlobals 0
|
setGlobals 0
|
||||||
|
|
||||||
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
||||||
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx >&log.txt
|
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx >&log.txt
|
||||||
else
|
else
|
||||||
|
@ -186,6 +214,10 @@ chaincodeInvoke () {
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Check for orderering service availablility
|
||||||
|
echo "Check orderering service availability..."
|
||||||
|
checkOSNAvailability
|
||||||
|
|
||||||
## Create channel
|
## Create channel
|
||||||
echo "Creating channel..."
|
echo "Creating channel..."
|
||||||
createChannel
|
createChannel
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script will run some qscc queries for testing.
|
||||||
|
|
||||||
|
# Detecting whether can import the header file to render colorful cli output
|
||||||
|
# Need add choice option
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
#CHANNEL_NAME="$1"
|
||||||
|
#: ${CHANNEL_NAME:="businesschannel"}
|
||||||
|
|
||||||
|
echo_b "Lscc"
|
||||||
|
|
||||||
|
peer chaincode query -C "" -n qscc -c '{"Args":["GetChainInfo","businesschannel"]}'
|
||||||
|
|
||||||
|
peer chaincode query -C "" -n qscc -c '{"Args":["GetBlockByNumber","businesschannel","5"]}'
|
||||||
|
|
||||||
|
echo_g "Lscc testing done!"
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script will run some qscc queries for testing.
|
||||||
|
|
||||||
|
# Detecting whether can import the header file to render colorful cli output
|
||||||
|
# Need add choice option
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
#CHANNEL_NAME="$1"
|
||||||
|
#: ${CHANNEL_NAME:="businesschannel"}
|
||||||
|
|
||||||
|
echo_b "Qscc GetChainInfo"
|
||||||
|
|
||||||
|
peer chaincode query -C "" -n qscc -c '{"Args":["GetChainInfo","businesschannel"]}'
|
||||||
|
|
||||||
|
peer chaincode query -C "" -n qscc -c '{"Args":["GetBlockByNumber","businesschannel","5"]}'
|
||||||
|
|
||||||
|
echo_g "Qscc testing done!"
|
Loading…
Reference in New Issue