Merge pull request #69 from qiang0723/master

Add  couchdb support
pull/70/head
Baohua Yang 2017-06-22 18:18:05 +08:00 committed by GitHub
commit f6377d1e14
5 changed files with 100 additions and 2 deletions

View File

@ -147,7 +147,9 @@ Will explain the usage of `cryptogen` and `configtxgen`
### [WIP] [Some verification tests](./docs/Verification-test.md)
### [WIP] [Use couchDB](./docs/couchdb-usage.md)
### [Use database couchDB](./docs/couchdb-usage.md)
### [WIP] [kafka usage](./docs/kafka-usage.md)
## Acknowledgement

View File

@ -0,0 +1,63 @@
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"
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:
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:
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:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
depends_on:
- couchdb3

View File

@ -0,0 +1,32 @@
### Start network with CouchDB
```bash
docker-compose -f docker-compose-2orgs-4peers.yaml -f docker-compose-2orgs-4peers-couchdb.yaml up
```
To use CouchDB instead of the default database leveldb, The same chaincode functions are available with CouchDB, however, there is the
added ability to perform rich and complex queries against the state database
data content contingent upon the chaincode data being modeled as JSON
### Test chaincode_example02
```bash
docker exec -it fabric-cli bash
bash ./scripts/initialize.sh
bash ./scripts/test_4peers.sh
```
You can use chaincode_example02 chaincode against the CouchDB state database
using the steps outlined above, however in order to exercise the CouchDB query
capabilities you will need to use a chaincode that has data modeled as JSON.
(e.g. marbles02)
### [WIP] [Test example marbles02](https://github.com/hyperledger/fabric/blob/master/examples/chaincode/go/marbles02/marbles_chaincode.go)
### Interact with CouchDb by WEB-UI
The browser is `http://localhost:5984/_utils`, then you will find a database named `businesschannel`

View File

@ -17,7 +17,8 @@ echo_b "Downloading images from DockerHub... need a while"
docker pull yeasy/hyperledger-fabric-base:$IMG_VERSION \
&& docker pull yeasy/hyperledger-fabric-peer:$IMG_VERSION \
&& docker pull yeasy/hyperledger-fabric-orderer:$IMG_VERSION \
&& docker pull yeasy/hyperledger-fabric-ca:$IMG_VERSION
&& docker pull yeasy/hyperledger-fabric-ca:$IMG_VERSION \
&& docker pull hyperledger/fabric-couchdb:$ARCH-1.0.0-beta
# Only useful for debugging
# docker pull yeasy/hyperledger-fabric