couchdbblockchainhyperledger-fabrichyperledgerfauxton

Couchdb port mapping in yaml file for Hyperledger Fabric V1.0 network setup


Can someone please explain the port mapping in this docker-compose-couch.yaml.

Please look into the following

container_name: couchdb0
-ports:
- "5984:5984"
-- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984

container_name: couchdb1
-ports:
-- "6984:5984"
-- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984

container_name: couchdb2
-ports:
-- "7984:5984"
-- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984

container_name: couchdb3
-ports:
-- "8984:5984"
-- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984

  1. Here why all the addresses mapping to the same port 5984? is it using the same DB instead of using separate DB for each peer?

Also after making the transaction, when I check the db using Fauxton UI using the below URLs

http://192.168.99.100:5984/_utils/#/database/mydemochannel/_all_docs http://192.168.99.100:6984/_utils/#/database/mydemochannel/_all_docs http://192.168.99.100:7984/_utils/#/database/mydemochannel/_all_docs http://192.168.99.100:8984/_utils/#/database/mydemochannel/_all_docs
(192.168.99.100 is my virtual machine IP on windows 7 machine)

all showing the same data.

  1. My doubt here is, it displaying encrypted data or plain text values in Fauxton UI? Once I tick the Include Docs check box, it is showing the value also. As per my understanding the values will be encrypted based on peers signature(please correct me if I am wrong), then how it is showing the value as plain text jason?

Solution

  • The 5984 is the couch db port number, now the mapping of ports from docker-compose-couchdb.yaml file simply defines mapping from docker container into docker host machine. Since there are 4 couchdb container (one for each peer) you cannot map all of them on the same port number, therefore for each one defined different mapping: 5984, 6984, 7984 and 8984 respectively. So it's not mapping to the same port, but from the same port to the different ones. Please refer for docker compose docs here.

    Starting from Hyperledger Fabric v1.0 there is no encryption of values in state db, if you would like to proceed and encrypt your data you can do it on application level. For example client could pass AES key via transient map field of the proposal and chaincode will encode params based on that key do the chaincode business logic, decode results back and store them.