Re: setup multi-org fabric network using peer dev mode
Hello Satheesh. How are you? I hope you are doing well. My personal dev environment is using the CCAAS builders that came with 2.4+ version with vagrant and connecting remotely using an IDE (VSCODE or IntelliJ). If you are using fabric samples, you just need change all of your peers to start with --peer-chaincodedev=true ( YAML line with command: peer node start --peer-chaincodedev=true - compose-test-net.yaml) and start your network to be able to debug. In my case, when I am developing the chaincode, I start the chaincode using my IDE using the command: - "start:server-debug": "set -x && NODE_OPTIONS='--inspect=0.0.0.0:9229' fabric-chaincode-node server --chaincode-address=$CHAINCODE_SERVER_ADDRESS --chaincode-id=$CHAINCODE_ID",
The chaincode package that will be installed in all peers, I generate using the following commands (I am using Javascript / Typescript chaincodes):
(I do the install in all peers if needed); NOTE: with this setup, all peers will use only one chaincode endpoint (running attached to IDE). And finally, I change the endorsement rule to need only one endorsement and the peers execute only one time the chaincode. In a multi org, the breakpoint will get accessed a lot of times, turning the debug process a little more difficult:
To deploy under a test environment or test KUBERNETES cluster (One chanincode by peer), I use the following connection.json: { "address": "{{.peername}}.mycoolchaincode.cooldomain:9998", "dial_timeout": "10s", "tls_required": false } The variable {{.peername}} is related to the folllowing PEER environment variable: - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0org2"} NOTE: with this setup, each of the peers will have his own chaincode container. If you start all of the chaincode containers in debug mode (NODE_OPTIONS='--inspect=0.0.0.0:9229'), you will be able to remotely connect to the container using the IDE and debug using the port 9229. If you have a lot of peers and orgs, maybe the connected chaincode for debug will not be accessed by the transaction if the other peers endorse the transaction first. (Of Course, you can force the transaction to a specific peer configuring it on the client side). So, I think that it is almost the same effort to setup a multi org environment setting the peer dev mode to true. My best regards. David Em ter., 17 de mai. de 2022 às 06:14, satheesh via lists.hyperledger.org <ctsatheesh=yahoo.com@...> escreveu:
--
David Reis
|
|