Support couchdb now

pull/108/head
Baohua Yang 2017-09-01 21:26:25 +08:00
parent 2c2ac23684
commit ce816e0a4b
12 changed files with 323 additions and 203 deletions

View File

@ -1,52 +1,19 @@
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
COMPOSE_COUCHDB_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
all:
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
sleep 2
@echo "Restarting network..."
make restart
make init
sleep 2
make test_cc
sleep 1
make lscc
sleep 1
make qscc
make ready
make lscc qscc
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:
make stop
make start
sleep 2
make init
@echo "Restart and init network..."
make restart init
sleep 2
make test_cc
@ -54,10 +21,6 @@ ready:
@echo "run 'make cli' to enter into the fabric-cli container."
@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
@echo "Start a fabric network with 2-org-4-peer"
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"
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
@echo "Stop the fabric network"
@ -86,18 +36,19 @@ stop: # stop the fabric network
restart: stop start
clean: # clean up environment
@echo "Clean all images and containers"
bash scripts/clean_env.sh
################## Dev testing ################
dev:
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
sleep 2
cli: # enter the cli container
docker exec -it fabric-cli bash
@echo "Restart and init dev network..."
make dev_restart dev_init
sleep 2
ps: # show existing docker images
docker ps -a
make test_peer0
make lscc qscc
logs: # show logs
docker-compose -f ${COMPOSE_FILE} logs -f --tail 200
make dev_stop
dev_start: # start fabric network 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
################## 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

View File

@ -128,6 +128,6 @@ services:
couchdb-base:
#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,
# for example map it to utilize Fauxton User Interface in dev environments.

View File

@ -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'
services:
couchdb0:
container_name: couchdb0
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:
- "5984:5984"
orderer.example.com:
extends:
file: docker-compose-base.yaml
service: orderer.example.com
peer0.org1.example.com:
extends:
file: docker-compose-base.yaml
service: peer0.org1.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
depends_on:
- 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:
extends:
file: docker-compose-base.yaml
service: peer1.org1.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
depends_on:
- 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:
extends:
file: docker-compose-base.yaml
service: peer0.org2.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
depends_on:
- 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:
extends:
file: docker-compose-base.yaml
service: peer1.org2.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
depends_on:
- 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

View File

@ -1,6 +1,6 @@
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
# * 1 ca
# This compose file will start a Hyperledger Fabric 1.0.1 MVE, including
# * 2 ca (not in use now)
# * 1 orderer
# * 4 peers in 2 orgs
# * cli for testing
@ -29,7 +29,6 @@ services:
service: orderer.example.com
peer0.org1.example.com:
extends:
file: docker-compose-base.yaml

View File

@ -23,7 +23,6 @@ createChannel
echo_b "Having all peers join the channel..."
joinChannel 0
## Set the anchor peers for each org in the channel
echo_b "Updating anchor peers for peer0/org1..."
updateAnchorPeers 0
@ -37,7 +36,6 @@ installChaincode 0
echo_b "Instantiating chaincode on the channel..."
instantiateChaincode 0
echo
echo_g "===================== All GOOD, initialization completed ===================== "
echo

View File

@ -9,7 +9,6 @@ fi
echo_b "Channel name : "$CHANNEL_NAME
echo_b "====================Query the existing value of a===================================="
chaincodeQuery 0 100

View File

@ -1,52 +1,19 @@
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
COMPOSE_COUCHDB_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
all:
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
sleep 2
@echo "Restarting network..."
make restart
make init
sleep 2
make test_cc
sleep 1
make lscc
sleep 1
make qscc
make ready
make lscc qscc
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:
make stop
make start
sleep 2
make init
@echo "Restart and init network..."
make restart init
sleep 2
make test_cc
@ -54,10 +21,6 @@ ready:
@echo "run 'make cli' to enter into the fabric-cli container."
@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
@echo "Start a fabric network with 2-org-4-peer"
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"
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
@echo "Stop the fabric network"
@ -86,18 +36,19 @@ stop: # stop the fabric network
restart: stop start
clean: # clean up environment
@echo "Clean all images and containers"
bash scripts/clean_env.sh
################## Dev testing ################
dev:
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
sleep 2
cli: # enter the cli container
docker exec -it fabric-cli bash
@echo "Restart and init dev network..."
make dev_restart dev_init
sleep 2
ps: # show existing docker images
docker ps -a
make test_peer0
make lscc qscc
logs: # show logs
docker-compose -f ${COMPOSE_FILE} logs -f --tail 200
make dev_stop
dev_start: # start fabric network 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
################## 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

View File

@ -128,6 +128,6 @@ services:
couchdb-base:
#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,
# for example map it to utilize Fauxton User Interface in dev environments.

View File

@ -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'
services:
couchdb0:
container_name: couchdb0
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:
- "5984:5984"
orderer.example.com:
extends:
file: docker-compose-base.yaml
service: orderer.example.com
peer0.org1.example.com:
extends:
file: docker-compose-base.yaml
service: peer0.org1.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
depends_on:
- 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:
extends:
file: docker-compose-base.yaml
service: peer1.org1.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
depends_on:
- 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:
extends:
file: docker-compose-base.yaml
service: peer0.org2.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
depends_on:
- 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:
extends:
file: docker-compose-base.yaml
service: peer1.org2.example.com
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
depends_on:
- 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

View File

@ -1,6 +1,6 @@
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
# * 1 ca
# * 2 ca
# * 1 orderer
# * 4 peers in 2 orgs
# * cli for testing
@ -29,7 +29,6 @@ services:
service: orderer.example.com
peer0.org1.example.com:
extends:
file: docker-compose-base.yaml

View File

@ -23,7 +23,6 @@ createChannel
echo_b "Having all peers join the channel..."
joinChannel 0
## Set the anchor peers for each org in the channel
echo_b "Updating anchor peers for peer0/org1..."
updateAnchorPeers 0
@ -37,7 +36,6 @@ installChaincode 0
echo_b "Instantiating chaincode on the channel..."
instantiateChaincode 0
echo
echo_g "===================== All GOOD, initialization completed ===================== "
echo

View File

@ -9,7 +9,6 @@ fi
echo_b "Channel name : "$CHANNEL_NAME
echo_b "====================Query the existing value of a===================================="
chaincodeQuery 0 100