-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
As of Fabric > 2.4.1 the peer image contains the default ccaas external chaincode builder to simplify networks relying on the Chaincode as a Service pattern. This builder allows the user to bypass the normal chaincode lifecycle events, launching an external process / URL to receive chaincode invocations from the peer to a known service URL.
The "as a service" deployment provides full flexibility to the administrators on how, where, and when the chaincode systems will be launched. In interactive development, such as in a local debugging context, the flexibility is invaluable. But in post-development workflows, however, the added flexibility becomes a real challenge for Fabric administration, as the service lifecycle is now intertwined with the (already) complicated chaincode lifecycle managed by the peer, channel, and consortium.
On the 5/11 Fabric Community Contributor call, @jt-nti presented a new technique for managing chaincode deployments to greatly simplify the overall process of managing chaincode in cloud native environments.
A New Course:
-
Chaincode compilation is performed outside of Fabric. (e.g. local builds, CI pipelines, public repos, etc.)
-
An external fabric-builder-k8s is responsible for receiving and responding to lifecycle events from the peer.
-
fabric-builder-k8s is responsible for managing the lifecycle of chaincode pods running in Kubernetes.
Using this hybrid approach, chaincode developers can build / test / edit routines locally, publish to a container registry, relying on the natural chaincode lifecycle for installing smart contracts on a channel. In tight build/edit/test iterations, development can occur in a debugger using CCaaS bound to a port on the host system.
On the Horizon
-
Compile-time feedback : Trap CC build/compilation errors at build, not at run/deployment time.
-
No requirements for DIND, docker, or chaincode builds in the network : You build it - Fabric will run it.
-
Instant chaincode : Chaincode launch times measured in seconds, not minutes
-
Goodbye, Docker! No more DIND, root privilege escalation, mobyd, etc.
-
Dude, I just want to write some chaincode...
Compass Bearing
While working with external builders is possible in Fabric, it's still a tremendous challenge to actually install external builders in cloud-native environments.
Address this by:
-
Shore up / battle harden / batten down the hatches / etc. ... the compass bearing set by fabric-builder-k8s
-
Add support for
imagePullSecretandimagePullPolicyattributes to the cc package json / metadata. -
Include the
image:labelstyle syntax to reference containers in the cc package json / metadata. -
Identify a technique to extend mTLS by default (or possibility) in the cc package json / metadata.
-
Build and distribute a golang-based default fabric-builder-k8s, adjacent to ccaas_builder on the peer Docker image and core yaml.
-
Document the overall approach, including a section or guide on the public docs site.
Charts and Maps
-
fabric-builder-k8s : functional prototype - works with kube test network and nano test network
-
Kube test network chaincode.sh : "Externally launching k8s resources"
-
Fabric Community Contributor Meeting - 5/11 : (Chaincode / k8s discussions start ~ 00:11:00)
-
Debugging Smart Contracts with Hyperledger Fabric on Kubernetes