mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-25 11:05:10 +00:00
Remove the ccaas init container from org2 peer; tweak docs on ccaas config
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
This commit is contained in:
parent
059a1d0b21
commit
b25b30ae40
4 changed files with 17 additions and 49 deletions
|
|
@ -103,52 +103,38 @@ Running Fabric in Kubernetes places some unique constraints on the Chaincode lif
|
||||||
|
|
||||||
- For cloud-ready development, test, validation, CI/CD, and production practices, the use of the
|
- For cloud-ready development, test, validation, CI/CD, and production practices, the use of the
|
||||||
[Chaincode as a Service](https://hyperledger-fabric.readthedocs.io/en/latest/cc_service.html) pattern provides a
|
[Chaincode as a Service](https://hyperledger-fabric.readthedocs.io/en/latest/cc_service.html) pattern provides a
|
||||||
_vastly superior user experience_. However, with the current (2.3) Fabric builds, the configuration of [External
|
_vastly superior user experience_.
|
||||||
Chaincode Builders](https://hyperledger-fabric.readthedocs.io/en/latest/cc_launcher.html) is non-trivial and
|
|
||||||
includes some real complexity for deployment to Kubernetes.
|
|
||||||
|
|
||||||
|
|
||||||
- Running Chaincode builds in Docker in Docker, running in Kubernetes in Docker is ... interesting. Let's
|
- Running Chaincode builds in Docker in Docker, running in Kubernetes in Docker is ... interesting. Let's
|
||||||
step back and _keep it simple_.
|
step back and _keep it simple_.
|
||||||
|
|
||||||
|
|
||||||
|
In the Kubernetes Test Network, we've incorporated the default `ccaas` external builder
|
||||||
For the Kube Test Network, we've configured the peer nodes to launch with the [fabric-ccs-builder](https://github.com/hyperledgendary/fabric-ccs-builder)
|
(See [fabric #2884](https://github.com/hyperledger/fabric/issues/2884)) as an accelerator for working with
|
||||||
External Chaincode Builders pre-bundled into the network. When chaincode is installed on the peers, the external
|
Chaincode-as-a-Service on Kubernetes. For `ccaas` smart contracts, when chaincode is installed on a peer, the
|
||||||
builder binaries will be invoked, bypassing the reliance on a local Docker daemon running in Kubernetes.
|
external builder binaries will be invoked, bypassing the reliance on a local Docker daemon running in Kubernetes.
|
||||||
|
|
||||||
This configuration is accomplished by registering an external builder in the peer core.yaml:
|
This configuration is accomplished by registering an external builder in the peer core.yaml:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
externalBuilders:
|
externalBuilders:
|
||||||
- path: /var/hyperledger/fabric/chaincode/ccs-builder
|
- name: ccaas_builder
|
||||||
name: ccs-builder
|
path: /opt/hyperledger/ccaas_builder
|
||||||
propagateEnvironment:
|
propagateEnvironment:
|
||||||
- HOME
|
- CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG
|
||||||
- CORE_PEER_ID
|
|
||||||
- CORE_PEER_LOCALMSPID
|
|
||||||
```
|
```
|
||||||
|
|
||||||
At launch time, the Kubernetes deployment includes an init container that will load the fabric-ccs-builder binaries
|
To trigger the external builder for a chaincode service, set the metadata.json `type` attribute to `ccaas`. E.g.:
|
||||||
from a public container registry, copying the external builders into the target volume in the peer:
|
```json
|
||||||
|
{
|
||||||
```yaml
|
"type": "ccaas",
|
||||||
initContainers:
|
"label": "basic_1.0"
|
||||||
- name: fabric-ccs-builder
|
}
|
||||||
image: {{FABRIC_CONTAINER_REGISTRY}}/fabric-ccs-builder
|
|
||||||
command: [sh, -c]
|
|
||||||
args: ["cp /go/bin/* /var/hyperledger/fabric/chaincode/ccs-builder/bin/"]
|
|
||||||
volumeMounts:
|
|
||||||
- name: ccs-builder
|
|
||||||
mountPath: /var/hyperledger/fabric/chaincode/ccs-builder/bin
|
|
||||||
```
|
```
|
||||||
|
|
||||||
With this configuration we eliminate the reliance on Docker daemon, fully supporting the _Chaincode-as-a-Service_
|
|
||||||
pattern for building smart contracts in a cloud-native environment.
|
|
||||||
|
|
||||||
- [x] Pro tip: Use the companion container registry at `localhost:5000` to deploy custom chaincode into the test network.
|
- [x] Pro tip: Use the companion container registry at `localhost:5000` to deploy custom chaincode into the test network.
|
||||||
- [x] Pro tip: Deploy a chaincode with `address: host.docker.internal:9999` and run your chaincode in a debugger.
|
- [x] Pro tip: Deploy a chaincode with `address: host.docker.internal:9999` and attach your chaincode in a debugger.
|
||||||
- [ ] Note: An external chaincode builder will be included in future releases of Fabric.
|
|
||||||
|
|
||||||
|
|
||||||
## Starting Peers and Orderers
|
## Starting Peers and Orderers
|
||||||
|
|
|
||||||
|
|
@ -61,20 +61,6 @@ spec:
|
||||||
mountPath: /var/hyperledger
|
mountPath: /var/hyperledger
|
||||||
- name: fabric-config
|
- name: fabric-config
|
||||||
mountPath: /var/hyperledger/fabric/config
|
mountPath: /var/hyperledger/fabric/config
|
||||||
- name: ccs-builder
|
|
||||||
mountPath: /var/hyperledger/fabric/chaincode/ccs-builder/bin
|
|
||||||
|
|
||||||
# load the external chaincode builder into the peer image prior to peer launch.
|
|
||||||
initContainers:
|
|
||||||
- name: fabric-ccs-builder
|
|
||||||
image: ghcr.io/hyperledgendary/fabric-ccs-builder
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
command: [sh, -c]
|
|
||||||
args: ["cp /go/bin/* /var/hyperledger/fabric/chaincode/ccs-builder/bin/"]
|
|
||||||
volumeMounts:
|
|
||||||
- name: ccs-builder
|
|
||||||
mountPath: /var/hyperledger/fabric/chaincode/ccs-builder/bin
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: fabric-volume
|
- name: fabric-volume
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
|
|
@ -82,8 +68,6 @@ spec:
|
||||||
- name: fabric-config
|
- name: fabric-config
|
||||||
configMap:
|
configMap:
|
||||||
name: org2-config
|
name: org2-config
|
||||||
- name: ccs-builder
|
|
||||||
emptyDir: {}
|
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ set -o errexit
|
||||||
# todo: track down a nasty bug whereby the CA service endpoints (kube services) will occasionally reject TCP connections after network down/up. This is patched by introducing a 10s sleep after the deployments are up...
|
# todo: track down a nasty bug whereby the CA service endpoints (kube services) will occasionally reject TCP connections after network down/up. This is patched by introducing a 10s sleep after the deployments are up...
|
||||||
# todo: refactor query/invoke to specify chaincode name (-n param)
|
# todo: refactor query/invoke to specify chaincode name (-n param)
|
||||||
|
|
||||||
FABRIC_VERSION=${TEST_NETWORK_FABRIC_VERSION:-2.3.2}
|
FABRIC_VERSION=${TEST_NETWORK_FABRIC_VERSION:-2.4.1}
|
||||||
FABRIC_CA_VERSION=${TEST_NETWORK_FABRIC_CA_VERSION:-1.5.2}
|
FABRIC_CA_VERSION=${TEST_NETWORK_FABRIC_CA_VERSION:-1.5.2}
|
||||||
FABRIC_CONTAINER_REGISTRY=${TEST_NETWORK_FABRIC_CONTAINER_REGISTRY:-hyperledger}
|
FABRIC_CONTAINER_REGISTRY=${TEST_NETWORK_FABRIC_CONTAINER_REGISTRY:-hyperledger}
|
||||||
NETWORK_NAME=${TEST_NETWORK_NAME:-test-network}
|
NETWORK_NAME=${TEST_NETWORK_NAME:-test-network}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ function pull_docker_images() {
|
||||||
docker pull ${FABRIC_CONTAINER_REGISTRY}/fabric-orderer:$FABRIC_VERSION
|
docker pull ${FABRIC_CONTAINER_REGISTRY}/fabric-orderer:$FABRIC_VERSION
|
||||||
docker pull ${FABRIC_CONTAINER_REGISTRY}/fabric-peer:$FABRIC_VERSION
|
docker pull ${FABRIC_CONTAINER_REGISTRY}/fabric-peer:$FABRIC_VERSION
|
||||||
docker pull ${FABRIC_CONTAINER_REGISTRY}/fabric-tools:$FABRIC_VERSION
|
docker pull ${FABRIC_CONTAINER_REGISTRY}/fabric-tools:$FABRIC_VERSION
|
||||||
docker pull ghcr.io/hyperledgendary/fabric-ccs-builder:latest
|
|
||||||
docker pull ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic:latest
|
docker pull ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic:latest
|
||||||
|
|
||||||
pop_fn
|
pop_fn
|
||||||
|
|
@ -25,7 +24,6 @@ function load_docker_images() {
|
||||||
kind load docker-image ${FABRIC_CONTAINER_REGISTRY}/fabric-orderer:$FABRIC_VERSION
|
kind load docker-image ${FABRIC_CONTAINER_REGISTRY}/fabric-orderer:$FABRIC_VERSION
|
||||||
kind load docker-image ${FABRIC_CONTAINER_REGISTRY}/fabric-peer:$FABRIC_VERSION
|
kind load docker-image ${FABRIC_CONTAINER_REGISTRY}/fabric-peer:$FABRIC_VERSION
|
||||||
kind load docker-image ${FABRIC_CONTAINER_REGISTRY}/fabric-tools:$FABRIC_VERSION
|
kind load docker-image ${FABRIC_CONTAINER_REGISTRY}/fabric-tools:$FABRIC_VERSION
|
||||||
kind load docker-image ghcr.io/hyperledgendary/fabric-ccs-builder:latest
|
|
||||||
kind load docker-image ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic:latest
|
kind load docker-image ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic:latest
|
||||||
|
|
||||||
pop_fn
|
pop_fn
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue