-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FABCN-409] Chaincode gRPC server w/o TLS #159
Conversation
This patch adds the ChaincodeServer class to support the server mode of chaincode. It also adds the server() method, which creates a new instance of the ChaincodeServer class, to the Shim class, the entrypoint of the fabric-shim library. Signed-off-by: Taku Shimosawa <[email protected]>
@shimos could you give me a summary of how a node.js chaincode server would be started? Thanks |
@mbwhite For a peer, it should be configured to use external builder scripts (sample: https://github.com/shimos/fabric-chaincode-node/tree/629f10361cc48073e57a39180e55bc001cb4c746/tools/toolchain/network/external). The overall procedures to run the chaincode as a server would be:
Please refer to my e2e test draft for details: shimos@629f103 |
thanks @shimos. Are you able to extend the Contract API so that it can be started in a similar manner please? |
@mbwhite Thank you for merging. Yes, I'm going to work on CLI so that we can start a chaincode server with the contract API. |
This patch adds the ChaincodeServer class to support the server mode of chaincode. It also adds the server() method, which creates a new instance of the ChaincodeServer class, to the Shim class, the entrypoint of the fabric-shim library. Signed-off-by: Taku Shimosawa <[email protected]>
* [FABCN-408] Separate message handler from client (#155) This patch divides the ChaincodeSupportClient class into two classes: ChaincodeSupportClient, which represents a chaincode client that connects to a peer, and ChaincodeMessageHandler, which handles messages in communciation with the peer through a stream. Because the latter part is common in both client and server model, the ChaincodeMessageHandler class will be used in the future implementation for a chaincode gRPC server. Signed-off-by: Taku Shimosawa <[email protected]> Co-authored-by: Matthew B White <[email protected]> * [FABCN-409] Chaincode gRPC server w/o TLS (#159) This patch adds the ChaincodeServer class to support the server mode of chaincode. It also adds the server() method, which creates a new instance of the ChaincodeServer class, to the Shim class, the entrypoint of the fabric-shim library. Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-411] Add server command to CLI (#161) This patch adds a "server" command to the "fabric-chaincode-node" CLI. The command starts the contracts as a chaincode server. Example: fabric-chaincode-node server --chaincode-address 0.0.0.0:9999 \ --chaincode-id mycc_v0:a1233bb13227a05932 Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-413] Add e2e test for chaincode server (#162) This patch adds new e2e test for the chaincode gRPC server feature. The test performs as following: - Create a package which contains server and cc information - Build a container image of the chaincode - Install the package into peers - Obtain the installed package ID from the peers - Start the chaincode container with the package ID - Approve and commit the chaincode definition - Invoke and query the chaincode "rush test:e2e" will perform both tests for both server and client mode. This patch also modifies "rush start-fabric" to use external builder scripts. Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-414] Update TypeScript definition (#165) This patch updates the type defintion file for TypeScript to add classes and interfaces related to the chaincode server feature. Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-412] TLS support for chaincode server (#164) This patch adds TLS support for chaincode server. To enable TLS, set tlsProps in the second argument for shim.server, or add --chaincode-tls-cert-file and --chaincode-tls.key-file for CLI. Client certificate validation can be enabled via tlsProps.clientCACerts for shim.server or --chaincode-tls-client-cacert-file for CLI. Also the -path options (for base64 encoded files) are supported. Signed-off-by: Taku Shimosawa <[email protected]> Co-authored-by: Matthew B White <[email protected]>
* [FABCI-482] Update Nexus URL's to Artifactory Signed-off-by: Brett Logan <[email protected]> * [FABCN-377] Prepare v2.0 release Signed-off-by: James Taylor <[email protected]> * Fix docker tag Tag needs to include hyperledger to match the publish command Signed-off-by: James Taylor <[email protected]> * [FABCN-377] Bump version to 2.0.1 Signed-off-by: James Taylor <[email protected]> * [FABCN-378] Publish jsdoc Signed-off-by: James Taylor <[email protected]> * Re-enable tests Signed-off-by: James Taylor <[email protected]> * [FABCN-381] Access localmspid Signed-off-by: James Taylor <[email protected]> * Update audit level Temporarily raise audit level to moderate to work around current minimist audit failures Can be reverted after grpc, rc, and tar dependecies have been updated to pull in updated versions of mkdirp and minimist Signed-off-by: James Taylor <[email protected]> * Expand node engine version range Signed-off-by: James Taylor <[email protected]> * FABCN-391 Use version 2.1 of fabric docker images Signed-off-by: heatherlp <[email protected]> * FABCN-391 Update test/chaincodes to use node 10 and add a missing hat Signed-off-by: heatherlp <[email protected]> * [FABCN-377] Prepare for v2.1 unstable builds (WIP) Signed-off-by: James Taylor <[email protected]> * [FABCN-373] Compatibility Matrix Ammended all the node-engines in package.json to match that in the docker image Signed-off-by: Matthew B White <[email protected]> Change-Id: Ia536ed66daf857679adf9f858b35d206a4f1007f * [FABCN-382] fix compatibility.md title Signed-off-by: Andrew Hurt <[email protected]> * Improve build reliability It looks like rushjs symlinking can cause issues with the CopyFiles task. Use a script instead as suggested in microsoft/azure-pipelines-tasks#9046 Signed-off-by: James Taylor <[email protected]> * Add readme to redirect to site Signed-off-by: Ry Jones <[email protected]> * FABCN-241 Remove to.be.ok Signed-off-by: lesleyannj <[email protected]> * FABCN-241 Change to.be.ok Signed-off-by: lesleyannj <[email protected]> * FABCN-241 Remove to.be.ok Signed-off-by: lesleyannj <[email protected]> * fix: remove semicolon Signed-off-by: Johnny Da Costa <[email protected]> * FABCN-391 Set docker images to use node 10 - reflect this in compatibility.md - update some out of date tutorial lines Signed-off-by: heatherlp <[email protected]> * FABCN-391 Build against release-2.x Signed-off-by: heatherlp <[email protected]> * FABCN-391 Remove references to 2.0 and 2.0.0 - replace with 2.x Signed-off-by: heatherlp <[email protected]> * [FABCN-392] Update to Node 12 Set node engine to be the latest LTS at time of commit 12.6.1 Due to issues with comibation of the 12.6 and rewire, unit tests are run with node 12.5.0 Updated timeout as Typescript compilation seems to have slowed down. Signed-off-by: Matthew B White <[email protected]> * [FABCN-391] Publish JSDoc to release-2.1 Signed-off-by: James Taylor <[email protected]> * FABCN-391 v2.1.0 Release (#112) * FABCN-391 v2.1.0 Release - also fixed nodeenv images to use node 12 Signed-off-by: heatherlp <[email protected]> * Update timeout (#114) Signed-off-by: Brett Logan <[email protected]> Co-authored-by: Brett Logan <[email protected]> * FABCN-391 Bump to 2.1.1 and fix docker tag (#122) * FABCN-391 Remove "latest" from tag name on docker image publishing for tagged versions Signed-off-by: heatherlp <[email protected]> * FABCN-391 Bump version number to 2.1.1 Signed-off-by: heatherlp <[email protected]> * [FABCN-391] fix directory for api doc publish (#125) Signed-off-by: James Taylor <[email protected]> * [FABCN-394] Update typescript interface file (#128) Updated both typescript definition files to match the case and the existance of the implementation function. Signed-off-by: Matthew B White <[email protected]> * Prepare 2.1.1 release (#133) Signed-off-by: James Taylor <[email protected]> * Bump version (#134) Signed-off-by: James Taylor <[email protected]> * [FABCN-397] State queries limited to 100 results (#141) Errow was the new version of protobufjs used to create the bundle.js gave a different property to the 'has more' field. hasMore replaced has_more As this accessed as JS property it didn't fail, but meant only a limited number could be accessed. corrected, added test for 229 results. bit of dead code pruning Signed-off-by: Matthew B White <[email protected]> * [FABCN-396] Add notes on minimum 1.4 module version for node 12 (#139) Stated that 1.4.5 and above are the versions that work with node 12 Added a better example for the use of the chaincode node runtime environment variable Signed-off-by: Matthew B White <[email protected]> * FABCN-395: Use @grpc/grpc-js for Node.js chaincode (#143) (#144) Signed-off-by: Simon Stone <[email protected]> * FABCN-401 Correct use of Yargs api (#145) * FABCN-401 Correct use of Yargs api Change from package.json to api parser configuration Signed-off-by: Matthew B White <[email protected]> * Force build Signed-off-by: Matthew B White <[email protected]> * Fix broken tutorials link (#137) (#138) Signed-off-by: NIKHIL E GUPTA <[email protected]> Co-authored-by: NIKHIL E GUPTA <[email protected]> Co-authored-by: NIKHIL E GUPTA <[email protected]> * Prepare 2.1.2 release (#148) Signed-off-by: James Taylor <[email protected]> * Bump version to 2.1.3 (#149) Signed-off-by: James Taylor <[email protected]> * FABCN-405 Fix tutorial reference (#150) (#152) Updated to use 2.1 modules Signed-off-by: Ry Jones <[email protected]> Co-authored-by: Matthew B White <[email protected]> Signed-off-by: Matthew B White <[email protected]> Co-authored-by: Ry Jones <[email protected]> * [FABCN-407] Update protos (#154) (#157) To prepare for the implementation of chaincode gRPC server, this patch updates protobuf definitions to the latest ones. Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-410] Use new lifecycle for fv/e2e tests (#160) This patch enables v2.0 feature in the test Hyperledger Fabric network and uses new lifecycle commands in the fv and e2e tests. Signed-off-by: Taku Shimosawa <[email protected]> * Fix 'rush install' error in release-2.x (#163) This patch upgrades pnpm to fix the "Could not find peer dependency 'google-auth-library'" error. Signed-off-by: Taku Shimosawa <[email protected]> * Cheery-pick chaincode server feature to release-2.x (#166) * [FABCN-408] Separate message handler from client (#155) This patch divides the ChaincodeSupportClient class into two classes: ChaincodeSupportClient, which represents a chaincode client that connects to a peer, and ChaincodeMessageHandler, which handles messages in communciation with the peer through a stream. Because the latter part is common in both client and server model, the ChaincodeMessageHandler class will be used in the future implementation for a chaincode gRPC server. Signed-off-by: Taku Shimosawa <[email protected]> Co-authored-by: Matthew B White <[email protected]> * [FABCN-409] Chaincode gRPC server w/o TLS (#159) This patch adds the ChaincodeServer class to support the server mode of chaincode. It also adds the server() method, which creates a new instance of the ChaincodeServer class, to the Shim class, the entrypoint of the fabric-shim library. Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-411] Add server command to CLI (#161) This patch adds a "server" command to the "fabric-chaincode-node" CLI. The command starts the contracts as a chaincode server. Example: fabric-chaincode-node server --chaincode-address 0.0.0.0:9999 \ --chaincode-id mycc_v0:a1233bb13227a05932 Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-413] Add e2e test for chaincode server (#162) This patch adds new e2e test for the chaincode gRPC server feature. The test performs as following: - Create a package which contains server and cc information - Build a container image of the chaincode - Install the package into peers - Obtain the installed package ID from the peers - Start the chaincode container with the package ID - Approve and commit the chaincode definition - Invoke and query the chaincode "rush test:e2e" will perform both tests for both server and client mode. This patch also modifies "rush start-fabric" to use external builder scripts. Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-414] Update TypeScript definition (#165) This patch updates the type defintion file for TypeScript to add classes and interfaces related to the chaincode server feature. Signed-off-by: Taku Shimosawa <[email protected]> * [FABCN-412] TLS support for chaincode server (#164) This patch adds TLS support for chaincode server. To enable TLS, set tlsProps in the second argument for shim.server, or add --chaincode-tls-cert-file and --chaincode-tls.key-file for CLI. Client certificate validation can be enabled via tlsProps.clientCACerts for shim.server or --chaincode-tls-client-cacert-file for CLI. Also the -path options (for base64 encoded files) are supported. Signed-off-by: Taku Shimosawa <[email protected]> Co-authored-by: Matthew B White <[email protected]> * [FABCN-415] Lock grpc-js to 1.0.3 (#170) @grpc/grpc-js updated to 1.1.0; this has caused the initial request to the peer on chaincode start to fail. Dropping back to 1.0.3 resolves the issue. See FABCN-415 Signed-off-by: Matthew B White <[email protected]> * [FABCN-416] Release v2.1.3 (#171) For resolving grpc version dependency Signed-off-by: Matthew B White <[email protected]> * Specify exact version of winston dependency Work around for issue winstonjs/winston#1814 Signed-off-by: James Taylor <[email protected]> * Prepare 2.1.4 release (#174) Signed-off-by: James Taylor <[email protected]> * [FABCN-393] Fix broken links in documents (#169) This patch fixes broken links to the fabric documents. This patch also fixes links to point to those for the proper version (2.1). Signed-off-by: Taku Shimosawa <[email protected]> * Bump version to 2.1.5 (#175) Signed-off-by: James Taylor <[email protected]> * [FABCN-319] Update dependnency versions (#176) - Update grpc-js and winston to pre-lock levels - General update of dependcies - Note add about shirnkwrap. - Corrected test cases Signed-off-by: Matthew B White <[email protected]> * [FABCN-420] Remove Azure pipeline warnings (#177) Used new coverage merge tool to joing coverage together Signed-off-by: Matthew B White <[email protected]> * Use Official CouchDB 3.1 Image (#180) Fabric 2.2 removes official support for CouchDB 2.x. The migration to 3.1 was to address fsync issues in the underlying storage implementation in Couch. This change moves to CouchDB 3.1 which requires the user to now set an admin identity at startup. Node 12.18.2 is the latest LTS Signed-off-by: Brett Logan <[email protected]> * [FABCN-421] release: 2.2.0 LTS release (#181) Signed-off-by: Matthew B White <[email protected]> * Bump version to 2.2.1 (#184) Signed-off-by: James Taylor <[email protected]> * Fix: ChaincodeStub.getMspID should be in lowerCamelCASE Signed-off-by: winderica <[email protected]> * [FABCN-422] Add release guide (#187) Signed-off-by: James Taylor <[email protected]> * [FABCN-433] Update typescript and @types/node (#199) Need current supported levels. Signed-off-by: Matthew B White <[email protected]> * [FABCN-241] Remove to.be.ok (#204) Signed-off-by: lesleyannj <[email protected]> * [FABCN-435] OOM on Large Arg Size (#207) Incorrect trace point logging entire binary message Signed-off-by: Matthew B White <[email protected]> * v2.x tutorials updated (#217) Signed-off-by: Kestutis Gudynas <[email protected]> * [FABCN-430] Fix type for timestamp.second (#194) (#209) This patch fixes the type definition for the second field in the Timestamp, which is actually Long (int64). Signed-off-by: Taku Shimosawa <[email protected]> Co-authored-by: Matthew B White <[email protected]> Co-authored-by: Taku Shimosawa <[email protected]> * [FABCN-432] - Update class transformer dependency (#213) * [FABCN-241] Remove to.be.ok Signed-off-by: lesleyannj <[email protected]> * [FABCN-1627]-Update class transformer dependency Signed-off-by: lesleyannj <[email protected]> * Release v2.3.0 Signed-off-by: Kestutis Gudynas <[email protected]> * Bump version to 2.3.1 Signed-off-by: Kestutis Gudynas <[email protected]> Co-authored-by: Brett Logan <[email protected]> Co-authored-by: heatherlp <[email protected]> Co-authored-by: Matthew B White <[email protected]> Co-authored-by: Andrew Hurt <[email protected]> Co-authored-by: Ry Jones <[email protected]> Co-authored-by: lesleyannj <[email protected]> Co-authored-by: Johnny Da Costa <[email protected]> Co-authored-by: Matthew B White <[email protected]> Co-authored-by: heatherlp <[email protected]> Co-authored-by: Simon Stone <[email protected]> Co-authored-by: nikhil550 <[email protected]> Co-authored-by: NIKHIL E GUPTA <[email protected]> Co-authored-by: Taku Shimosawa <[email protected]> Co-authored-by: winderica <[email protected]> Co-authored-by: LAJ <[email protected]> Co-authored-by: Kestutis Gudynas <[email protected]> Co-authored-by: Kestutis Gudynas <[email protected]>
This patch adds the ChaincodeServer class to support the server mode of
chaincode.
It also adds the server() method, which creates a new instance of
the ChaincodeServer class, to the Shim class, the entrypoint of the
fabric-shim library.
Signed-off-by: Taku Shimosawa [email protected]
Update for CLI and e2e tests will be posted in another JIRA issues and PRs.