Support couchdb now
parent
2c2ac23684
commit
ce816e0a4b
|
@ -1,52 +1,19 @@
|
||||||
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
|
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
|
||||||
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
|
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
|
||||||
|
COMPOSE_COUCHDB_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
@echo "Restarting network..."
|
make ready
|
||||||
make restart
|
make lscc qscc
|
||||||
|
|
||||||
make init
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
make test_cc
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make lscc
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make qscc
|
|
||||||
|
|
||||||
make stop
|
make stop
|
||||||
|
|
||||||
dev:
|
|
||||||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
@echo "Restarting dev network..."
|
|
||||||
make dev_restart
|
|
||||||
|
|
||||||
make dev_init
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
make test_peer0
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make lscc
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make qscc
|
|
||||||
|
|
||||||
make dev_stop
|
|
||||||
|
|
||||||
ready:
|
ready:
|
||||||
make stop
|
@echo "Restart and init network..."
|
||||||
make start
|
make restart init
|
||||||
sleep 2
|
|
||||||
|
|
||||||
make init
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
make test_cc
|
make test_cc
|
||||||
|
@ -54,10 +21,6 @@ ready:
|
||||||
@echo "run 'make cli' to enter into the fabric-cli container."
|
@echo "run 'make cli' to enter into the fabric-cli container."
|
||||||
@echo "run 'make stop' when done."
|
@echo "run 'make stop' when done."
|
||||||
|
|
||||||
setup: # setup the environment
|
|
||||||
bash scripts/setup_Docker.sh # Install Docker, Docker-Compose
|
|
||||||
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"
|
@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
|
||||||
|
@ -66,19 +29,6 @@ init: # initialize the fabric network
|
||||||
@echo "Install and instantiate cc example02 on the fabric network"
|
@echo "Install and instantiate cc example02 on the fabric network"
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
|
||||||
|
|
||||||
test_cc: # test chaincode
|
|
||||||
@echo "Invoke and query cc example02 on all peers"
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_all.sh"
|
|
||||||
|
|
||||||
test_peer0: # test single peer
|
|
||||||
@echo "Invoke and query cc example02 on single peer0"
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_peer0.sh"
|
|
||||||
|
|
||||||
qscc: # test qscc quries
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_qscc.sh"
|
|
||||||
|
|
||||||
lscc: # test lscc quries
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
|
|
||||||
|
|
||||||
stop: # stop the fabric network
|
stop: # stop the fabric network
|
||||||
@echo "Stop the fabric network"
|
@echo "Stop the fabric network"
|
||||||
|
@ -86,18 +36,19 @@ stop: # stop the fabric network
|
||||||
|
|
||||||
restart: stop start
|
restart: stop start
|
||||||
|
|
||||||
clean: # clean up environment
|
################## Dev testing ################
|
||||||
@echo "Clean all images and containers"
|
dev:
|
||||||
bash scripts/clean_env.sh
|
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
|
sleep 2
|
||||||
|
|
||||||
cli: # enter the cli container
|
@echo "Restart and init dev network..."
|
||||||
docker exec -it fabric-cli bash
|
make dev_restart dev_init
|
||||||
|
sleep 2
|
||||||
|
|
||||||
ps: # show existing docker images
|
make test_peer0
|
||||||
docker ps -a
|
make lscc qscc
|
||||||
|
|
||||||
logs: # show logs
|
make dev_stop
|
||||||
docker-compose -f ${COMPOSE_FILE} logs -f --tail 200
|
|
||||||
|
|
||||||
dev_start: # start fabric network for dev
|
dev_start: # start fabric network for dev
|
||||||
@echo "Start a fabric network with 1 peer for dev"
|
@echo "Start a fabric network with 1 peer for dev"
|
||||||
|
@ -113,3 +64,72 @@ dev_stop: # stop the fabric network for dev
|
||||||
|
|
||||||
dev_restart: dev_stop dev_start
|
dev_restart: dev_stop dev_start
|
||||||
|
|
||||||
|
################## Couchdb testing ################
|
||||||
|
couch:
|
||||||
|
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
make couch_ready
|
||||||
|
|
||||||
|
make lscc qscc
|
||||||
|
|
||||||
|
make dev_stop
|
||||||
|
|
||||||
|
couch_ready:
|
||||||
|
@echo "Restart and init network with couchdb..."
|
||||||
|
make couch_restart couch_init
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
make test_cc
|
||||||
|
@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."
|
||||||
|
|
||||||
|
couch_start: # start fabric network with couchdb
|
||||||
|
@echo "Start a fabric network with couchdb"
|
||||||
|
docker-compose -f ${COMPOSE_COUCHDB_FILE} up -d
|
||||||
|
|
||||||
|
couch_init: # initialize the fabric network
|
||||||
|
@echo "Install and instantiate cc example02 on the fabric dev network"
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
|
||||||
|
|
||||||
|
couch_stop: # stop the fabric network with couchdb
|
||||||
|
@echo "Stop the fabric network with 1 peer with couchdb"
|
||||||
|
docker-compose -f ${COMPOSE_COUCHDB_FILE} down
|
||||||
|
|
||||||
|
couch_restart: couch_stop couch_start
|
||||||
|
|
||||||
|
################## Chaincode testing operations ################
|
||||||
|
test_cc: # test user chaincode on all peers
|
||||||
|
@echo "Invoke and query cc example02 on all peers"
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_all.sh"
|
||||||
|
|
||||||
|
test_peer0: # test single peer
|
||||||
|
@echo "Invoke and query cc example02 on single peer0"
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_peer0.sh"
|
||||||
|
|
||||||
|
qscc: # test qscc quries
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_qscc.sh"
|
||||||
|
|
||||||
|
lscc: # test lscc quries
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
|
||||||
|
|
||||||
|
################## Env setup related, no need to see usually ################
|
||||||
|
|
||||||
|
setup: # setup the environment
|
||||||
|
bash scripts/setup_Docker.sh # Install Docker, Docker-Compose
|
||||||
|
bash scripts/download_images.sh # Pull required Docker images
|
||||||
|
|
||||||
|
clean: # clean up environment
|
||||||
|
@echo "Clean all images and containers"
|
||||||
|
bash scripts/clean_env.sh
|
||||||
|
|
||||||
|
cli: # enter the cli container
|
||||||
|
docker exec -it fabric-cli bash
|
||||||
|
|
||||||
|
ps: # show existing docker images
|
||||||
|
docker ps -a
|
||||||
|
|
||||||
|
logs: # show logs
|
||||||
|
docker-compose -f ${COMPOSE_FILE} logs -f --tail 200
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,6 @@ services:
|
||||||
|
|
||||||
couchdb-base:
|
couchdb-base:
|
||||||
#container_name: couchdb0
|
#container_name: couchdb0
|
||||||
image: hyperledger/fabric-couchdb:x86-64-1.0.1
|
image: hyperledger/fabric-couchdb:x86_64-1.0.1
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
|
|
@ -1,63 +1,107 @@
|
||||||
|
# github.com/yeasy/docker-compose-files
|
||||||
|
# fabric network with couchdb as the peer state db.
|
||||||
|
# including:
|
||||||
|
# orderer.example.com: orderer node
|
||||||
|
# peer0.org1.example.com: peer0 node
|
||||||
|
# peer1.org1.example.com: peer1 node
|
||||||
|
# peer0.org2.example.com: peer2 node
|
||||||
|
# peer1.org2.example.com: peer3 node
|
||||||
|
# couchdb0: couchdb node
|
||||||
|
# couchdb1: couchdb node
|
||||||
|
# couchdb2: couchdb node
|
||||||
|
# couchdb3: couchdb node
|
||||||
|
# cli: cli node
|
||||||
|
|
||||||
version: '2'
|
version: '2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
couchdb0:
|
orderer.example.com:
|
||||||
container_name: couchdb0
|
extends:
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
file: docker-compose-base.yaml
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
service: orderer.example.com
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "5984:5984"
|
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer0.org1.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb0
|
- couchdb0
|
||||||
|
|
||||||
couchdb1:
|
|
||||||
container_name: couchdb1
|
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "6984:5984"
|
|
||||||
|
|
||||||
peer1.org1.example.com:
|
peer1.org1.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer1.org1.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb1
|
- couchdb1
|
||||||
|
|
||||||
couchdb2:
|
|
||||||
container_name: couchdb2
|
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "7984:5984"
|
|
||||||
|
|
||||||
peer0.org2.example.com:
|
peer0.org2.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer0.org2.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb2
|
- couchdb2
|
||||||
|
|
||||||
couchdb3:
|
|
||||||
container_name: couchdb3
|
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "8984:5984"
|
|
||||||
|
|
||||||
peer1.org2.example.com:
|
peer1.org2.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer1.org2.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb3
|
- couchdb3
|
||||||
|
|
||||||
|
couchdb0:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb0
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "5984:5984" # this is the restful API addr, can also access fauxton web ui thru http://localhost:5984/_utils/
|
||||||
|
|
||||||
|
couchdb1:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb1
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "6984:5984"
|
||||||
|
|
||||||
|
couchdb2:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb2
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "7984:5984"
|
||||||
|
|
||||||
|
couchdb3:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb3
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "8984:5984"
|
||||||
|
|
||||||
|
cli:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: cli
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
|
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
|
||||||
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
|
# This compose file will start a Hyperledger Fabric 1.0.1 MVE, including
|
||||||
# * 1 ca
|
# * 2 ca (not in use now)
|
||||||
# * 1 orderer
|
# * 1 orderer
|
||||||
# * 4 peers in 2 orgs
|
# * 4 peers in 2 orgs
|
||||||
# * cli for testing
|
# * cli for testing
|
||||||
|
@ -29,7 +29,6 @@ services:
|
||||||
service: orderer.example.com
|
service: orderer.example.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base.yaml
|
file: docker-compose-base.yaml
|
||||||
|
|
|
@ -23,7 +23,6 @@ createChannel
|
||||||
echo_b "Having all peers join the channel..."
|
echo_b "Having all peers join the channel..."
|
||||||
joinChannel 0
|
joinChannel 0
|
||||||
|
|
||||||
|
|
||||||
## Set the anchor peers for each org in the channel
|
## Set the anchor peers for each org in the channel
|
||||||
echo_b "Updating anchor peers for peer0/org1..."
|
echo_b "Updating anchor peers for peer0/org1..."
|
||||||
updateAnchorPeers 0
|
updateAnchorPeers 0
|
||||||
|
@ -37,7 +36,6 @@ installChaincode 0
|
||||||
echo_b "Instantiating chaincode on the channel..."
|
echo_b "Instantiating chaincode on the channel..."
|
||||||
instantiateChaincode 0
|
instantiateChaincode 0
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo_g "===================== All GOOD, initialization completed ===================== "
|
echo_g "===================== All GOOD, initialization completed ===================== "
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -9,7 +9,6 @@ fi
|
||||||
|
|
||||||
echo_b "Channel name : "$CHANNEL_NAME
|
echo_b "Channel name : "$CHANNEL_NAME
|
||||||
|
|
||||||
|
|
||||||
echo_b "====================Query the existing value of a===================================="
|
echo_b "====================Query the existing value of a===================================="
|
||||||
chaincodeQuery 0 100
|
chaincodeQuery 0 100
|
||||||
|
|
||||||
|
|
|
@ -1,52 +1,19 @@
|
||||||
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
|
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
|
||||||
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
|
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
|
||||||
|
COMPOSE_COUCHDB_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
@echo "Restarting network..."
|
make ready
|
||||||
make restart
|
make lscc qscc
|
||||||
|
|
||||||
make init
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
make test_cc
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make lscc
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make qscc
|
|
||||||
|
|
||||||
make stop
|
make stop
|
||||||
|
|
||||||
dev:
|
|
||||||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
@echo "Restarting dev network..."
|
|
||||||
make dev_restart
|
|
||||||
|
|
||||||
make dev_init
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
make test_peer0
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make lscc
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
make qscc
|
|
||||||
|
|
||||||
make dev_stop
|
|
||||||
|
|
||||||
ready:
|
ready:
|
||||||
make stop
|
@echo "Restart and init network..."
|
||||||
make start
|
make restart init
|
||||||
sleep 2
|
|
||||||
|
|
||||||
make init
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
make test_cc
|
make test_cc
|
||||||
|
@ -54,10 +21,6 @@ ready:
|
||||||
@echo "run 'make cli' to enter into the fabric-cli container."
|
@echo "run 'make cli' to enter into the fabric-cli container."
|
||||||
@echo "run 'make stop' when done."
|
@echo "run 'make stop' when done."
|
||||||
|
|
||||||
setup: # setup the environment
|
|
||||||
bash scripts/setup_Docker.sh # Install Docker, Docker-Compose
|
|
||||||
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"
|
@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
|
||||||
|
@ -66,19 +29,6 @@ init: # initialize the fabric network
|
||||||
@echo "Install and instantiate cc example02 on the fabric network"
|
@echo "Install and instantiate cc example02 on the fabric network"
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
|
||||||
|
|
||||||
test_cc: # test chaincode
|
|
||||||
@echo "Invoke and query cc example02 on all peers"
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_all.sh"
|
|
||||||
|
|
||||||
test_peer0: # test single peer
|
|
||||||
@echo "Invoke and query cc example02 on single peer0"
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_peer0.sh"
|
|
||||||
|
|
||||||
qscc: # test qscc quries
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_qscc.sh"
|
|
||||||
|
|
||||||
lscc: # test lscc quries
|
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
|
|
||||||
|
|
||||||
stop: # stop the fabric network
|
stop: # stop the fabric network
|
||||||
@echo "Stop the fabric network"
|
@echo "Stop the fabric network"
|
||||||
|
@ -86,18 +36,19 @@ stop: # stop the fabric network
|
||||||
|
|
||||||
restart: stop start
|
restart: stop start
|
||||||
|
|
||||||
clean: # clean up environment
|
################## Dev testing ################
|
||||||
@echo "Clean all images and containers"
|
dev:
|
||||||
bash scripts/clean_env.sh
|
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
|
sleep 2
|
||||||
|
|
||||||
cli: # enter the cli container
|
@echo "Restart and init dev network..."
|
||||||
docker exec -it fabric-cli bash
|
make dev_restart dev_init
|
||||||
|
sleep 2
|
||||||
|
|
||||||
ps: # show existing docker images
|
make test_peer0
|
||||||
docker ps -a
|
make lscc qscc
|
||||||
|
|
||||||
logs: # show logs
|
make dev_stop
|
||||||
docker-compose -f ${COMPOSE_FILE} logs -f --tail 200
|
|
||||||
|
|
||||||
dev_start: # start fabric network for dev
|
dev_start: # start fabric network for dev
|
||||||
@echo "Start a fabric network with 1 peer for dev"
|
@echo "Start a fabric network with 1 peer for dev"
|
||||||
|
@ -113,3 +64,72 @@ dev_stop: # stop the fabric network for dev
|
||||||
|
|
||||||
dev_restart: dev_stop dev_start
|
dev_restart: dev_stop dev_start
|
||||||
|
|
||||||
|
################## Couchdb testing ################
|
||||||
|
couch:
|
||||||
|
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
make couch_ready
|
||||||
|
|
||||||
|
make lscc qscc
|
||||||
|
|
||||||
|
make dev_stop
|
||||||
|
|
||||||
|
couch_ready:
|
||||||
|
@echo "Restart and init network with couchdb..."
|
||||||
|
make couch_restart couch_init
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
make test_cc
|
||||||
|
@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."
|
||||||
|
|
||||||
|
couch_start: # start fabric network with couchdb
|
||||||
|
@echo "Start a fabric network with couchdb"
|
||||||
|
docker-compose -f ${COMPOSE_COUCHDB_FILE} up -d
|
||||||
|
|
||||||
|
couch_init: # initialize the fabric network
|
||||||
|
@echo "Install and instantiate cc example02 on the fabric dev network"
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
|
||||||
|
|
||||||
|
couch_stop: # stop the fabric network with couchdb
|
||||||
|
@echo "Stop the fabric network with 1 peer with couchdb"
|
||||||
|
docker-compose -f ${COMPOSE_COUCHDB_FILE} down
|
||||||
|
|
||||||
|
couch_restart: couch_stop couch_start
|
||||||
|
|
||||||
|
################## Chaincode testing operations ################
|
||||||
|
test_cc: # test user chaincode on all peers
|
||||||
|
@echo "Invoke and query cc example02 on all peers"
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_all.sh"
|
||||||
|
|
||||||
|
test_peer0: # test single peer
|
||||||
|
@echo "Invoke and query cc example02 on single peer0"
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_peer0.sh"
|
||||||
|
|
||||||
|
qscc: # test qscc quries
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_qscc.sh"
|
||||||
|
|
||||||
|
lscc: # test lscc quries
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
|
||||||
|
|
||||||
|
################## Env setup related, no need to see usually ################
|
||||||
|
|
||||||
|
setup: # setup the environment
|
||||||
|
bash scripts/setup_Docker.sh # Install Docker, Docker-Compose
|
||||||
|
bash scripts/download_images.sh # Pull required Docker images
|
||||||
|
|
||||||
|
clean: # clean up environment
|
||||||
|
@echo "Clean all images and containers"
|
||||||
|
bash scripts/clean_env.sh
|
||||||
|
|
||||||
|
cli: # enter the cli container
|
||||||
|
docker exec -it fabric-cli bash
|
||||||
|
|
||||||
|
ps: # show existing docker images
|
||||||
|
docker ps -a
|
||||||
|
|
||||||
|
logs: # show logs
|
||||||
|
docker-compose -f ${COMPOSE_FILE} logs -f --tail 200
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,6 @@ services:
|
||||||
|
|
||||||
couchdb-base:
|
couchdb-base:
|
||||||
#container_name: couchdb0
|
#container_name: couchdb0
|
||||||
image: hyperledger/fabric-couchdb:x86-64-1.0.0
|
image: hyperledger/fabric-couchdb:x86_64-1.0.0
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
|
|
@ -1,63 +1,107 @@
|
||||||
|
# github.com/yeasy/docker-compose-files
|
||||||
|
# fabric network with couchdb as the peer state db.
|
||||||
|
# including:
|
||||||
|
# orderer.example.com: orderer node
|
||||||
|
# peer0.org1.example.com: peer0 node
|
||||||
|
# peer1.org1.example.com: peer1 node
|
||||||
|
# peer0.org2.example.com: peer2 node
|
||||||
|
# peer1.org2.example.com: peer3 node
|
||||||
|
# couchdb0: couchdb node
|
||||||
|
# couchdb1: couchdb node
|
||||||
|
# couchdb2: couchdb node
|
||||||
|
# couchdb3: couchdb node
|
||||||
|
# cli: cli node
|
||||||
|
|
||||||
version: '2'
|
version: '2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
couchdb0:
|
orderer.example.com:
|
||||||
container_name: couchdb0
|
extends:
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
file: docker-compose-base.yaml
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
service: orderer.example.com
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "5984:5984"
|
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer0.org1.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb0
|
- couchdb0
|
||||||
|
|
||||||
couchdb1:
|
|
||||||
container_name: couchdb1
|
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "6984:5984"
|
|
||||||
|
|
||||||
peer1.org1.example.com:
|
peer1.org1.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer1.org1.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb1
|
- couchdb1
|
||||||
|
|
||||||
couchdb2:
|
|
||||||
container_name: couchdb2
|
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "7984:5984"
|
|
||||||
|
|
||||||
peer0.org2.example.com:
|
peer0.org2.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer0.org2.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb2
|
- couchdb2
|
||||||
|
|
||||||
couchdb3:
|
|
||||||
container_name: couchdb3
|
|
||||||
image: hyperledger/fabric-couchdb:x86_64-1.0.0-beta
|
|
||||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
|
||||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
||||||
ports:
|
|
||||||
- "8984:5984"
|
|
||||||
|
|
||||||
peer1.org2.example.com:
|
peer1.org2.example.com:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: peer1.org2.example.com
|
||||||
environment:
|
environment:
|
||||||
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
|
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb3
|
- couchdb3
|
||||||
|
|
||||||
|
couchdb0:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb0
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "5984:5984" # this is the restful API addr, can also access fauxton web ui thru http://localhost:5984/_utils/
|
||||||
|
|
||||||
|
couchdb1:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb1
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "6984:5984"
|
||||||
|
|
||||||
|
couchdb2:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb2
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "7984:5984"
|
||||||
|
|
||||||
|
couchdb3:
|
||||||
|
extends:
|
||||||
|
file: base.yaml
|
||||||
|
service: couchdb-base
|
||||||
|
container_name: couchdb3
|
||||||
|
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||||
|
# for example map it to utilize Fauxton User Interface in dev environments.
|
||||||
|
ports:
|
||||||
|
- "8984:5984"
|
||||||
|
|
||||||
|
cli:
|
||||||
|
extends:
|
||||||
|
file: docker-compose-base.yaml
|
||||||
|
service: cli
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
|
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
|
||||||
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
|
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
|
||||||
# * 1 ca
|
# * 2 ca
|
||||||
# * 1 orderer
|
# * 1 orderer
|
||||||
# * 4 peers in 2 orgs
|
# * 4 peers in 2 orgs
|
||||||
# * cli for testing
|
# * cli for testing
|
||||||
|
@ -29,7 +29,6 @@ services:
|
||||||
service: orderer.example.com
|
service: orderer.example.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base.yaml
|
file: docker-compose-base.yaml
|
||||||
|
|
|
@ -23,7 +23,6 @@ createChannel
|
||||||
echo_b "Having all peers join the channel..."
|
echo_b "Having all peers join the channel..."
|
||||||
joinChannel 0
|
joinChannel 0
|
||||||
|
|
||||||
|
|
||||||
## Set the anchor peers for each org in the channel
|
## Set the anchor peers for each org in the channel
|
||||||
echo_b "Updating anchor peers for peer0/org1..."
|
echo_b "Updating anchor peers for peer0/org1..."
|
||||||
updateAnchorPeers 0
|
updateAnchorPeers 0
|
||||||
|
@ -37,7 +36,6 @@ installChaincode 0
|
||||||
echo_b "Instantiating chaincode on the channel..."
|
echo_b "Instantiating chaincode on the channel..."
|
||||||
instantiateChaincode 0
|
instantiateChaincode 0
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo_g "===================== All GOOD, initialization completed ===================== "
|
echo_g "===================== All GOOD, initialization completed ===================== "
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -9,7 +9,6 @@ fi
|
||||||
|
|
||||||
echo_b "Channel name : "$CHANNEL_NAME
|
echo_b "Channel name : "$CHANNEL_NAME
|
||||||
|
|
||||||
|
|
||||||
echo_b "====================Query the existing value of a===================================="
|
echo_b "====================Query the existing value of a===================================="
|
||||||
chaincodeQuery 0 100
|
chaincodeQuery 0 100
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue