├── SUT └── fabric │ ├── chaincode │ ├── nftsample │ │ ├── metadata.json │ │ └── connection.json │ ├── asset-transfer-basic │ │ ├── metadata.json │ │ └── connection.json │ ├── asset-transfer-basic-debug │ │ ├── metadata.json │ │ └── connection.json │ └── nftsamplecode │ │ ├── go.mod │ │ ├── Dockerfile │ │ ├── erc721.go │ │ ├── main.go │ │ ├── erc721-contract_test.go │ │ └── go.sum │ ├── kube │ ├── org2 │ │ ├── org2-cc.yaml │ │ ├── org2-peer1-couchdb.yaml │ │ ├── org2-peer2-couchdb.yaml │ │ ├── org2-tls-ca.yaml │ │ ├── org2-ecert-ca.yaml │ │ ├── org2-admin-cli.yaml │ │ ├── org2-peer2.yaml │ │ └── org2-peer1.yaml │ ├── pvc-fabric-org0.yaml │ ├── pvc-fabric-org1.yaml │ ├── pvc-fabric-org2.yaml │ ├── pv-fabric-org0.yaml │ ├── pv-fabric-org1.yaml │ ├── pv-fabric-org2.yaml │ ├── org1 │ │ ├── org1-peer1-couchdb.yaml │ │ ├── org1-peer2-couchdb.yaml │ │ ├── org1-cc-template.yaml │ │ ├── org1-tls-ca.yaml │ │ ├── org1-ecert-ca.yaml │ │ ├── org1-admin-cli.yaml │ │ ├── org1-peer2.yaml │ │ └── org1-peer1.yaml │ ├── job-scrub-fabric-volumes.yaml │ └── org0 │ │ ├── org0-admin-cli.yaml │ │ ├── org0-tls-ca.yaml │ │ ├── org0-ecert-ca.yaml │ │ ├── org0-orderer3.yaml │ │ ├── org0-orderer1.yaml │ │ └── org0-orderer2.yaml │ ├── network.sh │ ├── chaincode.sh │ ├── channel.sh │ └── config │ └── org0 │ └── configtx.yaml ├── .gitignore ├── Traffic └── fabric │ ├── scripts │ ├── Logic.rego │ ├── tapetemplateNFT │ └── tapetemplate │ ├── kube │ └── fabric-tape-sample.yaml │ └── tape.sh ├── docs ├── images │ ├── ReadLatency.png │ ├── TapeLatency.png │ ├── ReadThroughput.png │ ├── ResearchOct2022_1.png │ ├── PerformanceSandBox.png │ ├── TransactionLatency.png │ ├── TransactionThroughput.png │ └── PerformanceSandBox(2022May).png ├── locale │ └── zh_CN │ │ ├── Traffic.md │ │ ├── dashboard.md │ │ ├── SUT.md │ │ └── k8s.md ├── dashboard.md ├── Traffic.md ├── ResearchOut.md ├── App.md ├── metrics │ ├── ReadThroughput.md │ ├── TransactionThroughput.md │ ├── ReadLatency.md │ └── TransactionLatency.md ├── SUT.md └── k8s.md ├── kube └── jaeger │ └── deploy │ ├── service_account.yaml │ ├── role_binding.yaml │ ├── cluster_role_binding.yaml │ ├── operator.yaml │ ├── role.yaml │ └── cluster_role.yaml ├── .gitmodules ├── MAINTAINERS.md ├── .github ├── workflows │ ├── release.yml │ ├── CI.yml │ ├── NFTSample.yml │ └── Podman.yml ├── settings.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── new_feature.md ├── App └── fabric │ ├── scripts │ └── ccp-template.json │ ├── app.sh │ ├── jmeter │ └── HTTPRequest.jmx │ └── kube │ └── fabric-rest-sample.yaml ├── dashboard └── fabric │ └── Tape Dashboard.json ├── infra.sh ├── README.md └── LICENSE /SUT/fabric/chaincode/nftsample/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "external", 3 | "label": "nft_1.0" 4 | } -------------------------------------------------------------------------------- /SUT/fabric/chaincode/asset-transfer-basic/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "external", 3 | "label": "basic_1.0" 4 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | image_list 2 | *.out 3 | SUT/fabric/build 4 | Traffic/fabric/build 5 | App/fabric/build 6 | temp.yaml 7 | .vscode -------------------------------------------------------------------------------- /SUT/fabric/chaincode/asset-transfer-basic-debug/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "external", 3 | "label": "basic_1.0" 4 | } -------------------------------------------------------------------------------- /Traffic/fabric/scripts/Logic.rego: -------------------------------------------------------------------------------- 1 | package tape 2 | 3 | default allow = false 4 | allow { 5 | input[_] == "org1" 6 | } 7 | -------------------------------------------------------------------------------- /docs/images/ReadLatency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/ReadLatency.png -------------------------------------------------------------------------------- /docs/images/TapeLatency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/TapeLatency.png -------------------------------------------------------------------------------- /kube/jaeger/deploy/service_account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: jaeger-operator 5 | -------------------------------------------------------------------------------- /docs/images/ReadThroughput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/ReadThroughput.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "kube-prometheus"] 2 | path = kube-prometheus 3 | url = git@github.com:prometheus-operator/kube-prometheus.git -------------------------------------------------------------------------------- /docs/images/ResearchOct2022_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/ResearchOct2022_1.png -------------------------------------------------------------------------------- /docs/images/PerformanceSandBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/PerformanceSandBox.png -------------------------------------------------------------------------------- /docs/images/TransactionLatency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/TransactionLatency.png -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-cc.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | -------------------------------------------------------------------------------- /docs/images/TransactionThroughput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/TransactionThroughput.png -------------------------------------------------------------------------------- /SUT/fabric/chaincode/nftsample/connection.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "org1-cc-nftsample:9999", 3 | "dial_timeout": "10s", 4 | "tls_required": false 5 | } -------------------------------------------------------------------------------- /docs/images/PerformanceSandBox(2022May).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-labs/PerformanceSandBox/HEAD/docs/images/PerformanceSandBox(2022May).png -------------------------------------------------------------------------------- /SUT/fabric/chaincode/asset-transfer-basic-debug/connection.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "host.docker.internal:9999", 3 | "dial_timeout": "10s", 4 | "tls_required": false 5 | } 6 | -------------------------------------------------------------------------------- /SUT/fabric/chaincode/asset-transfer-basic/connection.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "org1-cc-asset-transfer-basic:9999", 3 | "dial_timeout": "10s", 4 | "tls_required": false 5 | } -------------------------------------------------------------------------------- /docs/locale/zh_CN/Traffic.md: -------------------------------------------------------------------------------- 1 | # 目前只支持 Hyperledger Fabric 2 | 3 | ## 用法 4 | ```shell 5 | cd ./Traffic/fabric 6 | ./tape.sh 7 | ``` 8 | 9 | ## 待办事项/待定: 10 | - [ ] caliper 11 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Maintainers 2 | 3 | ### Active Maintainers 4 | | name | Github | Discord | 5 | |-------------------|-----------|----------------| 6 | | Sam Yuan | [@SamYuan1990](https://github.com/SamYuan1990) | n/A | -------------------------------------------------------------------------------- /docs/locale/zh_CN/dashboard.md: -------------------------------------------------------------------------------- 1 | # 到目前为止只支持 Hyperledger Fabric 2 | 3 | ## 用法 4 | - 您可以在 `./dashboard/fabric/HLF_GrafanaDashBoard` 下从 json 文件导入三个仪表板(参考:https://github.com/SamYuan1990/HLF_GrafanaDashBoard) 5 | 6 | ## 待办事项/待定: 7 | - [ ] 在当前仪表板上添加更多指标。 8 | - [ ] 将仪表板发布到 grafana 空间并支持从 grafana 下载。 9 | -------------------------------------------------------------------------------- /kube/jaeger/deploy/role_binding.yaml: -------------------------------------------------------------------------------- 1 | kind: RoleBinding 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | name: jaeger-operator 5 | subjects: 6 | - kind: ServiceAccount 7 | name: jaeger-operator 8 | roleRef: 9 | kind: Role 10 | name: jaeger-operator 11 | apiGroup: rbac.authorization.k8s.io 12 | -------------------------------------------------------------------------------- /docs/dashboard.md: -------------------------------------------------------------------------------- 1 | # So far just supports for Hyperledger Fabric 2 | 3 | ## Usage 4 | - You are able to import three dash boards from json files, under `./dashboard/fabric/` 5 | 6 | ## ToDo/TBD: 7 | - [ ] adding more metrics on current dashboards. 8 | - [ ] publish dashboard to grafana space and supports for download from grafana. -------------------------------------------------------------------------------- /SUT/fabric/chaincode/nftsamplecode/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/msalimbene/hlp-721 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/hyperledger/fabric-chaincode-go v0.0.0-20200424173110-d7076418f212 7 | github.com/hyperledger/fabric-contract-api-go v1.1.1 8 | github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e 9 | github.com/stretchr/testify v1.5.1 10 | ) 11 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Main 2 | 3 | on: push 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v2 11 | - name: Release 12 | uses: softprops/action-gh-release@v1 13 | if: startsWith(github.ref, 'refs/tags/') 14 | with: 15 | generate_release_notes: true -------------------------------------------------------------------------------- /docs/Traffic.md: -------------------------------------------------------------------------------- 1 | # So far just supports for Hyperledger Fabric 2 | 3 | ## Usage 4 | You may need to go to Tape to see details about usage. 5 | For basic asset, we have sample config as 6 | ```shell 7 | cd ./Traffic/fabric 8 | ./tape.sh 9 | ``` 10 | For NFT, we have sample config as 11 | ```shell 12 | cd ./Traffic/fabric 13 | ./tape.sh NFT 14 | ``` 15 | 16 | ## ToDo/TBD: 17 | - [ ] Caliper -------------------------------------------------------------------------------- /SUT/fabric/kube/pvc-fabric-org0.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolumeClaim 9 | metadata: 10 | name: fabric-org0 11 | spec: 12 | volumeName: fabric-org0 13 | storageClassName: standard 14 | accessModes: 15 | - ReadWriteOnce 16 | resources: 17 | requests: 18 | storage: 1Gi 19 | -------------------------------------------------------------------------------- /SUT/fabric/kube/pvc-fabric-org1.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolumeClaim 9 | metadata: 10 | name: fabric-org1 11 | spec: 12 | volumeName: fabric-org1 13 | storageClassName: standard 14 | accessModes: 15 | - ReadWriteOnce 16 | resources: 17 | requests: 18 | storage: 1Gi 19 | -------------------------------------------------------------------------------- /SUT/fabric/kube/pvc-fabric-org2.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolumeClaim 9 | metadata: 10 | name: fabric-org2 11 | spec: 12 | volumeName: fabric-org2 13 | storageClassName: standard 14 | accessModes: 15 | - ReadWriteOnce 16 | resources: 17 | requests: 18 | storage: 1Gi 19 | -------------------------------------------------------------------------------- /SUT/fabric/kube/pv-fabric-org0.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolume 9 | metadata: 10 | name: fabric-org0 11 | spec: 12 | storageClassName: standard 13 | accessModes: 14 | - ReadWriteOnce 15 | capacity: 16 | storage: 2Gi 17 | hostPath: 18 | path: /var/hyperledger/example.com 19 | -------------------------------------------------------------------------------- /SUT/fabric/kube/pv-fabric-org1.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolume 9 | metadata: 10 | name: fabric-org1 11 | spec: 12 | storageClassName: standard 13 | accessModes: 14 | - ReadWriteOnce 15 | capacity: 16 | storage: 2Gi 17 | hostPath: 18 | path: /var/hyperledger/org1.example.com 19 | -------------------------------------------------------------------------------- /SUT/fabric/kube/pv-fabric-org2.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolume 9 | metadata: 10 | name: fabric-org2 11 | spec: 12 | storageClassName: standard 13 | accessModes: 14 | - ReadWriteOnce 15 | capacity: 16 | storage: 2Gi 17 | hostPath: 18 | path: /var/hyperledger/org2.example.com 19 | -------------------------------------------------------------------------------- /kube/jaeger/deploy/cluster_role_binding.yaml: -------------------------------------------------------------------------------- 1 | kind: ClusterRoleBinding 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | name: jaeger-operator 5 | subjects: 6 | - kind: ServiceAccount 7 | name: jaeger-operator 8 | namespace: "observability" # change to point to the namespace you installed your operator 9 | roleRef: 10 | kind: ClusterRole 11 | name: jaeger-operator 12 | apiGroup: rbac.authorization.k8s.io 13 | -------------------------------------------------------------------------------- /docs/ResearchOut.md: -------------------------------------------------------------------------------- 1 | # Here recording the foundings with Performance Sandbox 2 | 3 | The branch used for packaging fabric peer is [here](https://github.com/SamYuan1990/fabric/tree/jeagar2022Oct) 4 | 5 | ![Show Latency for specific tx](./images/ResearchOct2022_1.png "Show Latency for specific tx") 6 | 7 | From jeager, we can see it seems the `ValidateAndPrepare` and `Commit` function in `core/ledger/kvledger/txmgmt/txmgr/lockbased_txmgr.go` 8 | -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | repository: 6 | name: PerformanceSandBox 7 | description: Sandbox for Hyperledger Projects Performance research usage 8 | default_branch: main 9 | has_downloads: false 10 | has_issues: true 11 | has_projects: false 12 | has_wiki: false 13 | archived: true 14 | private: false 15 | allow_squash_merge: true 16 | allow_merge_commit: false 17 | allow_rebase_merge: true -------------------------------------------------------------------------------- /SUT/fabric/chaincode/nftsamplecode/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | ARG GO_VER=1.14.4 6 | ARG ALPINE_VER=3.12 7 | 8 | FROM golang:${GO_VER}-alpine${ALPINE_VER} 9 | 10 | # ENV GOPROXY=https://goproxy.cn,direct 11 | WORKDIR /go/src/github.com/msalimbene/hlp-721 12 | COPY . . 13 | 14 | RUN go get -d -v ./... 15 | RUN go install -v ./... 16 | 17 | EXPOSE 9999 18 | CMD ["hlp-721"] 19 | -------------------------------------------------------------------------------- /docs/App.md: -------------------------------------------------------------------------------- 1 | # So far just supports for Hyperledger Fabric 2 | 3 | ## Usage 4 | ```shell 5 | cd ./App/fabric 6 | ./app.sh 7 | ``` 8 | 9 | then 10 | ```shell 11 | kubectl port-forward svc/fabric-rest-sample 3001:3000 12 | ``` 13 | 14 | ```shell 15 | curl --include --header "Content-Type: application/json" --header "X-Api-Key: 97834158-3224-4CE7-95F9-A148C886653E" http://localhost:3001/api/assets/5 16 | ``` 17 | 18 | ## Jmeter 19 | after port-forward, you are able to download jmeter and run jmeter test with sample at `App/fabric/jmeter/HTTPRequest.jmx` -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | 13 | 14 | **Describe the bug** 15 | A clear and concise description of what the bug is. 16 | 17 | **To Reproduce** 18 | Steps to reproduce the behavior: 19 | 1. 20 | 2. 21 | 3. 22 | 23 | **Expected behavior** 24 | 25 | **Logs** 26 | 27 | **Additional context** 28 | Add any other context about the problem here. 29 | -------------------------------------------------------------------------------- /SUT/fabric/chaincode/nftsamplecode/erc721.go: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | // Define structs to be used by chaincode 8 | type Nft struct { 9 | TokenId string `json:"tokenId"` 10 | Owner string `json:"owner"` 11 | TokenURI string `json:"tokenURI"` 12 | Approved string `json:"approved"` 13 | } 14 | 15 | type Approval struct { 16 | Owner string `json:"owner"` 17 | Operator string `json:"operator"` 18 | Approved bool `json:"approved"` 19 | } 20 | 21 | type Transfer struct { 22 | From string `json:"from"` 23 | To string `json:"to"` 24 | TokenId string `json:"tokenId"` 25 | } 26 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-peer1-couchdb.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: Service 9 | metadata: 10 | name: org1peer1couchdb 11 | spec: 12 | selector: 13 | app: org1peer1couchdb 14 | ports: 15 | - name: couchport 16 | port: 5984 17 | targetPort: 5984 18 | --- 19 | apiVersion: apps/v1 20 | kind: Deployment 21 | metadata: 22 | name: org1peer1couchdb 23 | spec: 24 | replicas: 1 25 | selector: 26 | matchLabels: 27 | app: org1peer1couchdb 28 | template: 29 | metadata: 30 | labels: 31 | app: org1peer1couchdb 32 | spec: 33 | containers: 34 | - name: couchdb 35 | image: couchdb:3 36 | imagePullPolicy: IfNotPresent 37 | env: 38 | - name: "COUCHDB_USER" 39 | value: "admin" 40 | - name: "COUCHDB_PASSWORD" 41 | value: "adminpw" 42 | ports: 43 | - containerPort: 5984 -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-peer2-couchdb.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: Service 9 | metadata: 10 | name: org1peer2couchdb 11 | spec: 12 | selector: 13 | app: org1peer2couchdb 14 | ports: 15 | - name: couchport 16 | port: 5984 17 | targetPort: 5984 18 | --- 19 | apiVersion: apps/v1 20 | kind: Deployment 21 | metadata: 22 | name: org1peer2couchdb 23 | spec: 24 | replicas: 1 25 | selector: 26 | matchLabels: 27 | app: org1peer2couchdb 28 | template: 29 | metadata: 30 | labels: 31 | app: org1peer2couchdb 32 | spec: 33 | containers: 34 | - name: couchdb 35 | image: couchdb:3 36 | imagePullPolicy: IfNotPresent 37 | env: 38 | - name: "COUCHDB_USER" 39 | value: "admin" 40 | - name: "COUCHDB_PASSWORD" 41 | value: "adminpw" 42 | ports: 43 | - containerPort: 5984 -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-peer1-couchdb.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: Service 9 | metadata: 10 | name: org2peer1couchdb 11 | spec: 12 | selector: 13 | app: org2peer1couchdb 14 | ports: 15 | - name: couchport 16 | port: 5984 17 | targetPort: 5984 18 | --- 19 | apiVersion: apps/v1 20 | kind: Deployment 21 | metadata: 22 | name: org2peer1couchdb 23 | spec: 24 | replicas: 1 25 | selector: 26 | matchLabels: 27 | app: org2peer1couchdb 28 | template: 29 | metadata: 30 | labels: 31 | app: org2peer1couchdb 32 | spec: 33 | containers: 34 | - name: couchdb 35 | image: couchdb:3 36 | imagePullPolicy: IfNotPresent 37 | env: 38 | - name: "COUCHDB_USER" 39 | value: "admin" 40 | - name: "COUCHDB_PASSWORD" 41 | value: "adminpw" 42 | ports: 43 | - containerPort: 5984 -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-peer2-couchdb.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: Service 9 | metadata: 10 | name: org2peer2couchdb 11 | spec: 12 | selector: 13 | app: org2peer2couchdb 14 | ports: 15 | - name: couchport 16 | port: 5984 17 | targetPort: 5984 18 | --- 19 | apiVersion: apps/v1 20 | kind: Deployment 21 | metadata: 22 | name: org2peer2couchdb 23 | spec: 24 | replicas: 1 25 | selector: 26 | matchLabels: 27 | app: org2peer2couchdb 28 | template: 29 | metadata: 30 | labels: 31 | app: org2peer2couchdb 32 | spec: 33 | containers: 34 | - name: couchdb 35 | image: couchdb:3 36 | imagePullPolicy: IfNotPresent 37 | env: 38 | - name: "COUCHDB_USER" 39 | value: "admin" 40 | - name: "COUCHDB_PASSWORD" 41 | value: "adminpw" 42 | ports: 43 | - containerPort: 5984 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new_feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: New Feature 3 | about: Request a new feature request 4 | title: '' 5 | labels: Feature 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Is your proposal related to a problem? 11 | 12 | 16 | 17 | (Write your answer here.) 18 | 19 | ### Describe the solution you'd like 20 | 21 | 28 | 29 | (Describe your proposed solution here.) 30 | 31 | ### Describe alternatives you've considered 32 | 33 | 36 | 37 | (Write your answer here.) 38 | 39 | ### Additional context 40 | 41 | 45 | 46 | (Write your answer here.) 47 | -------------------------------------------------------------------------------- /Traffic/fabric/scripts/tapetemplateNFT: -------------------------------------------------------------------------------- 1 | # Definition of nodes 2 | peer1: &peer1 3 | addr: org1-peer1:7051 4 | org: org1 5 | tls_ca_cert: /tmp/org1-tls-ca.pem 6 | 7 | peer2: &peer2 8 | addr: org2-peer1:7051 9 | org: org2 10 | tls_ca_cert: /tmp/org2-tls-ca.pem 11 | 12 | orderer1: &orderer1 13 | addr: org0-orderer1:6050 14 | org: org0 15 | tls_ca_cert: /tmp/org0-tls-ca.pem 16 | 17 | policyFile: /tmp/Logic.rego 18 | 19 | # Nodes to interact with 20 | endorsers: 21 | - *peer1 22 | # - *peer2 23 | # we might support multi-committer in the future for more complex test scenario, 24 | # i.e. consider tx committed only if it's done on >50% of nodes. But for now, 25 | # it seems sufficient to support single committer. 26 | committers: 27 | - *peer1 28 | # - *peer2 29 | 30 | commitThreshold: 1 31 | 32 | orderer: *orderer1 33 | 34 | # Invocation configs 35 | channel: mychannel 36 | chaincode: nftsample 37 | args: 38 | - MintWithTokenURI 39 | - randomString8 40 | - randomString8 41 | mspid: Org1MSP 42 | private_key: /tmp/HLF_PRIVATE_KEY_ORG1 43 | sign_cert: /tmp/HLF_CERTIFICATE_ORG1 44 | num_of_conn: 10 45 | client_per_conn: 10 46 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-cc-template.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org1-cc-{{CHAINCODE_NAME}} 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org1-cc-{{CHAINCODE_NAME}} 16 | template: 17 | metadata: 18 | labels: 19 | app: org1-cc-{{CHAINCODE_NAME}} 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{CHAINCODE_IMAGE}} 24 | imagePullPolicy: IfNotPresent 25 | env: 26 | - name: CHAINCODE_SERVER_ADDRESS 27 | value: 0.0.0.0:9999 28 | 29 | # todo: load with an envFrom and a dynamic config map with the ID. 30 | - name: CHAINCODE_ID 31 | value: {{CHAINCODE_ID}} 32 | ports: 33 | - containerPort: 9999 34 | 35 | --- 36 | apiVersion: v1 37 | kind: Service 38 | metadata: 39 | name: org1-cc-{{CHAINCODE_NAME}} 40 | spec: 41 | ports: 42 | - name: chaincode 43 | port: 9999 44 | protocol: TCP 45 | selector: 46 | app: org1-cc-{{CHAINCODE_NAME}} -------------------------------------------------------------------------------- /Traffic/fabric/scripts/tapetemplate: -------------------------------------------------------------------------------- 1 | # Definition of nodes 2 | peer1: &peer1 3 | addr: org1-peer1:7051 4 | org: org1 5 | tls_ca_cert: /tmp/org1-tls-ca.pem 6 | 7 | peer2: &peer2 8 | addr: org2-peer1:7051 9 | org: org2 10 | tls_ca_cert: /tmp/org2-tls-ca.pem 11 | 12 | orderer1: &orderer1 13 | addr: org0-orderer1:6050 14 | org: org0 15 | tls_ca_cert: /tmp/org0-tls-ca.pem 16 | 17 | policyFile: /tmp/Logic.rego 18 | 19 | # Nodes to interact with 20 | endorsers: 21 | - *peer1 22 | # - *peer2 23 | # we might support multi-committer in the future for more complex test scenario, 24 | # i.e. consider tx committed only if it's done on >50% of nodes. But for now, 25 | # it seems sufficient to support single committer. 26 | committers: 27 | - *peer1 28 | # - *peer2 29 | 30 | commitThreshold: 1 31 | 32 | orderer: *orderer1 33 | 34 | # Invocation configs 35 | channel: mychannel 36 | chaincode: asset-transfer-basic 37 | args: 38 | - CreateAsset 39 | - uuid 40 | - randomString8 41 | - randomNumber0_50 42 | - randomString8 43 | - randomNumber0_50 44 | mspid: Org1MSP 45 | private_key: /tmp/HLF_PRIVATE_KEY_ORG1 46 | sign_cert: /tmp/HLF_CERTIFICATE_ORG1 47 | num_of_conn: 10 48 | client_per_conn: 10 49 | -------------------------------------------------------------------------------- /kube/jaeger/deploy/operator.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: jaeger-operator 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | name: jaeger-operator 10 | template: 11 | metadata: 12 | labels: 13 | name: jaeger-operator 14 | spec: 15 | serviceAccountName: jaeger-operator 16 | containers: 17 | - name: jaeger-operator 18 | image: jaegertracing/jaeger-operator:1.27.0 19 | ports: 20 | - containerPort: 8383 21 | name: http-metrics 22 | - containerPort: 8686 23 | name: cr-metrics 24 | args: ["start"] 25 | resources: 26 | limits: 27 | cpu: 500m 28 | memory: 512Mi 29 | requests: 30 | cpu: 100m 31 | memory: 128Mi 32 | env: 33 | - name: WATCH_NAMESPACE 34 | value: "default" 35 | - name: POD_NAME 36 | valueFrom: 37 | fieldRef: 38 | fieldPath: metadata.name 39 | - name: POD_NAMESPACE 40 | valueFrom: 41 | fieldRef: 42 | fieldPath: metadata.namespace 43 | - name: OPERATOR_NAME 44 | value: "jaeger-operator" 45 | -------------------------------------------------------------------------------- /docs/metrics/ReadThroughput.md: -------------------------------------------------------------------------------- 1 | # Read Throughput 2 | 3 | ## Prerequisites 4 | Read Throughput for Hyperledger Fabric, is a measure of how many read operations are completed in a defined time period, expressed as reads per second (RPS). This metric may be informative, but it is not the primary measure of blockchain performance. In fact, systems will typically be deployed adjacent to the blockchain to facilitate significant reading and queries. 5 | - It can be specific on peer node base on chaincode. 6 | - It can be calculated for endorsement phase only? 7 | 8 | ref to https://www.hyperledger.org/learn/publications/blockchain-performance-metrics 9 | 10 | > Read Throughput = Total read operations / total time in seconds 11 | 12 | ## For specific channel 13 | We are able to find from grafana dashboard as figure below. 14 | 15 | ![Show Read Throughput for specific channel](../images/ReadThroughput.png "Show Read Throughput for specific channel") 16 | 17 | In this sample figure, we displayed the data for chaincode exectuion and endorsement in successfully case. Means we don't have an endorsement failure during the time. 18 | In a real life case, you should be carefull for any endorsement failure or chaincode exectuion failure. The data been displayed in rate of time. -------------------------------------------------------------------------------- /App/fabric/scripts/ccp-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-network-org${ORG}", 3 | "version": "1.0.0", 4 | "client": { 5 | "organization": "Org${ORG}", 6 | "connection": { 7 | "timeout": { 8 | "peer": { 9 | "endorser": "300" 10 | } 11 | } 12 | } 13 | }, 14 | "organizations": { 15 | "Org${ORG}": { 16 | "mspid": "Org${ORG}MSP", 17 | "peers": [ 18 | "org${ORG}-peers" 19 | ], 20 | "certificateAuthorities": [ 21 | "org${ORG}-ecert-ca" 22 | ] 23 | } 24 | }, 25 | "peers": { 26 | "org${ORG}-peers": { 27 | "url": "grpcs://org${ORG}-peer1:7051", 28 | "tlsCACerts": { 29 | "pem": "${PEERPEM}" 30 | } 31 | } 32 | }, 33 | "certificateAuthorities": { 34 | "org${ORG}-ca": { 35 | "url": "https://org${ORG}-ecert-ca", 36 | "caName": "org${ORG}-ecert-ca", 37 | "tlsCACerts": { 38 | "pem": ["${CAPEM}"] 39 | }, 40 | "httpOptions": { 41 | "verify": false 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SUT/fabric/kube/job-scrub-fabric-volumes.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: batch/v1 8 | kind: Job 9 | metadata: 10 | name: job-scrub-fabric-volumes 11 | spec: 12 | backoffLimit: 0 13 | completions: 1 14 | template: 15 | metadata: 16 | name: job-scrub-fabric-volumes 17 | spec: 18 | restartPolicy: "Never" 19 | containers: 20 | - name: main 21 | image: busybox:latest 22 | command: 23 | - sh 24 | - -c 25 | - "rm -rvf /mnt/fabric-*/*" 26 | volumeMounts: 27 | - name: fabric-org0-volume 28 | mountPath: /mnt/fabric-org0 29 | - name: fabric-org1-volume 30 | mountPath: /mnt/fabric-org1 31 | - name: fabric-org2-volume 32 | mountPath: /mnt/fabric-org2 33 | volumes: 34 | - name: fabric-org0-volume 35 | persistentVolumeClaim: 36 | claimName: fabric-org0 37 | - name: fabric-org1-volume 38 | persistentVolumeClaim: 39 | claimName: fabric-org1 40 | - name: fabric-org2-volume 41 | persistentVolumeClaim: 42 | claimName: fabric-org2 43 | 44 | -------------------------------------------------------------------------------- /docs/metrics/TransactionThroughput.md: -------------------------------------------------------------------------------- 1 | # Transaction Throughput 2 | 3 | ## Prerequisites 4 | Transaction throughput for Hyperledger Fabric, is the rate at which valid transactions are committed by the peers in a defined time period. 5 | Note that this is not the rate at a single node, but across the entire SUT, i.e. committed at all nodes of the network. This rate is expressed as transactions per second (TPS) at a network size. 6 | So which means, at least, peers from each organization participate in specific channel as the block broadcasting. 7 | 8 | ref to https://www.hyperledger.org/learn/publications/blockchain-performance-metrics 9 | 10 | > Transaction Throughput = Total committed transactions / total time in seconds @ #committed nodes 11 | 12 | ## For specific channel 13 | We are able to find from grafana dashboard as figure below. 14 | 15 | ![Show Transaction Throughput for specific channel](../images/TransactionThroughput.png "Show Transaction Throughput for specific channel") 16 | 17 | In the test data with about 10k tx, in 1k block.(as 10 txs in one block following configuration.) 18 | We can find the ledger blockchain heigth rate as block heigth/time(as rate) and among the duration in time zone. Some how it shows the throughput for transactions base on block heighet. Or we are able to use transactions in specific channel. As Business transcation per channel, chaincode shows. How the transcations increase during the time. -------------------------------------------------------------------------------- /docs/metrics/ReadLatency.md: -------------------------------------------------------------------------------- 1 | # Read Latency 2 | 3 | ## Prerequisites 4 | Read operations for Hyperledger Fabric, almost query or endorsement phase for a specific tx as: 5 | - There is no change to state. 6 | - Fetching data in the process of validating transactions. 7 | - From external system. 8 | - No caching is considered for a "pure" read. 9 | 10 | ref to https://www.hyperledger.org/learn/publications/blockchain-performance-metrics 11 | 12 | > Read Latency = Time when response received – submit time 13 | 14 | > Read latency is the time between when the read request is submitted and when the reply is received. 15 | 16 | ## For specific tx 17 | We are able to see read from jaeger UI as figure below: 18 | 19 | ![Show Read Latency for specific tx](../images/ReadLatency.png "Show Read Latency for specific tx") 20 | 21 | Here we see the read request sending from Tape and finally responsed from Peer. 22 | In general, once we decided which data to be query on fabric network. 23 | 1. We are going to sign the proposal by private key in wallet locally. 24 | 1. Then send to peers among fabric network for query. 25 | 1. And the endorsement will running on each peer. 26 | 1. Once the proposals been responsed from peers, some time we need additional check for as result from peers should be same. 27 | 28 | ## For P99 29 | We are able to find P99 for this metric by grafana and sample as Tape implementation 30 | ![Show 9PP Read Latency from Tape](../images/TapeLatency.png "Show 9PP Read Latency from Tape") -------------------------------------------------------------------------------- /Traffic/fabric/kube/fabric-tape-sample.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: tape 5 | annotations: 6 | "sidecar.jaegertracing.io/inject": "true" 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: tape 12 | template: 13 | metadata: 14 | labels: 15 | app: tape 16 | spec: 17 | containers: 18 | - name: tape 19 | image: ghcr.io/hyperledger-twgc/tape 20 | imagePullPolicy: IfNotPresent 21 | ports: 22 | - containerPort: 8080 23 | env: 24 | - name: TAPE_LOGLEVEL 25 | value: debug 26 | command: 27 | - tape 28 | # - "endorsementOnly" for endorsement only mode for query 29 | #- "--help" 30 | - "-c" 31 | - "/tmp/tapeconfig.yaml" 32 | - "-n" 33 | - "500" 34 | - "--prometheus" 35 | imagePullPolicy: IfNotPresent 36 | volumeMounts: 37 | - name: configmap-volume 38 | mountPath: /tmp 39 | volumes: 40 | - name: configmap-volume 41 | configMap: 42 | name: fabric-tape-sample-config 43 | #restartPolicy: Always 44 | 45 | --- 46 | apiVersion: v1 47 | kind: Service 48 | metadata: 49 | name: tape 50 | labels: 51 | app: tape 52 | spec: 53 | ports: 54 | - name: metrics 55 | port: 8080 56 | protocol: TCP 57 | selector: 58 | app: tape 59 | 60 | --- 61 | apiVersion: monitoring.coreos.com/v1 62 | kind: ServiceMonitor 63 | metadata: 64 | name: tape 65 | namespace: default 66 | labels: 67 | release: mypro #Prometheus所选择的标签 68 | spec: 69 | namespaceSelector: #监控的pod所在名称空间 70 | matchNames: 71 | - default 72 | selector: 73 | matchLabels: 74 | app: tape 75 | endpoints: 76 | - port: metrics -------------------------------------------------------------------------------- /docs/metrics/TransactionLatency.md: -------------------------------------------------------------------------------- 1 | # Transaction Latency 2 | 3 | ## Prerequisites 4 | Write operations for Hyperledger Fabric, almost a commit for a specific tx as: 5 | - It's a network-wide. 6 | - Includes the propagation time and any settling time due to the consensus mechanism in place. 7 | - A block is considered the record of committed transactions, and those transactions are committed when the block has been circulated through the network and applied by all nodes. 8 | 9 | ref to https://www.hyperledger.org/learn/publications/blockchain-performance-metrics 10 | 11 | > Transaction Latency = (Confirmation time @ network threshold) – submit time 12 | 13 | ## For specific tx 14 | We are able to see read from jaeger UI as figure below: 15 | 16 | ![Show Transaction Latency for specific tx](../images/TransactionLatency.png "Show Transaction Latency for specific tx") 17 | 18 | Here we see the transaction request sending from Tape and finally responsed from Fabric network. 19 | In general, once we decided which data to be query on fabric network, according to fabric traffic workflow, it 20 | 1. includes an endorsement phase for the transaction, similar with read atency. 21 | 1. then the envelopes been send to orderer nodes for consensus. 22 | 1. once consensus been completed, fabric orderer will notice the block to fabric peer nodes and at peer nodes start a commit process. 23 | 1. once commit process is completed, then client as tape will received the response for the tx request been send. 24 | 25 | > note: In sample above, we works in a synchronization way, and for endorsement and commit threshold/network threshold, we use a single peer as sample. 26 | 27 | ## For P99 28 | We are able to find P99 for this metric by grafana and sample as Tape implementation 29 | ![Show 9PP Read Latency from Tape](../images/TapeLatency.png "Show 9PP Read Latency from Tape") -------------------------------------------------------------------------------- /SUT/fabric/kube/org0/org0-admin-cli.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org0-admin-cli 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org0-admin-cli 16 | template: 17 | metadata: 18 | labels: 19 | app: org0-admin-cli 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-tools:{{FABRIC_VERSION}} 24 | imagePullPolicy: IfNotPresent 25 | env: 26 | - name: FABRIC_CFG_PATH 27 | value: /var/hyperledger/fabric/config 28 | args: 29 | - sleep 30 | - "2147483647" 31 | workingDir: /root 32 | volumeMounts: 33 | - name: fabric-volume 34 | mountPath: /var/hyperledger 35 | - name: fabric-config 36 | mountPath: /var/hyperledger/fabric/config 37 | 38 | # This init container will unfurl all of the MSP archives listed in the msp-config config map. 39 | initContainers: 40 | - name: msp-unfurl 41 | image: busybox 42 | command: 43 | - sh 44 | - -c 45 | - "for msp in $(ls /msp/msp-*.tgz); do echo $msp && tar zxvf $msp -C /var/hyperledger/fabric; done" 46 | volumeMounts: 47 | - name: msp-config 48 | mountPath: /msp 49 | - name: fabric-volume 50 | mountPath: /var/hyperledger 51 | 52 | volumes: 53 | - name: fabric-volume 54 | persistentVolumeClaim: 55 | claimName: fabric-org0 56 | - name: fabric-config 57 | configMap: 58 | name: org0-config 59 | - name: msp-config 60 | configMap: 61 | name: msp-config 62 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org0/org0-tls-ca.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org0-tls-ca 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org0-tls-ca 16 | template: 17 | metadata: 18 | labels: 19 | app: org0-tls-ca 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-ca:{{FABRIC_CA_VERSION}} 24 | env: 25 | - name: FABRIC_CA_SERVER_CA_NAME 26 | value: "org0-tls-ca" 27 | - name: FABRIC_CA_SERVER_DEBUG 28 | value: "false" 29 | - name: FABRIC_CA_SERVER_HOME 30 | value: "/var/hyperledger/fabric-tls-ca-server" 31 | - name: FABRIC_CA_CLIENT_HOME 32 | value: "/var/hyperledger/fabric-ca-client" 33 | ports: 34 | - containerPort: 443 35 | volumeMounts: 36 | - name: fabric-volume 37 | mountPath: /var/hyperledger 38 | - name: fabric-config 39 | mountPath: /var/hyperledger/fabric-tls-ca-server/fabric-ca-server-config.yaml 40 | subPath: fabric-tls-ca-server-config.yaml 41 | readinessProbe: 42 | tcpSocket: 43 | port: 443 44 | initialDelaySeconds: 2 45 | periodSeconds: 5 46 | volumes: 47 | - name: fabric-volume 48 | persistentVolumeClaim: 49 | claimName: fabric-org0 50 | - name: fabric-config 51 | configMap: 52 | name: org0-config 53 | 54 | --- 55 | apiVersion: v1 56 | kind: Service 57 | metadata: 58 | name: org0-tls-ca 59 | spec: 60 | ports: 61 | - name: tls 62 | port: 443 63 | protocol: TCP 64 | selector: 65 | app: org0-tls-ca -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-tls-ca.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org1-tls-ca 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org1-tls-ca 16 | template: 17 | metadata: 18 | labels: 19 | app: org1-tls-ca 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-ca:{{FABRIC_CA_VERSION}} 24 | env: 25 | - name: FABRIC_CA_SERVER_CA_NAME 26 | value: "org1-tls-ca" 27 | - name: FABRIC_CA_SERVER_DEBUG 28 | value: "false" 29 | - name: FABRIC_CA_SERVER_HOME 30 | value: "/var/hyperledger/fabric-tls-ca-server" 31 | - name: FABRIC_CA_CLIENT_HOME 32 | value: "/var/hyperledger/fabric-ca-client" 33 | ports: 34 | - containerPort: 443 35 | volumeMounts: 36 | - name: fabric-volume 37 | mountPath: /var/hyperledger 38 | - name: fabric-config 39 | mountPath: /var/hyperledger/fabric-tls-ca-server/fabric-ca-server-config.yaml 40 | subPath: fabric-tls-ca-server-config.yaml 41 | readinessProbe: 42 | tcpSocket: 43 | port: 443 44 | initialDelaySeconds: 2 45 | periodSeconds: 5 46 | volumes: 47 | - name: fabric-volume 48 | persistentVolumeClaim: 49 | claimName: fabric-org1 50 | - name: fabric-config 51 | configMap: 52 | name: org1-config 53 | 54 | --- 55 | apiVersion: v1 56 | kind: Service 57 | metadata: 58 | name: org1-tls-ca 59 | spec: 60 | ports: 61 | - name: tls 62 | port: 443 63 | protocol: TCP 64 | selector: 65 | app: org1-tls-ca -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-tls-ca.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org2-tls-ca 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org2-tls-ca 16 | template: 17 | metadata: 18 | labels: 19 | app: org2-tls-ca 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-ca:{{FABRIC_CA_VERSION}} 24 | env: 25 | - name: FABRIC_CA_SERVER_CA_NAME 26 | value: "org2-tls-ca" 27 | - name: FABRIC_CA_SERVER_DEBUG 28 | value: "false" 29 | - name: FABRIC_CA_SERVER_HOME 30 | value: "/var/hyperledger/fabric-tls-ca-server" 31 | - name: FABRIC_CA_CLIENT_HOME 32 | value: "/var/hyperledger/fabric-ca-client" 33 | ports: 34 | - containerPort: 443 35 | volumeMounts: 36 | - name: fabric-volume 37 | mountPath: /var/hyperledger 38 | - name: fabric-config 39 | mountPath: /var/hyperledger/fabric-tls-ca-server/fabric-ca-server-config.yaml 40 | subPath: fabric-tls-ca-server-config.yaml 41 | readinessProbe: 42 | tcpSocket: 43 | port: 443 44 | initialDelaySeconds: 2 45 | periodSeconds: 5 46 | volumes: 47 | - name: fabric-volume 48 | persistentVolumeClaim: 49 | claimName: fabric-org2 50 | - name: fabric-config 51 | configMap: 52 | name: org2-config 53 | 54 | --- 55 | apiVersion: v1 56 | kind: Service 57 | metadata: 58 | name: org2-tls-ca 59 | spec: 60 | ports: 61 | - name: tls 62 | port: 443 63 | protocol: TCP 64 | selector: 65 | app: org2-tls-ca -------------------------------------------------------------------------------- /docs/locale/zh_CN/SUT.md: -------------------------------------------------------------------------------- 1 | # 目前只支持 Hyperledger Fabric 2 | 当前样本从 fabric-sample 中的 test-network-k8s 学习 3 | 4 | ## 用法 5 | 启动网络,创建通道,并部署 [basic-asset-transfer](./asset-transfer-basic) 智能合约: 6 | ```shell 7 | cd ./SUT/fabric 8 | ./network.sh up 9 | ./network.sh channel 10 | ./network.sh chaincode deploy 11 | ``` 12 | 13 | 调用和查询链码: 14 | ```shell 15 | cd ./SUT/fabric 16 | ./network.sh chaincode invoke '{"Args":["CreateAsset","5","blue","35","tom","1000"]}' 17 | ./network.sh chaincode query '{"Args":["ReadAsset","5"]}' 18 | ``` 19 | 20 | ## 自定义镜像/自定义image 21 | 所有自定义参数: 22 | ```shell 23 | LOCAL_CONTAINER_REGISTRY=${CONTAINER_REGISTRY:-hyperledger} 24 | FABRIC_CA_VERSION=${TEST_NETWORK_FABRIC_CA_VERSION:-1.5.2} 25 | FABRIC_VERSION=${TEST_NETWORK_FABRIC_VERSION:-2.4} 26 | CHANNEL_NAME=${TEST_NETWORK_CHANNEL_NAME:-mychannel} 27 | CHAINCODE_IMAGE=${TEST_NETWORK_CHAINCODE_IMAGE:-ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic} 28 | CHAINCODE_NAME=${TEST_NETWORK_CHAINCODE_NAME:-asset-transfer-basic} 29 | CHAINCODE_LABEL=${TEST_NETWORK_CHAINCODE_LABEL:-basic_1.0} 30 | ``` 31 | 要使用本地存储库: 32 | ```shell 33 | 导出 CONTAINER_REGISTRY=localhost:5000 34 | ``` 35 | 36 | ## 清理 37 | ```shell 38 | ./network.sh down 39 | ``` 40 | 41 | ## 注意: 42 | 您可能需要重新运行 `./infra.sh jaeger` 和 `./infra.sh portforward` 以在清理后重新启动 jaeger。 43 | 44 | ## 部署集成 45 | 经过与Cello会议讨论。对于任何一种 Hyperledger Fabric 部署工具,例如 Cello(在本章中,我们将其简称为部署工具)。应遵循/检查以下任务以了解 Performance Sandbox 和部署工具之间的集成。 46 | - [ ] 部署工具应该能够支持 k8s 部署。 (这部分可以以文档为指导完成) 47 | - [ ] 我们能够按照“hello world”指南通过部署工具在 k8s 上部署 Hyperledger Fabric。 (这部分可以以文档为指导完成) 48 | - [ ] 部署工具应该能够支持任何类型的 prometheus 和 jaeger 系统。在 PerformanceSandBox 中,我们使用了 prometheus 和 jaeger operator,如果需要,需要进行一些代码更改。 49 | - [ ] 部署工具应该能够支持任何类型的 Hyperledger Fabric 应用程序。例如 Caliper 或 Tape 需要证书、网络信息、链码信息等来向 SUT 发送流量。我们可以按照区块链应用程序的部署工具指南来部署 Caliper 和 Tape。 50 | - [ ] 部署工具应该能够支持镜像升级,并为 Hyperledger Fabric 自定义镜像。 51 | 52 | ## 待办事项/待定: 53 | - [] jeager 操作员问题与端口转发和部署有关。 54 | - [] https://github.com/hyperledger/bevel 55 | - [] https://github.com/hyperledger-labs/minifabric 56 | 57 | - [ ] 其他区块链项目 58 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org0/org0-ecert-ca.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org0-ecert-ca 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org0-ecert-ca 16 | template: 17 | metadata: 18 | labels: 19 | app: org0-ecert-ca 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-ca:{{FABRIC_CA_VERSION}} 24 | env: 25 | - name: FABRIC_CA_SERVER_CA_NAME 26 | value: "org0-ecert-ca" 27 | - name: FABRIC_CA_SERVER_DEBUG 28 | value: "false" 29 | - name: FABRIC_CA_SERVER_HOME 30 | value: "/var/hyperledger/fabric-ca-server" 31 | - name: FABRIC_CA_SERVER_TLS_CERTFILE 32 | value: "/var/hyperledger/fabric-ca-client/tls-ca/rcaadmin/msp/signcerts/cert.pem" 33 | - name: FABRIC_CA_SERVER_TLS_KEYFILE 34 | value: "/var/hyperledger/fabric-ca-client/tls-ca/rcaadmin/msp/keystore/key.pem" 35 | - name: FABRIC_CA_CLIENT_HOME 36 | value: "/var/hyperledger/fabric-ca-client" 37 | ports: 38 | - containerPort: 443 39 | volumeMounts: 40 | - name: fabric-volume 41 | mountPath: /var/hyperledger 42 | - name: fabric-config 43 | mountPath: /var/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml 44 | subPath: fabric-ecert-ca-server-config.yaml 45 | readinessProbe: 46 | tcpSocket: 47 | port: 443 48 | initialDelaySeconds: 2 49 | periodSeconds: 5 50 | volumes: 51 | - name: fabric-volume 52 | persistentVolumeClaim: 53 | claimName: fabric-org0 54 | - name: fabric-config 55 | configMap: 56 | name: org0-config 57 | 58 | --- 59 | apiVersion: v1 60 | kind: Service 61 | metadata: 62 | name: org0-ecert-ca 63 | spec: 64 | ports: 65 | - name: tls 66 | port: 443 67 | protocol: TCP 68 | selector: 69 | app: org0-ecert-ca -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-ecert-ca.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org1-ecert-ca 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org1-ecert-ca 16 | template: 17 | metadata: 18 | labels: 19 | app: org1-ecert-ca 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-ca:{{FABRIC_CA_VERSION}} 24 | env: 25 | - name: FABRIC_CA_SERVER_CA_NAME 26 | value: "org1-ecert-ca" 27 | - name: FABRIC_CA_SERVER_DEBUG 28 | value: "false" 29 | - name: FABRIC_CA_SERVER_HOME 30 | value: "/var/hyperledger/fabric-ca-server" 31 | - name: FABRIC_CA_SERVER_TLS_CERTFILE 32 | value: "/var/hyperledger/fabric-ca-client/tls-ca/rcaadmin/msp/signcerts/cert.pem" 33 | - name: FABRIC_CA_SERVER_TLS_KEYFILE 34 | value: "/var/hyperledger/fabric-ca-client/tls-ca/rcaadmin/msp/keystore/key.pem" 35 | - name: FABRIC_CA_CLIENT_HOME 36 | value: "/var/hyperledger/fabric-ca-client" 37 | ports: 38 | - containerPort: 443 39 | volumeMounts: 40 | - name: fabric-volume 41 | mountPath: /var/hyperledger 42 | - name: fabric-config 43 | mountPath: /var/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml 44 | subPath: fabric-ecert-ca-server-config.yaml 45 | readinessProbe: 46 | tcpSocket: 47 | port: 443 48 | initialDelaySeconds: 2 49 | periodSeconds: 5 50 | volumes: 51 | - name: fabric-volume 52 | persistentVolumeClaim: 53 | claimName: fabric-org1 54 | - name: fabric-config 55 | configMap: 56 | name: org1-config 57 | 58 | --- 59 | apiVersion: v1 60 | kind: Service 61 | metadata: 62 | name: org1-ecert-ca 63 | spec: 64 | ports: 65 | - name: tls 66 | port: 443 67 | protocol: TCP 68 | selector: 69 | app: org1-ecert-ca -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-ecert-ca.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org2-ecert-ca 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org2-ecert-ca 16 | template: 17 | metadata: 18 | labels: 19 | app: org2-ecert-ca 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-ca:{{FABRIC_CA_VERSION}} 24 | env: 25 | - name: FABRIC_CA_SERVER_CA_NAME 26 | value: "org2-ecert-ca" 27 | - name: FABRIC_CA_SERVER_DEBUG 28 | value: "false" 29 | - name: FABRIC_CA_SERVER_HOME 30 | value: "/var/hyperledger/fabric-ca-server" 31 | - name: FABRIC_CA_SERVER_TLS_CERTFILE 32 | value: "/var/hyperledger/fabric-ca-client/tls-ca/rcaadmin/msp/signcerts/cert.pem" 33 | - name: FABRIC_CA_SERVER_TLS_KEYFILE 34 | value: "/var/hyperledger/fabric-ca-client/tls-ca/rcaadmin/msp/keystore/key.pem" 35 | - name: FABRIC_CA_CLIENT_HOME 36 | value: "/var/hyperledger/fabric-ca-client" 37 | ports: 38 | - containerPort: 443 39 | volumeMounts: 40 | - name: fabric-volume 41 | mountPath: /var/hyperledger 42 | - name: fabric-config 43 | mountPath: /var/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml 44 | subPath: fabric-ecert-ca-server-config.yaml 45 | readinessProbe: 46 | tcpSocket: 47 | port: 443 48 | initialDelaySeconds: 2 49 | periodSeconds: 5 50 | volumes: 51 | - name: fabric-volume 52 | persistentVolumeClaim: 53 | claimName: fabric-org2 54 | - name: fabric-config 55 | configMap: 56 | name: org2-config 57 | 58 | --- 59 | apiVersion: v1 60 | kind: Service 61 | metadata: 62 | name: org2-ecert-ca 63 | spec: 64 | ports: 65 | - name: tls 66 | port: 443 67 | protocol: TCP 68 | selector: 69 | app: org2-ecert-ca -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: basicAssetWithTape 2 | on: 3 | pull_request: 4 | 5 | jobs: 6 | basicAssetWithTape: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@main 10 | with: 11 | submodules: true 12 | - uses: actions/setup-go@main 13 | with: 14 | go-version: 1.18 15 | - name: install kind 16 | run: go install sigs.k8s.io/kind@v0.12.0 17 | - name: check version 18 | run: kind version 19 | - name: install kubectl 20 | run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 21 | - name: check version 22 | run: kubectl version || true 23 | - name: infra up 24 | run: ./infra.sh up 25 | - name: infra prometheus 26 | run: ./infra.sh prometheus 27 | - name: infra jaeger 28 | run: ./infra.sh jaeger 29 | - name: sleep as infra ready 30 | run: sleep 60 31 | - name: infra verify 32 | run: ./infra.sh verify 33 | - name: Fabric network up 34 | run: cd ./SUT/fabric && ./network.sh up 35 | - name: sleep as pod ready 36 | run: sleep 60 37 | - name: set up fabric channel 38 | run: cd ./SUT/fabric && ./network.sh channel 39 | - name: set up chaincode pod 40 | run: cd ./SUT/fabric && ./network.sh chaincode deploy 41 | - name: invoke chaincode for test 42 | run: cd ./SUT/fabric && ./network.sh chaincode invoke '{"Args":["CreateAsset","5","blue","35","tom","1000"]}' 43 | - name: query invoke result 44 | run: cd ./SUT/fabric && ./network.sh chaincode query '{"Args":["ReadAsset","5"]}' 45 | - name: run Tape based traffic 46 | run: cd ./Traffic/fabric && ./tape.sh 47 | - name: sleep a while 48 | run: sleep 60 49 | - name: verify pods 50 | run: kubectl get po 51 | - name: save pod status 52 | run: kubectl get po | grep tape > log.out 53 | - name: verify tape 54 | run: kubectl describe po $(cat log.out|awk -F ' ' '{print $1}') 55 | - name: verify tape 56 | run: kubectl logs $(cat log.out|awk -F ' ' '{print $1}') -c tape 57 | - name: cleanup 58 | run: ./infra.sh down 59 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-admin-cli.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org1-admin-cli 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org1-admin-cli 16 | template: 17 | metadata: 18 | labels: 19 | app: org1-admin-cli 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-tools:{{FABRIC_VERSION}} 24 | imagePullPolicy: IfNotPresent 25 | env: 26 | - name: FABRIC_CFG_PATH 27 | value: /var/hyperledger/fabric/config 28 | - name: CORE_PEER_MSPCONFIGPATH 29 | value: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 30 | - name: CORE_PEER_TLS_ROOTCERT_FILE 31 | value: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/msp/tlscacerts/org1-tls-ca.pem 32 | args: 33 | - sleep 34 | - "2147483647" 35 | workingDir: /root 36 | volumeMounts: 37 | - name: fabric-volume 38 | mountPath: /var/hyperledger 39 | - name: fabric-config 40 | mountPath: /var/hyperledger/fabric/config 41 | 42 | # This init container will unfurl all of the MSP archives listed in the msp-config config map. 43 | initContainers: 44 | - name: msp-unfurl 45 | image: busybox 46 | command: 47 | - sh 48 | - -c 49 | - "for msp in $(ls /msp/msp-*.tgz); do echo $msp && tar zxvf $msp -C /var/hyperledger/fabric; done" 50 | volumeMounts: 51 | - name: msp-config 52 | mountPath: /msp 53 | - name: fabric-volume 54 | mountPath: /var/hyperledger 55 | 56 | volumes: 57 | - name: fabric-volume 58 | persistentVolumeClaim: 59 | claimName: fabric-org1 60 | - name: fabric-config 61 | configMap: 62 | name: org1-config 63 | - name: msp-config 64 | configMap: 65 | name: msp-config 66 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-admin-cli.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: apps/v1 8 | kind: Deployment 9 | metadata: 10 | name: org2-admin-cli 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: org2-admin-cli 16 | template: 17 | metadata: 18 | labels: 19 | app: org2-admin-cli 20 | spec: 21 | containers: 22 | - name: main 23 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-tools:{{FABRIC_VERSION}} 24 | imagePullPolicy: IfNotPresent 25 | env: 26 | - name: FABRIC_CFG_PATH 27 | value: /var/hyperledger/fabric/config 28 | - name: CORE_PEER_MSPCONFIGPATH 29 | value: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 30 | - name: CORE_PEER_TLS_ROOTCERT_FILE 31 | value: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/msp/tlscacerts/org2-tls-ca.pem 32 | args: 33 | - sleep 34 | - "2147483647" 35 | workingDir: /root 36 | volumeMounts: 37 | - name: fabric-volume 38 | mountPath: /var/hyperledger 39 | - name: fabric-config 40 | mountPath: /var/hyperledger/fabric/config 41 | 42 | # This init container will unfurl all of the MSP archives listed in the msp-config config map. 43 | initContainers: 44 | - name: msp-unfurl 45 | image: busybox 46 | command: 47 | - sh 48 | - -c 49 | - "for msp in $(ls /msp/msp-*.tgz); do echo $msp && tar zxvf $msp -C /var/hyperledger/fabric; done" 50 | volumeMounts: 51 | - name: msp-config 52 | mountPath: /msp 53 | - name: fabric-volume 54 | mountPath: /var/hyperledger 55 | 56 | volumes: 57 | - name: fabric-volume 58 | persistentVolumeClaim: 59 | claimName: fabric-org2 60 | - name: fabric-config 61 | configMap: 62 | name: org2-config 63 | - name: msp-config 64 | configMap: 65 | name: msp-config 66 | -------------------------------------------------------------------------------- /.github/workflows/NFTSample.yml: -------------------------------------------------------------------------------- 1 | name: bringYourChianCodeAsNFT 2 | on: 3 | pull_request: 4 | 5 | env: 6 | TEST_NETWORK_CHAINCODE_IMAGE: localhost:5000/nftsample:latest 7 | TEST_NETWORK_CHAINCODE_NAME: nftsample 8 | TEST_NETWORK_CHAINCODE_LABEL: nft_1.0 9 | jobs: 10 | bringYourChianCodeAsNFT: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@main 14 | with: 15 | submodules: true 16 | - uses: actions/setup-go@main 17 | with: 18 | go-version: 1.18 19 | - name: install kind 20 | run: go install sigs.k8s.io/kind@v0.12.0 21 | - name: check version 22 | run: kind version 23 | - name: install kubectl 24 | run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 25 | - name: check version 26 | run: kubectl version || true 27 | - name: infra up 28 | run: ./infra.sh up 29 | - name: infra prometheus 30 | run: ./infra.sh prometheus 31 | - name: infra jaeger 32 | run: ./infra.sh jaeger 33 | - name: sleep as infra ready 34 | run: sleep 60 35 | - name: infra verify 36 | run: ./infra.sh verify 37 | - name: Fabric network up 38 | run: cd ./SUT/fabric && ./network.sh up 39 | - name: sleep as pod ready 40 | run: sleep 60 41 | - name: set up fabric channel 42 | run: cd ./SUT/fabric && ./network.sh channel 43 | - name: build NFT image 44 | run: cd ./SUT/fabric && ./network.sh buildchaincode ./chaincode/nftsamplecode 45 | - name: set up chaincode pod 46 | run: cd ./SUT/fabric && ./network.sh chaincode deploy 47 | - name: run Tape based traffic 48 | run: cd ./Traffic/fabric && ./tape.sh NFT 49 | - name: sleep a while 50 | run: sleep 60 51 | - name: verify pods 52 | run: kubectl get po 53 | - name: save pod status 54 | run: kubectl get po | grep tape > log.out 55 | - name: verify tape 56 | run: kubectl describe po $(cat log.out|awk -F ' ' '{print $1}') 57 | - name: verify tape 58 | run: kubectl logs $(cat log.out|awk -F ' ' '{print $1}') -c tape 59 | - name: cleanup 60 | run: ./infra.sh down 61 | -------------------------------------------------------------------------------- /SUT/fabric/network.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | set -o errexit 5 | #set -x 6 | 7 | NS=default 8 | LOCAL_CONTAINER_REGISTRY=${CONTAINER_REGISTRY:-hyperledger} 9 | FABRIC_CA_VERSION=${TEST_NETWORK_FABRIC_CA_VERSION:-1.5.2} 10 | FABRIC_VERSION=${TEST_NETWORK_FABRIC_VERSION:-2.4} 11 | CHANNEL_NAME=${TEST_NETWORK_CHANNEL_NAME:-mychannel} 12 | CHAINCODE_IMAGE=${TEST_NETWORK_CHAINCODE_IMAGE:-ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic} 13 | CHAINCODE_NAME=${TEST_NETWORK_CHAINCODE_NAME:-asset-transfer-basic} 14 | CHAINCODE_LABEL=${TEST_NETWORK_CHAINCODE_LABEL:-basic_1.0} 15 | TLSADMIN_AUTH=tlsadmin:tlsadminpw 16 | RCAADMIN_AUTH=rcaadmin:rcaadminpw 17 | 18 | . ./networkdeploy.sh 19 | . ./channel.sh 20 | . ./chaincode.sh 21 | 22 | function main() { 23 | ## Parse mode 24 | if [[ $# -lt 1 ]] ; then 25 | print_help 26 | exit 0 27 | else 28 | MODE=$1 29 | shift 30 | fi 31 | 32 | if [ "${MODE}" == "up" ]; then 33 | network_up 34 | elif [ "${MODE}" == "down" ]; then 35 | network_down 36 | elif [ "${MODE}" == "verify" ]; then 37 | verify 38 | elif [ "${MODE}" == "channel" ]; then 39 | create_channel 40 | elif [ "${MODE}" == "jaeger" ]; then 41 | jaeger 42 | elif [ "${MODE}" == "buildchaincode" ]; then 43 | buildchaincode $1 44 | elif [ "${MODE}" == "chaincode" ]; then 45 | action=$1 46 | shift 47 | 48 | if [ "${action}" == "deploy" ]; then 49 | chaincode_deploy 50 | elif [ "${action}" == "invoke" ]; then 51 | chaincode_invoke $@ 52 | elif [ "${action}" == "query" ]; then 53 | chaincode_query $@ 54 | else 55 | print_help 56 | fi 57 | else 58 | print_help 59 | exit 1 60 | fi 61 | } 62 | 63 | function print_help() { 64 | echo "./network.sh up for start fabric network" 65 | echo "./network.sh down for clean up" 66 | echo "./network.sh verify for checking all resources in namespace" 67 | echo "./network.sh channel for create channel" 68 | echo "./network.sh chaincode deploy for deploy a chaincode to channel" 69 | echo "./network.sh channel invoke for send a tx" 70 | echo "./network.sh channel query for query data" 71 | echo "./network.sh jaeger for restart jaeger" 72 | } 73 | 74 | function verify() { 75 | kubectl get pv 76 | kubectl get pvc -n $NS 77 | kubectl get po -n $NS 78 | kubectl get svc -n $NS 79 | } 80 | 81 | main $* -------------------------------------------------------------------------------- /.github/workflows/Podman.yml: -------------------------------------------------------------------------------- 1 | name: podman 2 | on: 3 | pull_request: 4 | 5 | jobs: 6 | podman: 7 | runs-on: ubuntu-latest 8 | env: 9 | KIND_EXPERIMENTAL_PROVIDER: podman kind create cluster 10 | steps: 11 | - uses: actions/checkout@main 12 | with: 13 | submodules: true 14 | - uses: actions/setup-go@main 15 | with: 16 | go-version: 1.18 17 | - name: install podman 18 | run: sudo apt-get -y install podman;alias docker=podman 19 | - name: install kind 20 | run: go install sigs.k8s.io/kind@v0.12.0 21 | - name: check version 22 | run: kind version 23 | - name: install kubectl 24 | run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 25 | - name: check version 26 | run: kubectl version || true 27 | - name: infra up 28 | run: alias docker=podman;./infra.sh up 29 | - name: infra prometheus 30 | run: alias docker=podman;./infra.sh prometheus 31 | - name: infra jaeger 32 | run: alias docker=podman;./infra.sh jaeger 33 | - name: sleep as infra ready 34 | run: sleep 60 35 | - name: infra verify 36 | run: alias docker=podman;./infra.sh verify 37 | - name: Fabric network up 38 | run: alias docker=podman;cd ./SUT/fabric && ./network.sh up 39 | - name: sleep as pod ready 40 | run: sleep 60 41 | - name: set up fabric channel 42 | run: alias docker=podman;cd ./SUT/fabric && ./network.sh channel 43 | - name: set up chaincode pod 44 | run: alias docker=podman;cd ./SUT/fabric && ./network.sh chaincode deploy 45 | - name: invoke chaincode for test 46 | run: alias docker=podman;cd ./SUT/fabric && ./network.sh chaincode invoke '{"Args":["CreateAsset","5","blue","35","tom","1000"]}' 47 | - name: query invoke result 48 | run: alias docker=podman;cd ./SUT/fabric && ./network.sh chaincode query '{"Args":["ReadAsset","5"]}' 49 | - name: run Tape based traffic 50 | run: alias docker=podman;cd ./Traffic/fabric && ./tape.sh 51 | - name: sleep a while 52 | run: sleep 60 53 | - name: verify pods 54 | run: kubectl get po 55 | - name: save pod status 56 | run: kubectl get po | grep tape > log.out 57 | - name: verify tape 58 | run: kubectl describe po $(cat log.out|awk -F ' ' '{print $1}') 59 | - name: verify tape 60 | run: kubectl logs $(cat log.out|awk -F ' ' '{print $1}') -c tape 61 | - name: cleanup 62 | run: alias docker=podman;./infra.sh down 63 | -------------------------------------------------------------------------------- /Traffic/fabric/tape.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | set -o errexit 5 | #set -x 6 | 7 | NS=default 8 | 9 | function main() { 10 | #const tape config sample 11 | config_tape_sample $1 12 | #start tape 13 | rollout_tape_sample 14 | } 15 | 16 | function extract_MSP_archives() { 17 | # rm 18 | rm -rf ./build/msp 19 | mkdir -p ./build/msp 20 | 21 | kubectl -n $NS exec deploy/org1-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org1.example.com/msp | tar zxf - -C build/msp 22 | kubectl -n $NS exec deploy/org2-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org2.example.com/msp | tar zxf - -C build/msp 23 | 24 | kubectl -n $NS exec deploy/org0-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/ordererOrganizations/org0.example.com/msp | tar zxf - -C build/msp 25 | 26 | kubectl -n $NS exec deploy/org1-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp | tar zxf - -C build/msp 27 | kubectl -n $NS exec deploy/org2-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp | tar zxf - -C build/msp 28 | } 29 | 30 | function config_tape_sample() { 31 | echo "Starting tape configuration" 32 | # rm 33 | rm -rf ./build/tape 34 | # make dir 35 | mkdir -p ./build/tape 36 | 37 | # construct_rest_sample_configmap 38 | extract_MSP_archives 39 | 40 | cat ./build/msp/organizations/peerOrganizations/org1.example.com/msp/tlscacerts/org1-tls-ca.pem > ./build/tape/org1-tls-ca.pem 41 | cat ./build/msp/organizations/peerOrganizations/org2.example.com/msp/tlscacerts/org2-tls-ca.pem > ./build/tape/org2-tls-ca.pem 42 | cat ./build/msp/organizations/ordererOrganizations/org0.example.com/msp/tlscacerts/org0-tls-ca.pem > ./build/tape/org0-tls-ca.pem 43 | cat ./build/msp/organizations/peerOrganizations/org1.example.com/users/Admin\@org1.example.com/msp/signcerts/cert.pem > ./build/tape/HLF_CERTIFICATE_ORG1 44 | cat ./build/msp/organizations/peerOrganizations/org1.example.com/users/Admin\@org1.example.com/msp/keystore/server.key > ./build/tape/HLF_PRIVATE_KEY_ORG1 45 | # id 46 | # tls cert 47 | # config file 48 | cp ./scripts/tapetemplate ./build/tape/tapeconfig.yaml 49 | 50 | if [ "${1}" == "NFT" ]; then 51 | cp -f ./scripts/tapetemplateNFT ./build/tape/tapeconfig.yaml 52 | fi 53 | cp ./scripts/Logic.rego ./build/tape/Logic.rego 54 | 55 | kubectl -n $NS delete configmap fabric-tape-sample-config || true 56 | kubectl -n $NS create configmap fabric-tape-sample-config --from-file=./build/tape/ 57 | # kube config 58 | echo "Complete tape configuration" 59 | } 60 | 61 | function rollout_tape_sample() { 62 | echo "Starting tape for traffic" 63 | 64 | # to do here, play as a job? 65 | # to do here part2, play as a distributed job? 66 | #kubectl -n $NS apply -f kube/fabric-tape-sample.yaml 67 | kubectl delete -f ./kube/fabric-tape-sample.yaml -n $NS || true 68 | kubectl apply -f ./kube/fabric-tape-sample.yaml -n $NS 69 | echo "Complete tape init" 70 | } 71 | 72 | main $1 -------------------------------------------------------------------------------- /docs/locale/zh_CN/k8s.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | ## 目录 4 | 5 | * [介绍](#introduce) 6 | * [先决条件](#prerequisites) 7 | * [步骤](#steps) 8 | * [管家](#家政) 9 | 10 | --- 11 | ## 介绍 12 | 本文档是为性能沙箱初始化 k8s 集群的指南。 k8s 集群将会包含 k8s、prometheus 和 jaeger等功能。通过以下步骤,您将拥有一个基于 [kind](https://kind.sigs.k8s.io) 的 k8s 集群 13 | [prometheus operator](https://github.com/prometheus-operator/kube-prometheus) 和 [jaeger operator](https://github.com/jaegertracing/jaeger-operator)。 14 | 15 | 如果您想在自己的 k8s 集群上部署性能沙箱,或者您已经有一个带有 [prometheus operator] 的 k8s 集群,您可以跳过一些步骤(https://github.com/prometheus-operator/kube-prometheus ) 和 [jaeger operator](https://github.com/jaegertracing/jaeger-operator)。 16 | 17 | --- 18 | ## 先决条件 19 | - [git](https://github.com/) 20 | - [docker](https://www.docker.com/) 21 | - [kubectl](https://kubernetes.io/docs/tasks/tools/) 22 | - [kind](https://kind.sigs.k8s.io) 23 | 24 | --- 25 | 26 | ## 步骤 27 | 1. [kind](https://kind.sigs.k8s.io) 28 | ```shell 29 | ./infra.sh up 30 | ``` 31 | 32 | 可选,如果您在 find image_list 中列出了图像,您可以运行下面的脚本将本地图像加载到 kind。 33 | ```shell 34 | ./infra.sh load_image 35 | ``` 36 | `image_list` 看起来像: 37 | ```shell 38 | ghcr.io/hyperledger-twgc/tape:edge 39 | ``` 40 | 41 | 2. [prometheus operator](https://github.com/prometheus-operator/kube-prometheus) 42 | ```shell 43 | ./infra.sh prometheus 44 | ``` 45 | 46 | 3. [jaeger operator](https://github.com/jaegertracing/jaeger-operator) 47 | ```shell 48 | ./infra.sh jaeger 49 | ``` 50 | 51 | 4. 验证 52 | ```shell 53 | ./infra.sh verify 54 | ``` 55 | 如果一切都完成了,它看起来像: 56 | ```shell 57 | % ./infra.sh verify 58 | 在所有命名空间中验证 prometheus 和 jaege 59 | 名称 就绪 状态 重新开始 年龄 60 | alertmanager-main-0 2/2 运行 0 113s 61 | alertmanager-main-1 2/2 运行 0 113s 62 | alertmanager-main-2 2/2 运行 0 113s 63 | blackbox-exporter-65f6b65965-gg25r 3/3 运行 0 2m1s 64 | grafana-79ccfb4557-mmtbj 1/1 运行 0 2m1s 65 | kube-state-metrics-5498b5d7b-hsv7r 3/3 运行 0 2m1s 66 | node-exporter-4l8l4 2/2 运行 0 2m 67 | prometheus-adapter-6f6b6c667-4ccpl 1/1 运行 0 2m 68 | prometheus-adapter-6f6b6c667-xhtwc 1/1 运行 0 2m 69 | prometheus-k8s-0 2/2 运行 0 111s 70 | prometheus-k8s-1 2/2 运行 0 111s 71 | prometheus-operator-8bdc4bdd-xdlm5 2/2 运行 0 2m 72 | 名称 就绪 状态 重新开始 年龄 73 | jaeger-operator-5f5dcf7bf5-6zhrk 1/1 运行 0 105s 74 | 名称 就绪 状态 重新开始 年龄 75 | 最简单-75977cbc89-w6xmx 1/1 运行 0 73s 76 | 在所有命名空间中完成验证 prometheus 和 jaeger 77 | ``` 78 | 79 | 5.端口转发 80 | ```shell 81 | ./infra.sh portforward 82 | ``` 83 | 访问 http://localhost:3000 和 http://loalhost:16686 84 | 85 | ## 清空 86 | ```shell 87 | ./infra.sh down 88 | ``` 89 | -------------------------------------------------------------------------------- /docs/SUT.md: -------------------------------------------------------------------------------- 1 | # So far just supports for Hyperledger Fabric 2 | Current sample learn from test-network-k8s in fabric-sample 3 | 4 | ## Usage 5 | Launch the network, create a channel, and deploy the [basic-asset-transfer](./asset-transfer-basic) smart contract: 6 | ```shell 7 | cd ./SUT/fabric 8 | ./network.sh up 9 | ./network.sh channel 10 | ``` 11 | 12 |
13 | Click here to use your own chaincode as sample as NFT 14 | 15 | ```shell 16 | export TEST_NETWORK_CHAINCODE_IMAGE=localhost:5000/nftsample:latest 17 | export TEST_NETWORK_CHAINCODE_NAME=nftsample 18 | export TEST_NETWORK_CHAINCODE_LABEL=nft_1.0 19 | ./network.sh buildchaincode ./chaincode/nftsamplecode 20 | ``` 21 |
22 | 23 | ```shell 24 | ./network.sh chaincode deploy 25 | ``` 26 | 27 | Invoke and query chaincode: 28 | ```shell 29 | cd ./SUT/fabric 30 | ./network.sh chaincode invoke '{"Args":["CreateAsset","5","blue","35","tom","1000"]}' 31 | ./network.sh chaincode query '{"Args":["ReadAsset","5"]}' 32 | ``` 33 | 34 | ## Customization 35 | All customization parameters: 36 | ```shell 37 | LOCAL_CONTAINER_REGISTRY=${CONTAINER_REGISTRY:-hyperledger} 38 | FABRIC_CA_VERSION=${TEST_NETWORK_FABRIC_CA_VERSION:-1.5.2} 39 | FABRIC_VERSION=${TEST_NETWORK_FABRIC_VERSION:-2.4} 40 | CHANNEL_NAME=${TEST_NETWORK_CHANNEL_NAME:-mychannel} 41 | CHAINCODE_IMAGE=${TEST_NETWORK_CHAINCODE_IMAGE:-ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic} 42 | CHAINCODE_NAME=${TEST_NETWORK_CHAINCODE_NAME:-asset-transfer-basic} 43 | CHAINCODE_LABEL=${TEST_NETWORK_CHAINCODE_LABEL:-basic_1.0} 44 | ``` 45 | To use your local repository: 46 | ```shell 47 | export CONTAINER_REGISTRY=localhost:5000 48 | ``` 49 | 50 | ## Clean up 51 | ```shell 52 | ./network.sh down 53 | ``` 54 | 55 | ## Notice: 56 | You may need to rerun `./infra.sh jaeger` and `./infra.sh portforward` to restart jaeger after clean up. 57 | 58 | ## Deployment intergration 59 | Pre discussed with Cello meeting. For any kind of Hyperledger Fabric deployment tools, such as Cello(in this chapter, we will call it as deployment tool for short in following). Tasks below should be followed/checked for intergration between Performance Sandbox and deployment tool. 60 | - [ ] Deployment tool should able to support k8s deployment. (this part can be done with a document as guide) 61 | - [ ] We are able to following the "hello world" guidelines to deploy Hyperledger Fabric on k8s by deployment tool. (this part can be done with a document as guide) 62 | - [ ] Deployment tool should able to support any kind of prometheus and jaeger system. In PerformanceSandBox we used prometheus and jaeger operator, if needed, there need some code changes. 63 | - [ ] Deployment tool should able to support any kind of Hyperledger Fabric Application. For ex either Caliper or Tape needs certs, network info, chaincode info etc for making traffic to SUT. We can following deployment tool's guidelines for blockchain application to deploy Caliper and Tape. 64 | - [ ] Deployment tool should able to support image upgrade, and customize image for Hyperledger Fabric. 65 | 66 | ## ToDo/TBD: 67 | - [ ] jeager operator issue with portforward and deployment. 68 | - [ ] https://github.com/hyperledger/bevel 69 | - [ ] https://github.com/hyperledger-labs/minifabric 70 | 71 | - [ ] other blockchain projects -------------------------------------------------------------------------------- /SUT/fabric/chaincode/nftsamplecode/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "io/ioutil" 9 | "log" 10 | "os" 11 | "strconv" 12 | 13 | "github.com/hyperledger/fabric-chaincode-go/shim" 14 | "github.com/hyperledger/fabric-contract-api-go/contractapi" 15 | "github.com/hyperledger/fabric-contract-api-go/metadata" 16 | ) 17 | 18 | type serverConfig struct { 19 | CCID string 20 | Address string 21 | } 22 | 23 | func main() { 24 | hlpNftContract := new(TokenERC721Contract) 25 | hlpNftContract.Info.Version = "0.0.1" 26 | hlpNftContract.Info.Description = "ERC-721 fabric port" 27 | hlpNftContract.Info.License = new(metadata.LicenseMetadata) 28 | hlpNftContract.Info.License.Name = "Apache-2.0" 29 | hlpNftContract.Info.Contact = new(metadata.ContactMetadata) 30 | hlpNftContract.Info.Contact.Name = "Matias Salimbene" 31 | 32 | chaincode, err := contractapi.NewChaincode(hlpNftContract) 33 | chaincode.Info.Title = "ERC-721 chaincode" 34 | chaincode.Info.Version = "0.0.1" 35 | 36 | if err != nil { 37 | panic("Could not create chaincode from TokenERC721Contract." + err.Error()) 38 | } 39 | 40 | config := serverConfig{ 41 | CCID: os.Getenv("CHAINCODE_ID"), 42 | Address: os.Getenv("CHAINCODE_SERVER_ADDRESS"), 43 | } 44 | 45 | server := &shim.ChaincodeServer{ 46 | CCID: config.CCID, 47 | Address: config.Address, 48 | CC: chaincode, 49 | TLSProps: getTLSProperties(), 50 | } 51 | 52 | if err := server.Start(); err != nil { 53 | log.Panicf("error starting asset-transfer-basic chaincode: %s", err) 54 | } 55 | } 56 | 57 | func getEnvOrDefault(env, defaultVal string) string { 58 | value, ok := os.LookupEnv(env) 59 | if !ok { 60 | value = defaultVal 61 | } 62 | return value 63 | } 64 | 65 | // Note that the method returns default value if the string 66 | // cannot be parsed! 67 | func getBoolOrDefault(value string, defaultVal bool) bool { 68 | parsed, err := strconv.ParseBool(value) 69 | if err != nil { 70 | return defaultVal 71 | } 72 | return parsed 73 | } 74 | 75 | func getTLSProperties() shim.TLSProperties { 76 | // Check if chaincode is TLS enabled 77 | tlsDisabledStr := getEnvOrDefault("CHAINCODE_TLS_DISABLED", "true") 78 | key := getEnvOrDefault("CHAINCODE_TLS_KEY", "") 79 | cert := getEnvOrDefault("CHAINCODE_TLS_CERT", "") 80 | clientCACert := getEnvOrDefault("CHAINCODE_CLIENT_CA_CERT", "") 81 | 82 | // convert tlsDisabledStr to boolean 83 | tlsDisabled := getBoolOrDefault(tlsDisabledStr, false) 84 | var keyBytes, certBytes, clientCACertBytes []byte 85 | var err error 86 | 87 | if !tlsDisabled { 88 | keyBytes, err = ioutil.ReadFile(key) 89 | if err != nil { 90 | log.Panicf("error while reading the crypto file: %s", err) 91 | } 92 | certBytes, err = ioutil.ReadFile(cert) 93 | if err != nil { 94 | log.Panicf("error while reading the crypto file: %s", err) 95 | } 96 | } 97 | // Did not request for the peer cert verification 98 | if clientCACert != "" { 99 | clientCACertBytes, err = ioutil.ReadFile(clientCACert) 100 | if err != nil { 101 | log.Panicf("error while reading the crypto file: %s", err) 102 | } 103 | } 104 | 105 | return shim.TLSProperties{ 106 | Disabled: tlsDisabled, 107 | Key: keyBytes, 108 | Cert: certBytes, 109 | ClientCACerts: clientCACertBytes, 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /kube/jaeger/deploy/role.yaml: -------------------------------------------------------------------------------- 1 | ## this is a set of basic permissions the Jaeger Operator needs when restricted to work in specific namespaces 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | name: jaeger-operator 6 | rules: 7 | 8 | ## our own custom resources 9 | - apiGroups: 10 | - jaegertracing.io 11 | resources: 12 | - '*' 13 | verbs: 14 | - create 15 | - delete 16 | - get 17 | - list 18 | - patch 19 | - update 20 | - watch 21 | 22 | ## for the operator's own deployment 23 | - apiGroups: 24 | - apps 25 | resourceNames: 26 | - jaeger-operator 27 | resources: 28 | - deployments/finalizers 29 | verbs: 30 | - update 31 | 32 | ## regular things the operator manages for an instance, as the result of processing CRs 33 | - apiGroups: 34 | - "" 35 | resources: 36 | - configmaps 37 | - persistentvolumeclaims 38 | - pods 39 | - secrets 40 | - serviceaccounts 41 | - services 42 | - services/finalizers 43 | verbs: 44 | - create 45 | - delete 46 | - get 47 | - list 48 | - patch 49 | - update 50 | - watch 51 | - apiGroups: 52 | - apps 53 | resources: 54 | - deployments 55 | - daemonsets 56 | - replicasets 57 | - statefulsets 58 | verbs: 59 | - create 60 | - delete 61 | - get 62 | - list 63 | - patch 64 | - update 65 | - watch 66 | - apiGroups: 67 | - extensions 68 | resources: 69 | - ingresses 70 | verbs: 71 | - create 72 | - delete 73 | - get 74 | - list 75 | - patch 76 | - update 77 | - watch 78 | # Ingress for kubernetes 1.14 or higher 79 | - apiGroups: 80 | - networking.k8s.io 81 | resources: 82 | - ingresses 83 | verbs: 84 | - create 85 | - delete 86 | - get 87 | - list 88 | - patch 89 | - update 90 | - watch 91 | - apiGroups: 92 | - batch 93 | resources: 94 | - jobs 95 | - cronjobs 96 | verbs: 97 | - create 98 | - delete 99 | - get 100 | - list 101 | - patch 102 | - update 103 | - watch 104 | - apiGroups: 105 | - route.openshift.io 106 | resources: 107 | - routes 108 | verbs: 109 | - create 110 | - delete 111 | - get 112 | - list 113 | - patch 114 | - update 115 | - watch 116 | - apiGroups: 117 | - image.openshift.io 118 | resources: 119 | - imagestreams 120 | verbs: 121 | - create 122 | - delete 123 | - get 124 | - list 125 | - patch 126 | - update 127 | - watch 128 | - apiGroups: 129 | - autoscaling 130 | resources: 131 | - horizontalpodautoscalers 132 | verbs: 133 | - create 134 | - delete 135 | - get 136 | - list 137 | - patch 138 | - update 139 | - watch 140 | 141 | ## needed if you want the operator to create service monitors for the Jaeger instances 142 | - apiGroups: 143 | - monitoring.coreos.com 144 | resources: 145 | - servicemonitors 146 | verbs: 147 | - create 148 | - delete 149 | - get 150 | - list 151 | - patch 152 | - update 153 | - watch 154 | 155 | ## for the Elasticsearch auto-provisioning 156 | - apiGroups: 157 | - logging.openshift.io 158 | resources: 159 | - elasticsearches 160 | verbs: 161 | - create 162 | - delete 163 | - get 164 | - list 165 | - patch 166 | - update 167 | - watch 168 | 169 | ## for the Kafka auto-provisioning 170 | - apiGroups: 171 | - kafka.strimzi.io 172 | resources: 173 | - kafkas 174 | - kafkausers 175 | verbs: 176 | - create 177 | - delete 178 | - get 179 | - list 180 | - patch 181 | - update 182 | - watch 183 | 184 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org0/org0-orderer3.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: org0-orderer3-env 11 | data: 12 | FABRIC_CFG_PATH: /var/hyperledger/fabric/config 13 | FABRIC_LOGGING_SPEC: INFO # debug:cauthdsl,policies,msp,common.configtx,common.channelconfig=info 14 | ORDERER_GENERAL_LISTENADDRESS: 0.0.0.0 15 | ORDERER_GENERAL_LISTENPORT: "6050" 16 | ORDERER_GENERAL_LOCALMSPID: OrdererMSP 17 | ORDERER_GENERAL_LOCALMSPDIR: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer3.org0.example.com/msp 18 | ORDERER_GENERAL_TLS_ENABLED: "true" 19 | ORDERER_GENERAL_TLS_CERTIFICATE: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer3.org0.example.com/tls/signcerts/cert.pem 20 | ORDERER_GENERAL_TLS_ROOTCAS: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer3.org0.example.com/tls/cacerts/org0-tls-ca.pem 21 | ORDERER_GENERAL_TLS_PRIVATEKEY: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer3.org0.example.com/tls/keystore/server.key 22 | ORDERER_GENERAL_BOOTSTRAPMETHOD: none 23 | ORDERER_FILELEDGER_LOCATION: /var/hyperledger/fabric/data/orderer3 24 | ORDERER_CONSENSUS_WALDIR: /var/hyperledger/fabric/data/orderer3/etcdraft/wal 25 | ORDERER_CONSENSUS_SNAPDIR: /var/hyperledger/fabric/data/orderer3/etcdraft/wal 26 | ORDERER_OPERATIONS_LISTENADDRESS: 0.0.0.0:8443 27 | ORDERER_ADMIN_LISTENADDRESS: 0.0.0.0:9443 28 | ORDERER_METRICS_PROVIDER: prometheus 29 | 30 | --- 31 | apiVersion: apps/v1 32 | kind: Deployment 33 | metadata: 34 | name: org0-orderer3 35 | annotations: 36 | "sidecar.jaegertracing.io/inject": "true" 37 | spec: 38 | replicas: 1 39 | selector: 40 | matchLabels: 41 | app: org0-orderer3 42 | template: 43 | metadata: 44 | labels: 45 | app: org0-orderer3 46 | spec: 47 | containers: 48 | - name: main 49 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-orderer:{{FABRIC_VERSION}} 50 | envFrom: 51 | - configMapRef: 52 | name: org0-orderer3-env 53 | ports: 54 | - containerPort: 6050 55 | - containerPort: 8443 56 | - containerPort: 9443 57 | volumeMounts: 58 | - name: fabric-volume 59 | mountPath: /var/hyperledger 60 | - name: fabric-config 61 | mountPath: /var/hyperledger/fabric/config 62 | volumes: 63 | - name: fabric-volume 64 | persistentVolumeClaim: 65 | claimName: fabric-org0 66 | - name: fabric-config 67 | configMap: 68 | name: org0-config 69 | 70 | --- 71 | apiVersion: v1 72 | kind: Service 73 | metadata: 74 | name: org0-orderer3 75 | labels: 76 | app: org0-orderer3 77 | spec: 78 | ports: 79 | - name: general 80 | port: 6050 81 | protocol: TCP 82 | - name: operations 83 | port: 8443 84 | protocol: TCP 85 | - name: admin 86 | port: 9443 87 | protocol: TCP 88 | selector: 89 | app: org0-orderer3 90 | 91 | --- 92 | apiVersion: monitoring.coreos.com/v1 93 | kind: ServiceMonitor 94 | metadata: 95 | name: org0-orderer3 96 | namespace: default 97 | labels: 98 | release: mypro #Prometheus所选择的标签 99 | spec: 100 | namespaceSelector: #监控的pod所在名称空间 101 | matchNames: 102 | - default 103 | selector: 104 | matchLabels: 105 | app: org0-orderer3 106 | endpoints: 107 | - port: operations -------------------------------------------------------------------------------- /SUT/fabric/kube/org0/org0-orderer1.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: org0-orderer1-env 11 | data: 12 | FABRIC_CFG_PATH: /var/hyperledger/fabric/config 13 | FABRIC_LOGGING_SPEC: INFO # debug:cauthdsl,policies,msp,common.configtx,common.channelconfig=info 14 | ORDERER_GENERAL_LISTENADDRESS: 0.0.0.0 15 | ORDERER_GENERAL_LISTENPORT: "6050" 16 | ORDERER_GENERAL_LOCALMSPID: OrdererMSP 17 | ORDERER_GENERAL_LOCALMSPDIR: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer1.org0.example.com/msp 18 | ORDERER_GENERAL_TLS_ENABLED: "true" 19 | ORDERER_GENERAL_TLS_CERTIFICATE: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer1.org0.example.com/tls/signcerts/cert.pem 20 | ORDERER_GENERAL_TLS_ROOTCAS: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer1.org0.example.com/tls/cacerts/org0-tls-ca.pem 21 | ORDERER_GENERAL_TLS_PRIVATEKEY: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer1.org0.example.com/tls/keystore/server.key 22 | ORDERER_GENERAL_BOOTSTRAPMETHOD: none 23 | ORDERER_FILELEDGER_LOCATION: /var/hyperledger/fabric/data/orderer1 24 | ORDERER_CONSENSUS_WALDIR: /var/hyperledger/fabric/data/orderer1/etcdraft/wal 25 | ORDERER_CONSENSUS_SNAPDIR: /var/hyperledger/fabric/data/orderer1/etcdraft/wal 26 | ORDERER_OPERATIONS_LISTENADDRESS: 0.0.0.0:8443 27 | ORDERER_ADMIN_LISTENADDRESS: 0.0.0.0:9443 28 | ORDERER_METRICS_PROVIDER: prometheus 29 | 30 | --- 31 | apiVersion: apps/v1 32 | kind: Deployment 33 | metadata: 34 | name: org0-orderer1 35 | annotations: 36 | "sidecar.jaegertracing.io/inject": "true" 37 | spec: 38 | replicas: 1 39 | selector: 40 | matchLabels: 41 | app: org0-orderer1 42 | template: 43 | metadata: 44 | labels: 45 | app: org0-orderer1 46 | spec: 47 | containers: 48 | - name: main 49 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-orderer:{{FABRIC_VERSION}} 50 | envFrom: 51 | - configMapRef: 52 | name: org0-orderer1-env 53 | ports: 54 | - containerPort: 6050 55 | - containerPort: 8443 56 | - containerPort: 9443 57 | volumeMounts: 58 | - name: fabric-volume 59 | mountPath: /var/hyperledger 60 | - name: fabric-config 61 | mountPath: /var/hyperledger/fabric/config 62 | volumes: 63 | - name: fabric-volume 64 | persistentVolumeClaim: 65 | claimName: fabric-org0 66 | - name: fabric-config 67 | configMap: 68 | name: org0-config 69 | 70 | --- 71 | apiVersion: v1 72 | kind: Service 73 | metadata: 74 | name: org0-orderer1 75 | labels: 76 | app: org0-orderer1 77 | spec: 78 | ports: 79 | - name: general 80 | port: 6050 81 | protocol: TCP 82 | - name: operations 83 | port: 8443 84 | protocol: TCP 85 | - name: admin 86 | port: 9443 87 | protocol: TCP 88 | selector: 89 | app: org0-orderer1 90 | 91 | --- 92 | apiVersion: monitoring.coreos.com/v1 93 | kind: ServiceMonitor 94 | metadata: 95 | name: org0-orderer1 96 | namespace: default 97 | labels: 98 | release: mypro #Prometheus所选择的标签 99 | spec: 100 | namespaceSelector: #监控的pod所在名称空间 101 | matchNames: 102 | - default 103 | selector: 104 | matchLabels: 105 | app: org0-orderer1 106 | endpoints: 107 | - port: operations 108 | -------------------------------------------------------------------------------- /SUT/fabric/kube/org0/org0-orderer2.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: org0-orderer2-env 11 | data: 12 | FABRIC_CFG_PATH: /var/hyperledger/fabric/config 13 | FABRIC_LOGGING_SPEC: INFO # debug:cauthdsl,policies,msp,common.configtx,common.channelconfig=info 14 | ORDERER_GENERAL_LISTENADDRESS: 0.0.0.0 15 | ORDERER_GENERAL_LISTENPORT: "6050" 16 | ORDERER_GENERAL_LOCALMSPID: OrdererMSP 17 | ORDERER_GENERAL_LOCALMSPDIR: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer2.org0.example.com/msp 18 | ORDERER_GENERAL_TLS_ENABLED: "true" 19 | ORDERER_GENERAL_TLS_CERTIFICATE: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer2.org0.example.com/tls/signcerts/cert.pem 20 | ORDERER_GENERAL_TLS_ROOTCAS: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer2.org0.example.com/tls/cacerts/org0-tls-ca.pem 21 | ORDERER_GENERAL_TLS_PRIVATEKEY: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer2.org0.example.com/tls/keystore/server.key 22 | ORDERER_GENERAL_BOOTSTRAPMETHOD: none 23 | ORDERER_FILELEDGER_LOCATION: /var/hyperledger/fabric/data/orderer2 24 | ORDERER_CONSENSUS_WALDIR: /var/hyperledger/fabric/data/orderer2/etcdraft/wal 25 | ORDERER_CONSENSUS_SNAPDIR: /var/hyperledger/fabric/data/orderer2/etcdraft/wal 26 | ORDERER_OPERATIONS_LISTENADDRESS: 0.0.0.0:8443 27 | ORDERER_ADMIN_LISTENADDRESS: 0.0.0.0:9443 28 | ORDERER_METRICS_PROVIDER: prometheus 29 | 30 | --- 31 | apiVersion: apps/v1 32 | kind: Deployment 33 | metadata: 34 | name: org0-orderer2 35 | annotations: 36 | "sidecar.jaegertracing.io/inject": "true" 37 | spec: 38 | replicas: 1 39 | selector: 40 | matchLabels: 41 | app: org0-orderer2 42 | template: 43 | metadata: 44 | labels: 45 | app: org0-orderer2 46 | spec: 47 | containers: 48 | - name: main 49 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-orderer:{{FABRIC_VERSION}} 50 | envFrom: 51 | - configMapRef: 52 | name: org0-orderer2-env 53 | ports: 54 | - containerPort: 6050 55 | - containerPort: 8443 56 | - containerPort: 9443 57 | volumeMounts: 58 | - name: fabric-volume 59 | mountPath: /var/hyperledger 60 | - name: fabric-config 61 | mountPath: /var/hyperledger/fabric/config 62 | volumes: 63 | - name: fabric-volume 64 | persistentVolumeClaim: 65 | claimName: fabric-org0 66 | - name: fabric-config 67 | configMap: 68 | name: org0-config 69 | 70 | --- 71 | apiVersion: v1 72 | kind: Service 73 | metadata: 74 | name: org0-orderer2 75 | labels: 76 | app: org0-orderer2 77 | spec: 78 | ports: 79 | - name: general 80 | port: 6050 81 | protocol: TCP 82 | - name: operations 83 | port: 8443 84 | protocol: TCP 85 | - name: admin 86 | port: 9443 87 | protocol: TCP 88 | selector: 89 | app: org0-orderer2 90 | 91 | --- 92 | apiVersion: monitoring.coreos.com/v1 93 | kind: ServiceMonitor 94 | metadata: 95 | name: org0-orderer2 96 | namespace: default 97 | labels: 98 | release: mypro #Prometheus所选择的标签 99 | spec: 100 | namespaceSelector: #监控的pod所在名称空间 101 | matchNames: 102 | - default 103 | selector: 104 | matchLabels: 105 | app: org0-orderer2 106 | endpoints: 107 | - port: operations 108 | -------------------------------------------------------------------------------- /docs/k8s.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | ## Table Of Content 4 | 5 | * [Introduce](#introduce) 6 | * [Prerequisites](#prerequisites) 7 | * [Steps](#steps) 8 | * [HouseKeeping](#housekeeping) 9 | 10 | --- 11 | ## Introduce 12 | This document is a guidance for init a k8s cluster for performance sandbox. The k8s cluster should contains k8s, prometheus and jaeger. With following steps, you will have a k8s cluster basing on [kind](https://kind.sigs.k8s.io) with 13 | [prometheus operator](https://github.com/prometheus-operator/kube-prometheus) and [jaeger operator](https://github.com/jaegertracing/jaeger-operator). 14 | Or you are able to use [minikube](https://minikube.sigs.k8s.io/docs/start/), and ensure start minikube with `--cni=bridge` 15 | 16 | You are free to skip some of the steps, if you want to deploy performance sandbox on your own k8s cluster or you already have a k8s cluster with [prometheus operator](https://github.com/prometheus-operator/kube-prometheus) and [jaeger operator](https://github.com/jaegertracing/jaeger-operator). 17 | 18 | --- 19 | ## Prerequisites 20 | - [git](https://github.com/) 21 | - [docker](https://www.docker.com/) 22 | - [kubectl](https://kubernetes.io/docs/tasks/tools/) 23 | - [kind](https://kind.sigs.k8s.io) or [minikube](https://minikube.sigs.k8s.io/docs/start/) 24 | 25 | --- 26 | 27 | ## Steps 28 | 1. start k8s cluster 29 | optional 30 | [kind](https://kind.sigs.k8s.io) 31 | ```shell 32 | ./infra.sh up 33 | ``` 34 | [minikube](https://minikube.sigs.k8s.io/docs/start/) 35 | ```shell 36 | minikube start --cni=bridge && minikube addons enable ingress && minikube addons enable ingress-dns 37 | ``` 38 | 39 | optional, if you have a image listed in find image_list, you are able to run script below to load local image to kind. 40 | ```shell 41 | ./infra.sh load_image 42 | ``` 43 | `image_list` looks like: 44 | ```shell 45 | ghcr.io/hyperledger-twgc/tape:edge 46 | ``` 47 | 48 | 2. [prometheus operator](https://github.com/prometheus-operator/kube-prometheus) 49 | ```shell 50 | ./infra.sh prometheus 51 | ``` 52 | 53 | 3. [jaeger operator](https://github.com/jaegertracing/jaeger-operator) 54 | ```shell 55 | ./infra.sh jaeger 56 | ``` 57 | 58 | 4. verify 59 | ```shell 60 | ./infra.sh verify 61 | ``` 62 | if everything completed, it looks like: 63 | ```shell 64 | % ./infra.sh verify 65 | Verify prometheus and jaeger, in all namespaces 66 | NAME READY STATUS RESTARTS AGE 67 | alertmanager-main-0 2/2 Running 0 113s 68 | alertmanager-main-1 2/2 Running 0 113s 69 | alertmanager-main-2 2/2 Running 0 113s 70 | blackbox-exporter-65f6b65965-gg25r 3/3 Running 0 2m1s 71 | grafana-79ccfb4557-mmtbj 1/1 Running 0 2m1s 72 | kube-state-metrics-5498b5d7b-hsv7r 3/3 Running 0 2m1s 73 | node-exporter-4l8l4 2/2 Running 0 2m 74 | prometheus-adapter-6f6b6c667-4ccpl 1/1 Running 0 2m 75 | prometheus-adapter-6f6b6c667-xhtwc 1/1 Running 0 2m 76 | prometheus-k8s-0 2/2 Running 0 111s 77 | prometheus-k8s-1 2/2 Running 0 111s 78 | prometheus-operator-8bdc4bdd-xdlm5 2/2 Running 0 2m 79 | NAME READY STATUS RESTARTS AGE 80 | jaeger-operator-5f5dcf7bf5-6zhrk 1/1 Running 0 105s 81 | NAME READY STATUS RESTARTS AGE 82 | simplest-75977cbc89-w6xmx 1/1 Running 0 73s 83 | Complete Verify prometheus and jaeger,in all namespaces 84 | ``` 85 | 86 | 5. port forward 87 | ```shell 88 | ./infra.sh portforward 89 | ``` 90 | access http://localhost:3000 and http://loalhost:16686 91 | 92 | ## HouseKeeping 93 | ```shell 94 | ./infra.sh down 95 | ``` -------------------------------------------------------------------------------- /App/fabric/app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | set -o errexit 5 | #set -x 6 | 7 | NS=default 8 | 9 | function extract_MSP_archives() { 10 | # rm 11 | rm -rf ./build/msp 12 | mkdir -p ./build/msp 13 | 14 | kubectl -n $NS exec deploy/org1-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org1.example.com/msp | tar zxf - -C build/msp 15 | kubectl -n $NS exec deploy/org2-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org2.example.com/msp | tar zxf - -C build/msp 16 | 17 | kubectl -n $NS exec deploy/org0-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/ordererOrganizations/org0.example.com/msp | tar zxf - -C build/msp 18 | 19 | kubectl -n $NS exec deploy/org1-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp | tar zxf - -C build/msp 20 | kubectl -n $NS exec deploy/org2-ecert-ca -- tar zcf - -C /var/hyperledger/fabric organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp | tar zxf - -C build/msp 21 | } 22 | 23 | function one_line_pem { 24 | echo "`awk 'NF {sub(/\\n/, ""); printf "%s\\\\\\\n",$0;}' $1`" 25 | } 26 | 27 | function json_ccp { 28 | local ORG=$1 29 | local PP=$(one_line_pem $2) 30 | local CP=$(one_line_pem $3) 31 | sed -e "s/\${ORG}/$ORG/" \ 32 | -e "s#\${PEERPEM}#$PP#" \ 33 | -e "s#\${CAPEM}#$CP#" \ 34 | scripts/ccp-template.json 35 | } 36 | 37 | function construct_rest_sample_configmap() { 38 | echo "Constructing fabric-rest-sample connection profiles" 39 | 40 | extract_MSP_archives 41 | 42 | mkdir -p build/fabric-rest-sample-config 43 | 44 | local peer_pem=build/msp/organizations/peerOrganizations/org1.example.com/msp/tlscacerts/org1-tls-ca.pem 45 | local ca_pem=build/msp/organizations/peerOrganizations/org1.example.com/msp/cacerts/org1-ecert-ca.pem 46 | 47 | echo "$(json_ccp 1 $peer_pem $ca_pem)" > build/fabric-rest-sample-config/HLF_CONNECTION_PROFILE_ORG1 48 | cat build/fabric-rest-sample-config/HLF_CONNECTION_PROFILE_ORG1 49 | 50 | peer_pem=build/msp/organizations/peerOrganizations/org2.example.com/msp/tlscacerts/org2-tls-ca.pem 51 | ca_pem=build/msp/organizations/peerOrganizations/org2.example.com/msp/cacerts/org2-ecert-ca.pem 52 | 53 | echo "$(json_ccp 2 $peer_pem $ca_pem)" > build/fabric-rest-sample-config/HLF_CONNECTION_PROFILE_ORG2 54 | cat build/fabric-rest-sample-config/HLF_CONNECTION_PROFILE_ORG2 55 | 56 | cat build/msp/organizations/peerOrganizations/org1.example.com/users/Admin\@org1.example.com/msp/signcerts/cert.pem > build/fabric-rest-sample-config/HLF_CERTIFICATE_ORG1 57 | cat build/msp/organizations/peerOrganizations/org2.example.com/users/Admin\@org2.example.com/msp/signcerts/cert.pem > build/fabric-rest-sample-config/HLF_CERTIFICATE_ORG2 58 | 59 | cat build/msp/organizations/peerOrganizations/org1.example.com/users/Admin\@org1.example.com/msp/keystore/server.key > build/fabric-rest-sample-config/HLF_PRIVATE_KEY_ORG1 60 | cat build/msp/organizations/peerOrganizations/org2.example.com/users/Admin\@org2.example.com/msp/keystore/server.key > build/fabric-rest-sample-config/HLF_PRIVATE_KEY_ORG2 61 | 62 | kubectl -n $NS delete configmap fabric-rest-sample-config || true 63 | 64 | kubectl -n $NS create configmap fabric-rest-sample-config --from-file=build/fabric-rest-sample-config/ 65 | 66 | echo "Compelte Constructing fabric-rest-sample connection profiles" 67 | } 68 | 69 | function rollout_rest_sample() { 70 | echo "Starting fabric-rest-sample" 71 | 72 | kubectl -n $NS apply -f ./kube/fabric-rest-sample.yaml 73 | kubectl -n $NS rollout status deploy/fabric-rest-sample 74 | 75 | echo "Complete fabric-rest-sample" 76 | } 77 | 78 | echo "begin deploy sample app" 79 | 80 | construct_rest_sample_configmap 81 | rollout_rest_sample 82 | 83 | echo "end sample app deployment" 84 | echo "to access app from ui: kubectl port-forward svc/fabric-rest-sample 3001:3000" -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-peer2.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: org2-peer2-config 11 | data: 12 | FABRIC_CFG_PATH: /var/hyperledger/fabric/config 13 | FABRIC_LOGGING_SPEC: "debug:cauthdsl,policies,msp,grpc,peer.gossip.mcs,gossip,leveldbhelper=info" 14 | CORE_PEER_TLS_ENABLED: "true" 15 | CORE_PEER_TLS_CERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer2.org2.example.com/tls/signcerts/cert.pem 16 | CORE_PEER_TLS_KEY_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer2.org2.example.com/tls/keystore/server.key 17 | CORE_PEER_TLS_ROOTCERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer2.org2.example.com/tls/cacerts/org2-tls-ca.pem 18 | CORE_PEER_ID: org2-peer2.org2.example.com 19 | CORE_PEER_ADDRESS: org2-peer2:7051 20 | CORE_PEER_LISTENADDRESS: 0.0.0.0:7051 21 | CORE_PEER_CHAINCODEADDRESS: org2-peer2:7052 22 | CORE_PEER_CHAINCODELISTENADDRESS: 0.0.0.0:7052 23 | # bootstrap peer is the other peer in the same org 24 | CORE_PEER_GOSSIP_BOOTSTRAP: org2-peer1:7051 25 | CORE_PEER_GOSSIP_EXTERNALENDPOINT: org2-peer2:7051 26 | CORE_PEER_LOCALMSPID: Org2MSP 27 | CORE_PEER_MSPCONFIGPATH: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer2.org2.example.com/msp 28 | CORE_OPERATIONS_LISTENADDRESS: 0.0.0.0:9443 29 | CORE_PEER_FILESYSTEMPATH: /var/hyperledger/fabric/data/org2-peer2.org2.example.com 30 | CORE_LEDGER_SNAPSHOTS_ROOTDIR: /var/hyperledger/fabric/data/org2-peer2.org2.example.com/snapshots 31 | CORE_METRICS_PROVIDER: prometheus 32 | CORE_LEDGER_STATE_STATEDATABASE: CouchDB 33 | CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS: org2peer2couchdb:5984 34 | CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME: admin 35 | CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD: adminpw 36 | --- 37 | apiVersion: apps/v1 38 | kind: Deployment 39 | metadata: 40 | name: org2-peer2 41 | annotations: 42 | "sidecar.jaegertracing.io/inject": "true" 43 | spec: 44 | replicas: 1 45 | selector: 46 | matchLabels: 47 | app: org2-peer2 48 | template: 49 | metadata: 50 | labels: 51 | app: org2-peer2 52 | spec: 53 | containers: 54 | - name: main 55 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-peer:{{FABRIC_VERSION}} 56 | envFrom: 57 | - configMapRef: 58 | name: org2-peer2-config 59 | ports: 60 | - containerPort: 7051 61 | - containerPort: 7052 62 | - containerPort: 9443 63 | volumeMounts: 64 | - name: fabric-volume 65 | mountPath: /var/hyperledger 66 | - name: fabric-config 67 | mountPath: /var/hyperledger/fabric/config 68 | 69 | volumes: 70 | - name: fabric-volume 71 | persistentVolumeClaim: 72 | claimName: fabric-org2 73 | - name: fabric-config 74 | configMap: 75 | name: org2-config 76 | 77 | --- 78 | apiVersion: v1 79 | kind: Service 80 | metadata: 81 | name: org2-peer2 82 | labels: 83 | app: org2-peer2 84 | spec: 85 | ports: 86 | - name: gossip 87 | port: 7051 88 | protocol: TCP 89 | - name: chaincode 90 | port: 7052 91 | protocol: TCP 92 | - name: operations 93 | port: 9443 94 | protocol: TCP 95 | selector: 96 | app: org2-peer2 97 | 98 | --- 99 | apiVersion: monitoring.coreos.com/v1 100 | kind: ServiceMonitor 101 | metadata: 102 | name: org2-peer2 103 | namespace: default 104 | labels: 105 | release: mypro #Prometheus所选择的标签 106 | spec: 107 | namespaceSelector: #监控的pod所在名称空间 108 | matchNames: 109 | - default 110 | selector: 111 | matchLabels: 112 | app: org2-peer2 113 | endpoints: 114 | - port: operations -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-peer2.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: org1-peer2-config 11 | data: 12 | FABRIC_CFG_PATH: /var/hyperledger/fabric/config 13 | FABRIC_LOGGING_SPEC: "debug:cauthdsl,policies,msp,grpc,peer.gossip.mcs,gossip,leveldbhelper=info" 14 | CORE_PEER_TLS_ENABLED: "true" 15 | CORE_PEER_TLS_CERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer2.org1.example.com/tls/signcerts/cert.pem 16 | CORE_PEER_TLS_KEY_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer2.org1.example.com/tls/keystore/server.key 17 | CORE_PEER_TLS_ROOTCERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer2.org1.example.com/tls/cacerts/org1-tls-ca.pem 18 | CORE_PEER_ID: org1-peer2.org1.example.com 19 | CORE_PEER_ADDRESS: org1-peer2:7051 20 | CORE_PEER_LISTENADDRESS: 0.0.0.0:7051 21 | CORE_PEER_CHAINCODEADDRESS: org1-peer2:7052 22 | CORE_PEER_CHAINCODELISTENADDRESS: 0.0.0.0:7052 23 | # bootstrap peer is the other peer in the same org 24 | CORE_PEER_GOSSIP_BOOTSTRAP: org1-peer1:7051 25 | CORE_PEER_GOSSIP_EXTERNALENDPOINT: org1-peer2:7051 26 | CORE_PEER_LOCALMSPID: Org1MSP 27 | CORE_PEER_MSPCONFIGPATH: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer2.org1.example.com/msp 28 | CORE_OPERATIONS_LISTENADDRESS: 0.0.0.0:9443 29 | CORE_PEER_FILESYSTEMPATH: /var/hyperledger/fabric/data/org1-peer2.org1.example.com 30 | CORE_LEDGER_SNAPSHOTS_ROOTDIR: /var/hyperledger/fabric/data/org1-peer2.org1.example.com/snapshots 31 | CORE_METRICS_PROVIDER: prometheus 32 | CORE_LEDGER_STATE_STATEDATABASE: CouchDB 33 | CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS: org1peer2couchdb:5984 34 | CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME: admin 35 | CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD: adminpw 36 | --- 37 | apiVersion: apps/v1 38 | kind: Deployment 39 | metadata: 40 | name: org1-peer2 41 | annotations: 42 | "sidecar.jaegertracing.io/inject": "true" 43 | spec: 44 | replicas: 1 45 | selector: 46 | matchLabels: 47 | app: org1-peer2 48 | template: 49 | metadata: 50 | labels: 51 | app: org1-peer2 52 | spec: 53 | containers: 54 | - name: main 55 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-peer:{{FABRIC_VERSION}} 56 | envFrom: 57 | - configMapRef: 58 | name: org1-peer2-config 59 | ports: 60 | - containerPort: 7051 61 | - containerPort: 7052 62 | - containerPort: 9443 63 | volumeMounts: 64 | - name: fabric-volume 65 | mountPath: /var/hyperledger 66 | - name: fabric-config 67 | mountPath: /var/hyperledger/fabric/config 68 | 69 | volumes: 70 | - name: fabric-volume 71 | persistentVolumeClaim: 72 | claimName: fabric-org1 73 | - name: fabric-config 74 | configMap: 75 | name: org1-config 76 | 77 | --- 78 | apiVersion: v1 79 | kind: Service 80 | metadata: 81 | name: org1-peer2 82 | labels: 83 | app: org1-peer2 84 | spec: 85 | ports: 86 | - name: gossip 87 | port: 7051 88 | protocol: TCP 89 | - name: chaincode 90 | port: 7052 91 | protocol: TCP 92 | - name: operations 93 | port: 9443 94 | protocol: TCP 95 | selector: 96 | app: org1-peer2 97 | 98 | --- 99 | apiVersion: monitoring.coreos.com/v1 100 | kind: ServiceMonitor 101 | metadata: 102 | name: org1-peer2 103 | namespace: default 104 | labels: 105 | release: mypro #Prometheus所选择的标签 106 | spec: 107 | namespaceSelector: #监控的pod所在名称空间 108 | matchNames: 109 | - default 110 | selector: 111 | matchLabels: 112 | app: org1-peer2 113 | endpoints: 114 | - port: operations 115 | -------------------------------------------------------------------------------- /dashboard/fabric/Tape Dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": true, 8 | "hide": true, 9 | "iconColor": "rgba(0, 211, 255, 1)", 10 | "name": "Annotations & Alerts", 11 | "target": { 12 | "limit": 100, 13 | "matchAny": false, 14 | "tags": [], 15 | "type": "dashboard" 16 | }, 17 | "type": "dashboard" 18 | } 19 | ] 20 | }, 21 | "editable": true, 22 | "fiscalYearStartMonth": 0, 23 | "graphTooltip": 0, 24 | "id": 26, 25 | "links": [], 26 | "liveNow": false, 27 | "panels": [ 28 | { 29 | "datasource": { 30 | "type": "prometheus", 31 | "uid": "P1809F7CD0C75ACF3" 32 | }, 33 | "fieldConfig": { 34 | "defaults": { 35 | "color": { 36 | "mode": "palette-classic" 37 | }, 38 | "custom": { 39 | "axisLabel": "", 40 | "axisPlacement": "auto", 41 | "barAlignment": 0, 42 | "drawStyle": "line", 43 | "fillOpacity": 0, 44 | "gradientMode": "none", 45 | "hideFrom": { 46 | "legend": false, 47 | "tooltip": false, 48 | "viz": false 49 | }, 50 | "lineInterpolation": "linear", 51 | "lineWidth": 1, 52 | "pointSize": 5, 53 | "scaleDistribution": { 54 | "type": "linear" 55 | }, 56 | "showPoints": "auto", 57 | "spanNulls": false, 58 | "stacking": { 59 | "group": "A", 60 | "mode": "none" 61 | }, 62 | "thresholdsStyle": { 63 | "mode": "off" 64 | } 65 | }, 66 | "mappings": [], 67 | "thresholds": { 68 | "mode": "absolute", 69 | "steps": [ 70 | { 71 | "color": "green", 72 | "value": null 73 | }, 74 | { 75 | "color": "red", 76 | "value": 80 77 | } 78 | ] 79 | } 80 | }, 81 | "overrides": [] 82 | }, 83 | "gridPos": { 84 | "h": 12, 85 | "w": 24, 86 | "x": 0, 87 | "y": 0 88 | }, 89 | "id": 2, 90 | "options": { 91 | "legend": { 92 | "calcs": [], 93 | "displayMode": "list", 94 | "placement": "bottom" 95 | }, 96 | "tooltip": { 97 | "mode": "single" 98 | } 99 | }, 100 | "targets": [ 101 | { 102 | "datasource": { 103 | "type": "prometheus", 104 | "uid": "P1809F7CD0C75ACF3" 105 | }, 106 | "exemplar": true, 107 | "expr": "transaction_latency_duration", 108 | "hide": false, 109 | "interval": "", 110 | "legendFormat": "", 111 | "refId": "A" 112 | }, 113 | { 114 | "datasource": { 115 | "type": "prometheus", 116 | "uid": "P1809F7CD0C75ACF3" 117 | }, 118 | "exemplar": true, 119 | "expr": "read_latency_duration", 120 | "hide": false, 121 | "interval": "", 122 | "legendFormat": "", 123 | "refId": "B" 124 | } 125 | ], 126 | "title": "Tape Latency", 127 | "type": "timeseries" 128 | } 129 | ], 130 | "refresh": "5s", 131 | "schemaVersion": 34, 132 | "style": "dark", 133 | "tags": [], 134 | "templating": { 135 | "list": [] 136 | }, 137 | "time": { 138 | "from": "now-5m", 139 | "to": "now" 140 | }, 141 | "timepicker": {}, 142 | "timezone": "", 143 | "title": "Tape", 144 | "uid": "lhqN3Drnk", 145 | "version": 2, 146 | "weekStart": "" 147 | } -------------------------------------------------------------------------------- /SUT/fabric/kube/org1/org1-peer1.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: org1-peer1-config 11 | data: 12 | FABRIC_CFG_PATH: /var/hyperledger/fabric/config 13 | FABRIC_LOGGING_SPEC: "debug:cauthdsl,policies,msp,grpc,peer.gossip.mcs,gossip,leveldbhelper=info" 14 | CORE_PEER_TLS_ENABLED: "true" 15 | CORE_PEER_TLS_CERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer1.org1.example.com/tls/signcerts/cert.pem 16 | CORE_PEER_TLS_KEY_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer1.org1.example.com/tls/keystore/server.key 17 | CORE_PEER_TLS_ROOTCERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer1.org1.example.com/tls/cacerts/org1-tls-ca.pem 18 | CORE_PEER_ID: org1-peer1.org1.example.com 19 | CORE_PEER_ADDRESS: org1-peer1:7051 20 | CORE_PEER_LISTENADDRESS: 0.0.0.0:7051 21 | CORE_PEER_CHAINCODEADDRESS: org1-peer1:7052 22 | CORE_PEER_CHAINCODELISTENADDRESS: 0.0.0.0:7052 23 | # bootstrap peer is the other peer in the same org 24 | CORE_PEER_GOSSIP_BOOTSTRAP: org1-peer2:7051 25 | CORE_PEER_GOSSIP_EXTERNALENDPOINT: org1-peer1:7051 26 | CORE_PEER_LOCALMSPID: Org1MSP 27 | CORE_PEER_MSPCONFIGPATH: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/peers/org1-peer1.org1.example.com/msp 28 | CORE_OPERATIONS_LISTENADDRESS: 0.0.0.0:9443 29 | CORE_PEER_FILESYSTEMPATH: /var/hyperledger/fabric/data/org1-peer1.org1.example.com 30 | CORE_LEDGER_SNAPSHOTS_ROOTDIR: /var/hyperledger/fabric/data/org1-peer1.org1.example.com/snapshots 31 | CORE_METRICS_PROVIDER: prometheus 32 | CORE_LEDGER_STATE_STATEDATABASE: CouchDB 33 | CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS: org1peer1couchdb:5984 34 | CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME: admin 35 | CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD: adminpw 36 | --- 37 | apiVersion: apps/v1 38 | kind: Deployment 39 | metadata: 40 | name: org1-peer1 41 | annotations: 42 | "sidecar.jaegertracing.io/inject": "true" 43 | spec: 44 | replicas: 1 45 | selector: 46 | matchLabels: 47 | app: org1-peer1 48 | template: 49 | metadata: 50 | labels: 51 | app: org1-peer1 52 | spec: 53 | containers: 54 | - name: main 55 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-peer:{{FABRIC_VERSION}} 56 | envFrom: 57 | - configMapRef: 58 | name: org1-peer1-config 59 | ports: 60 | - containerPort: 7051 61 | - containerPort: 7052 62 | - containerPort: 9443 63 | volumeMounts: 64 | - name: fabric-volume 65 | mountPath: /var/hyperledger 66 | - name: fabric-config 67 | mountPath: /var/hyperledger/fabric/config 68 | - name: ccs-builder 69 | mountPath: /var/hyperledger/fabric/chaincode/ccs-builder/bin 70 | 71 | # load the external chaincode builder into the peer image prior to peer launch. 72 | initContainers: 73 | - name: fabric-ccs-builder 74 | image: ghcr.io/hyperledgendary/fabric-ccs-builder 75 | imagePullPolicy: IfNotPresent 76 | command: [sh, -c] 77 | args: ["cp /go/bin/* /var/hyperledger/fabric/chaincode/ccs-builder/bin/"] 78 | volumeMounts: 79 | - name: ccs-builder 80 | mountPath: /var/hyperledger/fabric/chaincode/ccs-builder/bin 81 | 82 | volumes: 83 | - name: fabric-volume 84 | persistentVolumeClaim: 85 | claimName: fabric-org1 86 | - name: fabric-config 87 | configMap: 88 | name: org1-config 89 | - name: ccs-builder 90 | emptyDir: {} 91 | --- 92 | apiVersion: v1 93 | kind: Service 94 | metadata: 95 | name: org1-peer1 96 | labels: 97 | app: org1-peer1 98 | spec: 99 | ports: 100 | - name: gossip 101 | port: 7051 102 | protocol: TCP 103 | - name: chaincode 104 | port: 7052 105 | protocol: TCP 106 | - name: operations 107 | port: 9443 108 | protocol: TCP 109 | selector: 110 | app: org1-peer1 111 | 112 | --- 113 | apiVersion: monitoring.coreos.com/v1 114 | kind: ServiceMonitor 115 | metadata: 116 | name: org1-peer1 117 | namespace: default 118 | labels: 119 | release: mypro #Prometheus所选择的标签 120 | spec: 121 | namespaceSelector: #监控的pod所在名称空间 122 | matchNames: 123 | - default 124 | selector: 125 | matchLabels: 126 | app: org1-peer1 127 | endpoints: 128 | - port: operations -------------------------------------------------------------------------------- /SUT/fabric/kube/org2/org2-peer1.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: org2-peer1-config 11 | data: 12 | FABRIC_CFG_PATH: /var/hyperledger/fabric/config 13 | FABRIC_LOGGING_SPEC: "debug:cauthdsl,policies,msp,grpc,peer.gossip.mcs,gossip,leveldbhelper=info" 14 | CORE_PEER_TLS_ENABLED: "true" 15 | CORE_PEER_TLS_CERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer1.org2.example.com/tls/signcerts/cert.pem 16 | CORE_PEER_TLS_KEY_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer1.org2.example.com/tls/keystore/server.key 17 | CORE_PEER_TLS_ROOTCERT_FILE: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer1.org2.example.com/tls/cacerts/org2-tls-ca.pem 18 | CORE_PEER_ID: org2-peer1.org2.example.com 19 | CORE_PEER_ADDRESS: org2-peer1:7051 20 | CORE_PEER_LISTENADDRESS: 0.0.0.0:7051 21 | CORE_PEER_CHAINCODEADDRESS: org2-peer1:7052 22 | CORE_PEER_CHAINCODELISTENADDRESS: 0.0.0.0:7052 23 | # bootstrap peer is the other peer in the same org 24 | CORE_PEER_GOSSIP_BOOTSTRAP: org2-peer2:7051 25 | CORE_PEER_GOSSIP_EXTERNALENDPOINT: org2-peer1:7051 26 | CORE_PEER_LOCALMSPID: Org2MSP 27 | CORE_PEER_MSPCONFIGPATH: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/peers/org2-peer1.org2.example.com/msp 28 | CORE_OPERATIONS_LISTENADDRESS: 0.0.0.0:9443 29 | CORE_PEER_FILESYSTEMPATH: /var/hyperledger/fabric/data/org2-peer1.org2.example.com 30 | CORE_LEDGER_SNAPSHOTS_ROOTDIR: /var/hyperledger/fabric/data/org2-peer1.org2.example.com/snapshots 31 | CORE_METRICS_PROVIDER: prometheus 32 | CORE_LEDGER_STATE_STATEDATABASE: CouchDB 33 | CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS: org2peer1couchdb:5984 34 | CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME: admin 35 | CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD: adminpw 36 | --- 37 | apiVersion: apps/v1 38 | kind: Deployment 39 | metadata: 40 | name: org2-peer1 41 | annotations: 42 | "sidecar.jaegertracing.io/inject": "true" 43 | spec: 44 | replicas: 1 45 | selector: 46 | matchLabels: 47 | app: org2-peer1 48 | template: 49 | metadata: 50 | labels: 51 | app: org2-peer1 52 | spec: 53 | containers: 54 | - name: main 55 | image: {{LOCAL_CONTAINER_REGISTRY}}/fabric-peer:{{FABRIC_VERSION}} 56 | envFrom: 57 | - configMapRef: 58 | name: org2-peer1-config 59 | ports: 60 | - containerPort: 7051 61 | - containerPort: 7052 62 | - containerPort: 9443 63 | volumeMounts: 64 | - name: fabric-volume 65 | mountPath: /var/hyperledger 66 | - name: fabric-config 67 | mountPath: /var/hyperledger/fabric/config 68 | - name: ccs-builder 69 | mountPath: /var/hyperledger/fabric/chaincode/ccs-builder/bin 70 | 71 | # load the external chaincode builder into the peer image prior to peer launch. 72 | initContainers: 73 | - name: fabric-ccs-builder 74 | image: ghcr.io/hyperledgendary/fabric-ccs-builder 75 | imagePullPolicy: IfNotPresent 76 | command: [sh, -c] 77 | args: ["cp /go/bin/* /var/hyperledger/fabric/chaincode/ccs-builder/bin/"] 78 | volumeMounts: 79 | - name: ccs-builder 80 | mountPath: /var/hyperledger/fabric/chaincode/ccs-builder/bin 81 | 82 | volumes: 83 | - name: fabric-volume 84 | persistentVolumeClaim: 85 | claimName: fabric-org2 86 | - name: fabric-config 87 | configMap: 88 | name: org2-config 89 | - name: ccs-builder 90 | emptyDir: {} 91 | 92 | --- 93 | apiVersion: v1 94 | kind: Service 95 | metadata: 96 | name: org2-peer1 97 | labels: 98 | app: org2-peer1 99 | spec: 100 | ports: 101 | - name: gossip 102 | port: 7051 103 | protocol: TCP 104 | - name: chaincode 105 | port: 7052 106 | protocol: TCP 107 | - name: operations 108 | port: 9443 109 | protocol: TCP 110 | selector: 111 | app: org2-peer1 112 | 113 | --- 114 | apiVersion: monitoring.coreos.com/v1 115 | kind: ServiceMonitor 116 | metadata: 117 | name: org2-peer1 118 | namespace: default 119 | labels: 120 | release: mypro #Prometheus所选择的标签 121 | spec: 122 | namespaceSelector: #监控的pod所在名称空间 123 | matchNames: 124 | - default 125 | selector: 126 | matchLabels: 127 | app: org2-peer1 128 | endpoints: 129 | - port: operations -------------------------------------------------------------------------------- /kube/jaeger/deploy/cluster_role.yaml: -------------------------------------------------------------------------------- 1 | ## When using the operator in cluster-wide mode, this ClusterRole has to be created and bound to the jaeger-operator service account, 2 | ## so that the operator can watch and create resources in every namespace in the cluster. 3 | ## An alternative to this cluster role is to create one role binding for each namespace that the operator should watch 4 | ## in that case, don't forget to add a comma-separated list of namespaces as WATCH_NAMESPACE in the operator's deployment. 5 | ## Further down in this file there's another set of rules, with extra optional permissions 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | kind: ClusterRole 8 | metadata: 9 | name: jaeger-operator 10 | rules: 11 | 12 | ## our own custom resources 13 | - apiGroups: 14 | - jaegertracing.io 15 | resources: 16 | - '*' 17 | verbs: 18 | - create 19 | - delete 20 | - get 21 | - list 22 | - patch 23 | - update 24 | - watch 25 | 26 | ## for the operator's own deployment 27 | - apiGroups: 28 | - apps 29 | resourceNames: 30 | - jaeger-operator 31 | resources: 32 | - deployments/finalizers 33 | verbs: 34 | - update 35 | 36 | ## regular things the operator manages for an instance, as the result of processing CRs 37 | - apiGroups: 38 | - "" 39 | resources: 40 | - configmaps 41 | - persistentvolumeclaims 42 | - pods 43 | - secrets 44 | - serviceaccounts 45 | - services 46 | - services/finalizers 47 | verbs: 48 | - create 49 | - delete 50 | - get 51 | - list 52 | - patch 53 | - update 54 | - watch 55 | - apiGroups: 56 | - apps 57 | resources: 58 | - deployments 59 | - daemonsets 60 | - replicasets 61 | - statefulsets 62 | verbs: 63 | - create 64 | - delete 65 | - get 66 | - list 67 | - patch 68 | - update 69 | - watch 70 | - apiGroups: 71 | - extensions 72 | resources: 73 | - ingresses 74 | verbs: 75 | - create 76 | - delete 77 | - get 78 | - list 79 | - patch 80 | - update 81 | - watch 82 | # Ingress for kubernetes 1.14 or higher 83 | - apiGroups: 84 | - networking.k8s.io 85 | resources: 86 | - ingresses 87 | verbs: 88 | - create 89 | - delete 90 | - get 91 | - list 92 | - patch 93 | - update 94 | - watch 95 | - apiGroups: 96 | - batch 97 | resources: 98 | - jobs 99 | - cronjobs 100 | verbs: 101 | - create 102 | - delete 103 | - get 104 | - list 105 | - patch 106 | - update 107 | - watch 108 | - apiGroups: 109 | - route.openshift.io 110 | resources: 111 | - routes 112 | verbs: 113 | - create 114 | - delete 115 | - get 116 | - list 117 | - patch 118 | - update 119 | - watch 120 | - apiGroups: 121 | - console.openshift.io 122 | resources: 123 | - consolelinks 124 | verbs: 125 | - create 126 | - delete 127 | - get 128 | - list 129 | - patch 130 | - update 131 | - watch 132 | - apiGroups: 133 | - autoscaling 134 | resources: 135 | - horizontalpodautoscalers 136 | verbs: 137 | - create 138 | - delete 139 | - get 140 | - list 141 | - patch 142 | - update 143 | - watch 144 | 145 | ## needed if you want the operator to create service monitors for the Jaeger instances 146 | - apiGroups: 147 | - monitoring.coreos.com 148 | resources: 149 | - servicemonitors 150 | verbs: 151 | - create 152 | - delete 153 | - get 154 | - list 155 | - patch 156 | - update 157 | - watch 158 | 159 | ## for the Elasticsearch auto-provisioning 160 | - apiGroups: 161 | - logging.openshift.io 162 | resources: 163 | - elasticsearches 164 | verbs: 165 | - create 166 | - delete 167 | - get 168 | - list 169 | - patch 170 | - update 171 | - watch 172 | 173 | ## for the Kafka auto-provisioning 174 | - apiGroups: 175 | - kafka.strimzi.io 176 | resources: 177 | - kafkas 178 | - kafkausers 179 | verbs: 180 | - create 181 | - delete 182 | - get 183 | - list 184 | - patch 185 | - update 186 | - watch 187 | 188 | ## Extra permissions 189 | ## This is an extra set of permissions that the Jaeger Operator might make use of if granted 190 | 191 | ## needed if support for injecting sidecars based on namespace annotation is required 192 | - apiGroups: 193 | - "" 194 | resources: 195 | - namespaces 196 | verbs: 197 | - 'get' 198 | - 'list' 199 | - 'watch' 200 | 201 | ## needed if support for injecting sidecars based on deployment annotation is required, across all namespaces 202 | - apiGroups: 203 | - apps 204 | resources: 205 | - deployments 206 | verbs: 207 | - get 208 | - list 209 | - patch 210 | - update 211 | - watch 212 | 213 | ## needed only when .Spec.Ingress.Openshift.DelegateUrls is used 214 | - apiGroups: 215 | - rbac.authorization.k8s.io 216 | resources: 217 | - clusterrolebindings 218 | verbs: 219 | - create 220 | - delete 221 | - get 222 | - list 223 | - patch 224 | - update 225 | - watch 226 | -------------------------------------------------------------------------------- /SUT/fabric/chaincode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | set -o errexit 5 | #set -x 6 | 7 | function chaincode_deploy() { 8 | #set -x 9 | echo "starting chaincode deployment" 10 | install_chaincode 11 | launch_chaincode_service org1 $CHAINCODE_ID $CHAINCODE_IMAGE 12 | activate_chaincode 13 | echo "complete chaincode deployment" 14 | } 15 | 16 | function chaincode_invoke() { 17 | echo "invoking chaincode" 18 | echo $@ 19 | echo ' 20 | export CORE_PEER_ADDRESS=org1-peer1:7051 21 | peer chaincode \ 22 | invoke \ 23 | -o org0-orderer1:6050 \ 24 | --tls --cafile /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/msp/tlscacerts/org0-tls-ca.pem \ 25 | -n '${CHAINCODE_NAME}' \ 26 | -C '${CHANNEL_NAME}' \ 27 | -c '"'$@'"' 28 | ' | exec kubectl -n $NS exec deploy/org1-admin-cli -c main -i -- /bin/bash 29 | 30 | sleep 2 31 | echo "complete invoking chaincode" 32 | } 33 | 34 | function chaincode_query() { 35 | echo "query chaincode" 36 | echo ' 37 | export CORE_PEER_ADDRESS=org1-peer1:7051 38 | peer chaincode query -n '${CHAINCODE_NAME}' -C '${CHANNEL_NAME}' -c '"'$@'"' 39 | ' | exec kubectl -n $NS exec deploy/org1-admin-cli -c main -i -- /bin/bash 40 | echo "complete query chaincode" 41 | } 42 | 43 | # Package and install the chaincode, but do not activate. 44 | function install_chaincode() { 45 | local org=org1 46 | 47 | package_chaincode_for ${org} 48 | transfer_chaincode_archive_for ${org} 49 | install_chaincode_for ${org} 50 | 51 | set_chaincode_id 52 | } 53 | 54 | function package_chaincode_for() { 55 | local org=$1 56 | local cc_folder="chaincode/${CHAINCODE_NAME}" 57 | local build_folder="./build/chaincode" 58 | local cc_archive="${build_folder}/${CHAINCODE_NAME}.tgz" 59 | echo "Packaging chaincode folder ${cc_folder}" 60 | 61 | mkdir -p ${build_folder} 62 | 63 | tar -C ${cc_folder} -zcf ${cc_folder}/code.tar.gz connection.json 64 | tar -C ${cc_folder} -zcf ${cc_archive} code.tar.gz metadata.json 65 | 66 | rm ${cc_folder}/code.tar.gz 67 | } 68 | 69 | function transfer_chaincode_archive_for() { 70 | local org=$1 71 | local cc_archive="build/chaincode/${CHAINCODE_NAME}.tgz" 72 | echo "Transferring chaincode archive to ${org}" 73 | 74 | # Like kubectl cp, but targeted to a deployment rather than an individual pod. 75 | tar cf - ${cc_archive} | kubectl -n $NS exec -i deploy/${org}-admin-cli -c main -- tar xvf - 76 | } 77 | 78 | function install_chaincode_for() { 79 | local org=$1 80 | echo "Installing chaincode for org ${org}" 81 | 82 | # Install the chaincode 83 | echo 'set -x 84 | export CORE_PEER_ADDRESS='${org}'-peer1:7051 85 | peer lifecycle chaincode install build/chaincode/'${CHAINCODE_NAME}'.tgz 86 | ' | exec kubectl -n $NS exec deploy/${org}-admin-cli -c main -i -- /bin/bash 87 | } 88 | 89 | function set_chaincode_id() { 90 | local cc_sha256=$(shasum -a 256 build/chaincode/${CHAINCODE_NAME}.tgz | tr -s ' ' | cut -d ' ' -f 1) 91 | 92 | CHAINCODE_ID=${CHAINCODE_LABEL}:${cc_sha256} 93 | } 94 | 95 | function launch_chaincode_service() { 96 | local org=$1 97 | local cc_id=$2 98 | local cc_image=$3 99 | echo "Launching chaincode container \"${cc_image}\"" 100 | 101 | # The chaincode endpoint needs to have the generated chaincode ID available in the environment. 102 | # This could be from a config map, a secret, or by directly editing the deployment spec. Here we'll keep 103 | # things simple by using sed to substitute script variables into a yaml template. 104 | cat kube/${org}/${org}-cc-template.yaml \ 105 | | sed 's,{{CHAINCODE_NAME}},'${CHAINCODE_NAME}',g' \ 106 | | sed 's,{{CHAINCODE_ID}},'${cc_id}',g' \ 107 | | sed 's,{{CHAINCODE_IMAGE}},'${cc_image}',g' \ 108 | | exec kubectl -n $NS apply -f - 109 | 110 | kubectl -n $NS rollout status deploy/${org}-cc-${CHAINCODE_NAME} 111 | } 112 | 113 | function activate_chaincode() { 114 | set_chaincode_id 115 | activate_chaincode_for org1 $CHAINCODE_ID 116 | } 117 | 118 | function activate_chaincode_for() { 119 | local org=$1 120 | local cc_id=$2 121 | echo "Activating chaincode ${CHAINCODE_ID}" 122 | 123 | echo 'set -x 124 | export CORE_PEER_ADDRESS='${org}'-peer1:7051 125 | 126 | peer lifecycle \ 127 | chaincode approveformyorg \ 128 | --channelID '${CHANNEL_NAME}' \ 129 | --name '${CHAINCODE_NAME}' \ 130 | --version 1 \ 131 | --package-id '${cc_id}' \ 132 | --sequence 1 \ 133 | -o org0-orderer1:6050 \ 134 | --tls --cafile /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/msp/tlscacerts/org0-tls-ca.pem 135 | 136 | peer lifecycle \ 137 | chaincode commit \ 138 | --channelID '${CHANNEL_NAME}' \ 139 | --name '${CHAINCODE_NAME}' \ 140 | --version 1 \ 141 | --sequence 1 \ 142 | -o org0-orderer1:6050 \ 143 | --tls --cafile /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/msp/tlscacerts/org0-tls-ca.pem 144 | ' | exec kubectl -n $NS exec deploy/${org}-admin-cli -c main -i -- /bin/bash 145 | 146 | echo "Complete activating chaincode ${CHAINCODE_ID}" 147 | } 148 | 149 | function buildchaincode() { 150 | #set -x 151 | local path=$1 152 | docker build $path --tag=${CHAINCODE_IMAGE} 153 | kind load docker-image ${CHAINCODE_IMAGE} 154 | } -------------------------------------------------------------------------------- /SUT/fabric/channel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | set -o errexit 5 | #set -x 6 | 7 | function create_channel() { 8 | echo "start fabric channel creation" 9 | create_channel_MSP 10 | aggregate_channel_MSP 11 | launch_admin_CLIs 12 | 13 | create_genesis_block 14 | join_peers 15 | echo "complete fabric channel creation" 16 | } 17 | 18 | function create_channel_org_MSP() { 19 | local org=$1 20 | local org_type=$2 21 | local ecert_ca=${org}-ecert-ca 22 | 23 | echo 'set -x 24 | 25 | mkdir -p /var/hyperledger/fabric/organizations/'${org_type}'Organizations/'${org}'.example.com/msp/cacerts 26 | cp \ 27 | $FABRIC_CA_CLIENT_HOME/'${ecert_ca}'/rcaadmin/msp/cacerts/'${ecert_ca}'.pem \ 28 | /var/hyperledger/fabric/organizations/'${org_type}'Organizations/'${org}'.example.com/msp/cacerts 29 | 30 | mkdir -p /var/hyperledger/fabric/organizations/'${org_type}'Organizations/'${org}'.example.com/msp/tlscacerts 31 | cp \ 32 | $FABRIC_CA_CLIENT_HOME/tls-ca/tlsadmin/msp/cacerts/'${org}'-tls-ca.pem \ 33 | /var/hyperledger/fabric/organizations/'${org_type}'Organizations/'${org}'.example.com/msp/tlscacerts 34 | 35 | echo "NodeOUs: 36 | Enable: true 37 | ClientOUIdentifier: 38 | Certificate: cacerts/'${ecert_ca}'.pem 39 | OrganizationalUnitIdentifier: client 40 | PeerOUIdentifier: 41 | Certificate: cacerts/'${ecert_ca}'.pem 42 | OrganizationalUnitIdentifier: peer 43 | AdminOUIdentifier: 44 | Certificate: cacerts/'${ecert_ca}'.pem 45 | OrganizationalUnitIdentifier: admin 46 | OrdererOUIdentifier: 47 | Certificate: cacerts/'${ecert_ca}'.pem 48 | OrganizationalUnitIdentifier: orderer "> /var/hyperledger/fabric/organizations/'${org_type}'Organizations/'${org}'.example.com/msp/config.yaml 49 | 50 | ' | exec kubectl -n $NS exec deploy/${ecert_ca} -i -- /bin/sh 51 | } 52 | 53 | function create_channel_MSP() { 54 | echo "Creating channel MSP" 55 | 56 | create_channel_org_MSP org0 orderer 57 | create_channel_org_MSP org1 peer 58 | create_channel_org_MSP org2 peer 59 | 60 | echo "Complete creating channel MSP" 61 | } 62 | 63 | 64 | function aggregate_channel_MSP() { 65 | echo "Aggregating channel MSP" 66 | 67 | rm -rf ./build/msp/ 68 | mkdir -p ./build/msp 69 | 70 | kubectl -n $NS exec deploy/org0-ecert-ca -- tar zcvf - -C /var/hyperledger/fabric organizations/ordererOrganizations/org0.example.com/msp > build/msp/msp-org0.example.com.tgz 71 | kubectl -n $NS exec deploy/org1-ecert-ca -- tar zcvf - -C /var/hyperledger/fabric organizations/peerOrganizations/org1.example.com/msp > build/msp/msp-org1.example.com.tgz 72 | kubectl -n $NS exec deploy/org2-ecert-ca -- tar zcvf - -C /var/hyperledger/fabric organizations/peerOrganizations/org2.example.com/msp > build/msp/msp-org2.example.com.tgz 73 | 74 | kubectl -n $NS delete configmap msp-config || true 75 | kubectl -n $NS create configmap msp-config --from-file=build/msp/ 76 | 77 | echo "Complete aggregating channel MSP" 78 | } 79 | 80 | function launch_admin_CLIs() { 81 | echo "Launching admin CLIs" 82 | 83 | launch kube/org0/org0-admin-cli.yaml 84 | launch kube/org1/org1-admin-cli.yaml 85 | launch kube/org2/org2-admin-cli.yaml 86 | 87 | kubectl -n $NS rollout status deploy/org0-admin-cli 88 | kubectl -n $NS rollout status deploy/org1-admin-cli 89 | kubectl -n $NS rollout status deploy/org2-admin-cli 90 | 91 | echo "Complete Launching admin CLIs" 92 | } 93 | 94 | function create_genesis_block() { 95 | echo "Creating channel \"${CHANNEL_NAME}\"" 96 | 97 | echo 'set -x 98 | configtxgen -profile TwoOrgsApplicationGenesis -channelID '${CHANNEL_NAME}' -outputBlock genesis_block.pb 99 | # configtxgen -inspectBlock genesis_block.pb 100 | 101 | osnadmin channel join --orderer-address org0-orderer1:9443 --channelID '${CHANNEL_NAME}' --config-block genesis_block.pb 102 | osnadmin channel join --orderer-address org0-orderer2:9443 --channelID '${CHANNEL_NAME}' --config-block genesis_block.pb 103 | osnadmin channel join --orderer-address org0-orderer3:9443 --channelID '${CHANNEL_NAME}' --config-block genesis_block.pb 104 | 105 | ' | exec kubectl -n $NS exec deploy/org0-admin-cli -i -- /bin/bash 106 | 107 | # todo: readiness / liveiness equivalent for channel ? Needs a little bit to settle before peers can join. 108 | sleep 10 109 | 110 | echo "Complete creating channel \"${CHANNEL_NAME}\"" 111 | } 112 | 113 | function join_peers() { 114 | join_org_peers org1 115 | join_org_peers org2 116 | } 117 | 118 | function join_org_peers() { 119 | local org=$1 120 | echo "Joining ${org} peers to channel \"${CHANNEL_NAME}\"" 121 | 122 | echo 'set -x 123 | # Fetch the genesis block from an orderer 124 | peer channel \ 125 | fetch oldest \ 126 | genesis_block.pb \ 127 | -c '${CHANNEL_NAME}' \ 128 | -o org0-orderer1:6050 \ 129 | --tls --cafile /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/msp/tlscacerts/org0-tls-ca.pem 130 | 131 | # Join peer1 to the channel. 132 | CORE_PEER_ADDRESS='${org}'-peer1:7051 \ 133 | peer channel \ 134 | join \ 135 | -b genesis_block.pb \ 136 | -o org0-orderer1:6050 \ 137 | --tls --cafile /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/msp/tlscacerts/org0-tls-ca.pem 138 | 139 | # Join peer2 to the channel. 140 | CORE_PEER_ADDRESS='${org}'-peer2:7051 \ 141 | peer channel \ 142 | join \ 143 | -b genesis_block.pb \ 144 | -o org0-orderer1:6050 \ 145 | --tls --cafile /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/msp/tlscacerts/org0-tls-ca.pem 146 | 147 | ' | exec kubectl -n $NS exec deploy/${org}-admin-cli -i -- /bin/bash 148 | 149 | echo "Complete joining ${org} peers to channel \"${CHANNEL_NAME}\"" 150 | } -------------------------------------------------------------------------------- /infra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | set -o errexit 5 | #set -x 6 | CLUSTER_NAME=${ENV_KIND_CLUSTER_NAME:-kind} 7 | 8 | LOCAL_REGISTRY_NAME=${ENV_LOCAL_REGISTRY_NAME:-kind-registry} 9 | LOCAL_REGISTRY_PORT=${ENV_LOCAL_REGISTRY_PORT:-5000} 10 | 11 | NGINX_HTTP_PORT=${ENV_NETWORK_INGRESS_HTTP_PORT:-80} 12 | NGINX_HTTPS_PORT=${ENV_NETWORK_INGRESS_HTTPS_PORT:-443} 13 | 14 | main() { 15 | check_prereqs 16 | ## Parse mode 17 | if [[ $# -lt 1 ]] ; then 18 | print_help 19 | exit 0 20 | else 21 | MODE=$1 22 | shift 23 | fi 24 | 25 | if [ "${MODE}" == "up" ]; then 26 | kind_init 27 | elif [ "${MODE}" == "down" ]; then 28 | kind_unkind 29 | elif [ "${MODE}" == "load_image" ]; then 30 | load_image 31 | elif [ "${MODE}" == "verify" ]; then 32 | verify 33 | elif [ "${MODE}" == "portforward" ]; then 34 | portforward 35 | elif [ "${MODE}" == "prometheus" ]; then 36 | prometheus_init 37 | elif [ "${MODE}" == "jaeger" ]; then 38 | jaeger_init 39 | else 40 | print_help 41 | exit 1 42 | fi 43 | } 44 | 45 | function print_help() { 46 | echo "./infra.sh up for start k8s base on kind" 47 | echo "./infra.sh load_image for load images to kind(optional)" 48 | echo "./infra.sh verify for verify the deployment" 49 | echo "./infra.sh portforward for monitoring pods port forward " 50 | echo "./infra.sh prometheus for init prometheus" 51 | echo "./infra.sh jaeger for init jaeger operator" 52 | echo "./infra.sh down for clean up" 53 | } 54 | 55 | function kind_init() { 56 | echo "Starting kind with cluster name \"${CLUSTER_NAME}\"" 57 | 58 | local reg_name=${LOCAL_REGISTRY_NAME} 59 | local reg_port=${LOCAL_REGISTRY_PORT} 60 | local ingress_http_port=${NGINX_HTTP_PORT} 61 | local ingress_https_port=${NGINX_HTTPS_PORT} 62 | docker rm -f ${reg_name} 63 | kind delete cluster --name $CLUSTER_NAME 64 | 65 | cat </dev/null || true)" 97 | if [ "${running}" != 'true' ]; then 98 | docker run \ 99 | -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \ 100 | registry:2 101 | fi 102 | 103 | # connect the registry to the cluster network 104 | # (the network may already be connected) 105 | docker network connect "kind" "${reg_name}" || true 106 | 107 | # Document the local registry 108 | # https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry 109 | cat < /dev/null 167 | if [[ $? -ne 0 ]]; then 168 | echo "No 'docker' binary available? (https://www.docker.com)" 169 | exit 1 170 | fi 171 | 172 | #kind version > /dev/null 173 | #if [[ $? -ne 0 ]]; then 174 | # echo "No 'kind' binary available? (https://kind.sigs.k8s.io/docs/user/quick-start/#installation)" 175 | # exit 1 176 | #fi 177 | 178 | kubectl > /dev/null 179 | if [[ $? -ne 0 ]]; then 180 | echo "No 'kubectl' binary available? (https://kubernetes.io/docs/tasks/tools/)" 181 | exit 1 182 | fi 183 | } 184 | 185 | function verify() { 186 | echo "Verify prometheus and jaeger, in all namespaces" 187 | kubectl get po -n monitoring 188 | kubectl get po -n observability 189 | kubectl get po 190 | echo "Complete Verify prometheus and jaeger,in all namespaces" 191 | } 192 | 193 | function portforward() { 194 | echo "Start port forwarding in backend" 195 | nohup kubectl --namespace monitoring port-forward svc/grafana 3000 & 196 | nohup kubectl port-forward svc/simplest-query 16686 & 197 | echo "end port forwarding in backend" 198 | } 199 | 200 | function load_image() { 201 | echo "Start load images to kind" 202 | for image in `cat ./image_list`; do 203 | echo "Loading image $image to kind" 204 | kind load docker-image $image 205 | done 206 | echo "Complete load images to kind" 207 | } 208 | 209 | main $* 210 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Status Badge](https://img.shields.io/badge/Status-archived-red) 2 | 3 | **NOTE:** This lab has been archived and is no longer being maintained. 4 | 5 | # PerformanceSandBox 6 | 7 | ## Short Description 8 | The Performance Sandbox is a Sandbox for Hyperledger Projects Performance research usage. It allows easy use of performance related works with this sandbox lab. 9 | 10 | ## Scope of Project 11 | PSWG published [white paper](https://www.hyperledger.org/wp-content/uploads/2018/10/HL_Whitepaper_Metrics_PDFVersion.pdf) in previous activities. Ref to a sample blockchain network as below, defined serval metrics. 12 | ![What is Performance Sandbox](./docs/images/PerformanceSandBox(2022May).png "What is Perfomance Sandbox") 13 | Now with this proejct, we are upgrading observer client from traditional monitoring to observability and monitoring in the future. 14 | 15 | > Traditional Monitoring 16 | Traditionally, monitoring has focused on time series metrics. The process was always the same; collect a bunch of metrics, put those metrics on charts on dashboards, figure out which metrics to set alerts for, and choose some thresholds for alerting. 17 | 18 | > Observability 19 | While still including all the numbers and graphs from monitoring, it adds the knowledge of what is meaningful to be monitored to all the different, previously separate teams. On top of that, Observability adds Distributed Tracing, basically a microservices stack trace. What that means will be discussed in a few minutes. And not to forget, meaningful log analytics, far beyond the simple regex based error search. We gather information directly from the inside of the service and bring it together with everything else we know of the system. When looking at Observability we see three pillars to bring insight and understanding into our issue: Health and Performance Metrics, (Distributed) Traces, and Logs. 20 | 21 | > Monitoring 22 | Monitoring is the process that connects observability and controllability. Controllability here being the ability to rectify the system when its inferred state deviates or needs to adapt to changes including those within the environment or the management process. 23 | 24 | Which means we are going to support Metrics, (Distributed) Traces, and Logs with a all in one sandbox, as PerformanceSandbox. It will gather information directly from the inside of the service and bring it together. Get ready for any kind observability or operator relate things with user's business, by basic information/data collection. 25 | 26 | ## What's benefits for you with PerformanceSandbox 27 | By bring monitoring from the inside of applications and 28 | services, and bring it together with everything else we know of the system. So that we are further design, think and evaluate performance from different perspectives, either single service or system as a whole. 29 | 1. PerformanceSandbox helps you understand metrics, shortcomings and evolutions for your blockchain service by analyzing bottlenecks or scalability. 30 | 1. PerformanceSandbox helps you start with a performance or operator related work(or observability driven development in short), as it can be your local development env. 31 | 32 | ## Target for this PerformanceSandbox 33 | Find and define new things with blockchain performance, as in blockchain world, it is distributed and has different workloads amang IO as network, file system, and crypto logic generally as compute works. Hence by PerformanceSandbox we hope to make 34 | - Single Tx analysis from black box to white box by distributed tracing. 35 | Traditionally, when we talking about letnecy and other metrics for specific transaction, we rely on timestemp from different part of components. Hence, by distributed tracing, we are attempting to make analysis from black box to white box. To get better understanding as how much time spend on crypto, IO, consensus, etc. 36 | - Overall system insight for blockchain system performance. By collection all information as system status as metrics or others, we can have a insight from overall side. For example, 37 | > In previous white paper defined metric as read latency for specific transactions, and now, are we able to have a p99 read latency happens on application or sdk side? 38 | 39 | > Considering crypto is heavy compute workload on CPU, by gathering CPU metrics and latency metrics together, it's easy for us to know if workload too much or not. 40 | 41 | ## Design & implementation 42 | PerformanceSandbox bases on kubernetes(as kind/minikube) as infrastructure, integrated with logging, metrics and distributed tracing. 43 | - PerformanceSandbox supports user deploy a target network(as test-network for asset transform for Fabric), as SUT(system under test). 44 | - PerformanceSandbox supports any traffic generator such as [Tape](https://github.com/Hyperledger-TWGC/tape), keep sending traffic to the target network/SUT. 45 | 46 | ### Flexible is considered and discussed: 47 | - Migration from Kind/Minikube to other k8s platform. In this lab, we will use k8s as infrastructure, hence it is easy to migrate to any other k8s based infrastructure. 48 | - Replace with other blockchain system from Fabric to others. So far, the POC and demos been made base on Hyperledger Fabric, as the orange area shows the blockchain system, can be replaced with any kind of blockchain system you wanted. 49 | - Traffic generator, so far deployed demo with Tape, as it is k8s development. It can be replaced with Caliper or Jmeter. Tape is a sample performance tool for Hyperledger Fabric without SDK(close to blockchain network itself). Caliper is based on Hyperledger Fabric SDK(more close to application level). For Jmeter, assuming you expose RESTFUL endpoint to enduser. You may need use Jmeter to create traffic as end to end performance research. 50 | - Size of SUT, you are able to scale the size for SUT, as it is blockchain based on k8s. 51 | 52 | ## Features(currently support Hyperledger Fabric) 53 | - [x] [Deploy monitoring system to Kind or minikube.](./docs/k8s.md) 54 | - [x] [Dashboard for monitoring system.](./docs/dashboard.md) 55 | - [x] [Deploy fabric network.](./docs/SUT.md) 56 | - [x] [Deploy your own chaincode for test as NFT.](./docs/SUT.md) 57 | - [x] [Deploy traffic generator system.](./docs/Traffic.md) 58 | - [x] [Deploy with local image support.](./docs/SUT.md) 59 | - [x] [Deploy Sample application support.](./docs/App.md) 60 | - [x] [Test Sample application with jmeter](./docs/App.md) 61 | 62 | ## [FAQ](https://github.com/hyperledger-labs/PerformanceSandBox/wiki/FAQ) 63 | 64 | ## Initial Committers 65 | - [Sam Yuan](https://github.com/SamYuan1990) 66 | 67 | # Code of Conduct guidelines 68 | Please review the Hyperledger [Code of 69 | Conduct](https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct) 70 | before participating. It is important that we keep things civil. 71 | 72 | ## Contribution 73 | Here is steps in short for any contribution. 74 | 1. check license and code of conduct 75 | 1. fork this project 76 | 1. make your own feature branch 77 | 1. change and commit your changes, please use `git commit -s` to commit as we enabled [DCO](https://probot.github.io/apps/dco/) 78 | 1. raise PR 79 | 80 | ## Sponsor 81 | - haris.javaid@amd.com - Member of Hyperledger PSWG 82 | 83 | ## [Project meeting](https://wiki.hyperledger.org/display/PSWG/Performance+and+Scale+Working+Group) 84 | -------------------------------------------------------------------------------- /App/fabric/jmeter/HTTPRequest.jmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | false 7 | true 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | continue 17 | 18 | false 19 | 100 20 | 21 | 1 22 | 1 23 | false 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | false 34 | 35 | = 36 | true 37 | 38 | 39 | 40 | localhost 41 | 3001 42 | http 43 | 44 | /api/assets/5 45 | GET 46 | true 47 | false 48 | true 49 | false 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | X-Api-Key 59 | 97834158-3224-4CE7-95F9-A148C886653E 60 | 61 | 62 | Content-Type 63 | application/json 64 | 65 | 66 | 67 | 68 | 69 | false 70 | 71 | saveConfig 72 | 73 | 74 | true 75 | true 76 | true 77 | 78 | true 79 | true 80 | true 81 | true 82 | false 83 | true 84 | true 85 | false 86 | false 87 | false 88 | true 89 | false 90 | false 91 | false 92 | true 93 | 0 94 | true 95 | true 96 | true 97 | true 98 | true 99 | true 100 | 101 | 102 | 103 | 104 | 105 | 106 | false 107 | 108 | saveConfig 109 | 110 | 111 | true 112 | true 113 | true 114 | 115 | true 116 | true 117 | true 118 | true 119 | false 120 | true 121 | true 122 | false 123 | false 124 | false 125 | true 126 | false 127 | false 128 | false 129 | true 130 | 0 131 | true 132 | true 133 | true 134 | true 135 | true 136 | true 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /SUT/fabric/chaincode/nftsamplecode/erc721-contract_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/base64" 5 | "testing" 6 | 7 | "github.com/hyperledger/fabric-chaincode-go/pkg/cid" 8 | "github.com/hyperledger/fabric-chaincode-go/shim" 9 | "github.com/hyperledger/fabric-contract-api-go/contractapi" 10 | "github.com/hyperledger/fabric-protos-go/ledger/queryresult" 11 | 12 | "github.com/stretchr/testify/assert" 13 | "github.com/stretchr/testify/mock" 14 | ) 15 | 16 | const owner = "x509::CN=minter,OU=client,O=Hyperledger,ST=North Carolina,C=US::CN=ca.org1.example.com,O=org1.example.com,L=Durham,ST=North Carolina,C=US" 17 | const operator = "x509::CN=hlp,OU=client,O=Hyperledger,ST=North Carolina,C=US::CN=ca.org1.example.com,O=org1.example.com,L=Durham,ST=North Carolina,C=AR" 18 | 19 | type MockStub struct { 20 | shim.ChaincodeStubInterface 21 | mock.Mock 22 | } 23 | 24 | func (ms *MockStub) GetStateByPartialCompositeKey(objectType string, keys []string) (shim.StateQueryIteratorInterface, error) { 25 | args := ms.Called(objectType, keys) 26 | return args.Get(0).(shim.StateQueryIteratorInterface), args.Error(1) 27 | } 28 | 29 | func (ms *MockStub) GetState(key string) ([]byte, error) { 30 | args := ms.Called(key) 31 | return args.Get(0).([]byte), args.Error(1) 32 | } 33 | 34 | func (ms *MockStub) PutState(key string, value []byte) error { 35 | args := ms.Called(key, value) 36 | return args.Error(0) 37 | } 38 | func (ms *MockStub) SetEvent(key string, value []byte) error { 39 | args := ms.Called(key, value) 40 | return args.Error(0) 41 | } 42 | 43 | func (ms *MockStub) DelState(key string) error { 44 | args := ms.Called(key) 45 | return args.Error(0) 46 | } 47 | 48 | func (ms *MockStub) CreateCompositeKey(objectType string, attributes []string) (string, error) { 49 | args := ms.Called(objectType, attributes) 50 | return args.Get(0).(string), args.Error(1) 51 | } 52 | 53 | type MockClientIdentity struct { 54 | cid.ClientIdentity 55 | mock.Mock 56 | } 57 | 58 | func (mci *MockClientIdentity) GetID() (string, error) { 59 | args := mci.Called() 60 | return args.Get(0).(string), args.Error(1) 61 | } 62 | 63 | func (mci *MockClientIdentity) GetMSPID() (string, error) { 64 | args := mci.Called() 65 | return args.Get(0).(string), args.Error(1) 66 | } 67 | 68 | func (mc *MockContext) GetStub() shim.ChaincodeStubInterface { 69 | args := mc.Called() 70 | return args.Get(0).(*MockStub) 71 | } 72 | 73 | type MockContext struct { 74 | contractapi.TransactionContextInterface 75 | mock.Mock 76 | } 77 | 78 | func (mc *MockContext) GetClientIdentity() cid.ClientIdentity { 79 | args := mc.Called() 80 | return args.Get(0).(*MockClientIdentity) 81 | } 82 | 83 | type MockIterator struct { 84 | shim.StateQueryIteratorInterface 85 | queryresult.KV 86 | } 87 | 88 | func (it *MockIterator) HasNext() bool { 89 | return false 90 | } 91 | 92 | func setupStub() (*MockContext, *MockStub) { 93 | balancePrefix := "balance" 94 | approvalPrefix := "approval" 95 | nftPrefix := "nft" 96 | mockTokenId := "101" 97 | anyString := mock.AnythingOfType("string") 98 | anyUint8Slice := mock.AnythingOfType("[]uint8") 99 | nftStr := "{\"tokenId\":\"101\",\"owner\":\"" + owner + "\",\"tokenURI\":\"https://example.com/nft101.json\",\"approved\":\"" + operator + "\"}" 100 | approvalStr := "{\"owner\":\"" + owner + "\",\"operator\":\"" + owner + "\",\"approved\":true}" 101 | 102 | ms := new(MockStub) 103 | iterator := new(MockIterator) 104 | 105 | ms.On("GetStateByPartialCompositeKey", balancePrefix, []string{owner}).Return(iterator, nil) 106 | ms.On("GetStateByPartialCompositeKey", nftPrefix, []string{}).Return(iterator, nil) 107 | 108 | ms.On("CreateCompositeKey", nftPrefix, []string{mockTokenId}).Return("nft101", nil) 109 | ms.On("CreateCompositeKey", nftPrefix, []string{"102"}).Return("nft102", nil) 110 | ms.On("CreateCompositeKey", approvalPrefix, []string{owner, owner}).Return(approvalPrefix+owner+owner, nil) 111 | ms.On("CreateCompositeKey", approvalPrefix, []string{owner, operator}).Return(approvalPrefix+owner+operator, nil) 112 | ms.On("CreateCompositeKey", balancePrefix, []string{owner, mockTokenId}).Return(balancePrefix+owner+mockTokenId, nil) 113 | ms.On("CreateCompositeKey", balancePrefix, []string{operator, mockTokenId}).Return(balancePrefix+operator+mockTokenId, nil) 114 | ms.On("CreateCompositeKey", balancePrefix, []string{owner, "102"}).Return(balancePrefix+owner+mockTokenId, nil) 115 | 116 | ms.On("GetState", "nft101").Return([]byte(nftStr), nil) 117 | ms.On("GetState", "nft102").Return([]uint8{}, nil) 118 | ms.On("GetState", approvalPrefix+owner+owner).Return([]byte(approvalStr), nil) 119 | ms.On("GetState", "name").Return([]byte("lala"), nil) 120 | ms.On("GetState", "symbol").Return([]byte("lelo"), nil) 121 | 122 | ms.On("PutState", "name", []byte("someName")).Return(nil) 123 | ms.On("PutState", "symbol", []byte("someSymbol")).Return(nil) 124 | ms.On("PutState", anyString, anyUint8Slice).Return(nil) 125 | ms.On("PutState", balancePrefix+owner+"101", []byte{0}).Return(nil) 126 | ms.On("PutState", balancePrefix+owner+"102", []byte{'\u0000'}).Return(nil) 127 | ms.On("PutState", "nft101", []byte("nft101")).Return(nil) 128 | ms.On("PutState", "nft102", []byte("nft102")).Return(nil) 129 | 130 | ms.On("SetEvent", "ApprovalForAll", anyUint8Slice).Return(nil) 131 | ms.On("SetEvent", "Transfer", anyUint8Slice).Return(nil) 132 | 133 | ms.On("DelState", anyString).Return(nil) 134 | 135 | mci := new(MockClientIdentity) 136 | owner64 := base64.StdEncoding.EncodeToString([]byte(owner)) 137 | operator64 := base64.StdEncoding.EncodeToString([]byte(owner)) 138 | 139 | mci.On("GetID").Return(owner64, nil) 140 | mci.On("GetID").Return(operator64, nil) 141 | mci.On("GetMSPID").Return("Org1MSP", nil) 142 | 143 | mc := new(MockContext) 144 | mc.On("GetStub").Return(ms) 145 | mc.On("GetClientIdentity").Return(mci) 146 | return mc, ms 147 | } 148 | 149 | func TestBalanceOf(t *testing.T) { 150 | ctx, _ := setupStub() 151 | c := new(TokenERC721Contract) 152 | 153 | balance := c.BalanceOf(ctx, owner) 154 | assert.Equal(t, 0, balance) 155 | 156 | } 157 | func TestTotalSupply(t *testing.T) { 158 | ctx, _ := setupStub() 159 | c := new(TokenERC721Contract) 160 | totalNft := c.TotalSupply(ctx) 161 | assert.Equal(t, 0, totalNft) 162 | 163 | } 164 | 165 | func TestOwnerOf(t *testing.T) { 166 | ctx, _ := setupStub() 167 | c := new(TokenERC721Contract) 168 | 169 | owner, _ := c.OwnerOf(ctx, "101") 170 | assert.Equal(t, owner, owner) 171 | 172 | } 173 | 174 | func TestApprove(t *testing.T) { 175 | ctx, _ := setupStub() 176 | c := new(TokenERC721Contract) 177 | 178 | approved, _ := c.Approve(ctx, "", "101") 179 | assert.Equal(t, true, approved) 180 | 181 | } 182 | 183 | func TestSetApprovalForAll(t *testing.T) { 184 | ctx, _ := setupStub() 185 | c := new(TokenERC721Contract) 186 | 187 | appAll, _ := c.SetApprovalForAll(ctx, operator, true) 188 | assert.Equal(t, true, appAll) 189 | 190 | } 191 | 192 | func TestIsApprovedForAll(t *testing.T) { 193 | ctx, _ := setupStub() 194 | c := new(TokenERC721Contract) 195 | 196 | isApp, _ := c.SetApprovalForAll(ctx, operator, true) 197 | assert.Equal(t, true, isApp) 198 | 199 | } 200 | 201 | func TestGetApproved(t *testing.T) { 202 | ctx, _ := setupStub() 203 | c := new(TokenERC721Contract) 204 | 205 | getApp, _ := c.GetApproved(ctx, "101") 206 | assert.Equal(t, ""+operator+"", getApp) 207 | } 208 | 209 | func TestTransferFrom(t *testing.T) { 210 | ctx, _ := setupStub() 211 | c := new(TokenERC721Contract) 212 | 213 | transfer, _ := c.TransferFrom(ctx, owner, operator, "101") 214 | 215 | assert.Equal(t, true, transfer) 216 | } 217 | 218 | func TestName(t *testing.T) { 219 | ctx, _ := setupStub() 220 | c := new(TokenERC721Contract) 221 | 222 | name, _ := c.Name(ctx) 223 | 224 | assert.Equal(t, "lala", name) 225 | } 226 | 227 | func TestSymbol(t *testing.T) { 228 | ctx, _ := setupStub() 229 | c := new(TokenERC721Contract) 230 | 231 | symbol, _ := c.Symbol(ctx) 232 | 233 | assert.Equal(t, "lelo", symbol) 234 | } 235 | 236 | func TestTokenURI(t *testing.T) { 237 | ctx, _ := setupStub() 238 | c := new(TokenERC721Contract) 239 | 240 | tokenURI, _ := c.TokenURI(ctx, "101") 241 | 242 | assert.Equal(t, "https://example.com/nft101.json", tokenURI) 243 | } 244 | 245 | func TestSetOption(t *testing.T) { 246 | ctx, _ := setupStub() 247 | c := new(TokenERC721Contract) 248 | 249 | option, _ := c.SetOption(ctx, "someName", "someSymbol") 250 | assert.Equal(t, true, option) 251 | } 252 | 253 | func TestMintWithTokenURI(t *testing.T) { 254 | ctx, _ := setupStub() 255 | c := new(TokenERC721Contract) 256 | 257 | mint, _ := c.MintWithTokenURI(ctx, "102", "https://example.com/nft102.json") 258 | 259 | nft := new(Nft) 260 | nft.Owner = owner 261 | nft.TokenId = "102" 262 | nft.TokenURI = "https://example.com/nft102.json" 263 | 264 | assert.Equal(t, nft.Owner, mint.Owner) 265 | assert.Equal(t, nft, mint) 266 | 267 | } 268 | 269 | func TestBurn(t *testing.T) { 270 | ctx, _ := setupStub() 271 | c := new(TokenERC721Contract) 272 | 273 | burn, _ := c.Burn(ctx, "101") 274 | assert.Equal(t, true, burn) 275 | } 276 | 277 | func TestClientAccoundId(t *testing.T) { 278 | ctx, _ := setupStub() 279 | c := new(TokenERC721Contract) 280 | client, _ := c.ClientAccountID(ctx) 281 | assert.Equal(t, owner, client) 282 | } 283 | -------------------------------------------------------------------------------- /App/fabric/kube/fabric-rest-sample.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: ConfigMap 9 | metadata: 10 | name: fabric-rest-sample-config-example 11 | data: 12 | HLF_CONNECTION_PROFILE_ORG1: | 13 | { 14 | "name": "test-network-org1", 15 | "version": "1.0.0", 16 | "client": { 17 | "organization": "Org1", 18 | "connection": { 19 | "timeout": { 20 | "peer": { 21 | "endorser": "500" 22 | } 23 | } 24 | } 25 | }, 26 | "organizations": { 27 | "Org1": { 28 | "mspid": "Org1MSP", 29 | "peers": [ 30 | "org1-peers" 31 | ], 32 | "certificateAuthorities": [ 33 | "org1-ecert-ca" 34 | ] 35 | } 36 | }, 37 | "peers": { 38 | "org1-peers": { 39 | "url": "grpcs://org1-peer1:7051", 40 | "tlsCACerts": { 41 | "pem": "-----BEGIN CERTIFICATE-----\\nMIICvzCCAmWgAwIBAgIULJGws7jbEY6ruSgDuvi9L7VphvIwCgYIKoZIzj0EAwIw\\naDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK\\nEwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt\\nY2Etc2VydmVyMB4XDTIxMDkyMDE2MDkwMFoXDTIyMDkyMDE2MTQwMFowYDELMAkG\\nA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl\\ncmxlZGdlcjENMAsGA1UECxMEcGVlcjETMBEGA1UEAxMKb3JnMS1wZWVyMTBZMBMG\\nByqGSM49AgEGCCqGSM49AwEHA0IABL9e3GZBf1MeoObGxwSHkcgDEjMo+/13Qc4u\\nfSG2MKrveHBIEA4MRkHNqd+sTjoz0/1B15y2n+RiPo8uJvlyC/CjgfQwgfEwDgYD\\nVR0PAQH/BAQDAgOoMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNV\\nHRMBAf8EAjAAMB0GA1UdDgQWBBSeytspiXlEzMAsnF9/wxqc9fydETAfBgNVHSME\\nGDAWgBQwru1VH0OwH3dxfPdD8w74ZIlLRzAVBgNVHREEDjAMggpvcmcxLXBlZXIx\\nMFsGCCoDBAUGBwgBBE97ImF0dHJzIjp7ImhmLkFmZmlsaWF0aW9uIjoiIiwiaGYu\\nRW5yb2xsbWVudElEIjoib3JnMS1wZWVyMSIsImhmLlR5cGUiOiJwZWVyIn19MAoG\\nCCqGSM49BAMCA0gAMEUCIQDJEjPxceCfXU5B/emrHE4JbEzrZKxLVViBWCNMsHiR\\nFgIgY+8jsvr3rlBPkpRhl8CtT2DgaP7iWvovtMYsPKhLAqk=\\n-----END CERTIFICATE-----\\n" 42 | }, 43 | "grpcOptions": { 44 | "grpc-wait-for-ready-timeout": 100000, 45 | "ssl-target-name-override": "org1-peer1", 46 | "hostnameOverride": "org1-peer1" 47 | } 48 | } 49 | }, 50 | "certificateAuthorities": { 51 | "org1-ecert-ca": { 52 | "url": "https://org1-ecert-ca", 53 | "caName": "org1-ecert-ca", 54 | "tlsCACerts": { 55 | "pem": "TODO" 56 | }, 57 | "httpOptions": { 58 | "verify": "false" 59 | } 60 | } 61 | } 62 | } 63 | HLF_CERTIFICATE_ORG1: | 64 | -----BEGIN CERTIFICATE----- 65 | MIIC2DCCAn6gAwIBAgIUTfcXDyxCS+2EQnznfjERUo4Vri8wCgYIKoZIzj0EAwIw 66 | aDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK 67 | EwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt 68 | Y2Etc2VydmVyMB4XDTIxMDkyMDExNDEwMFoXDTIyMDkyMDExNDYwMFowYTELMAkG 69 | A1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl 70 | cmxlZGdlcjEOMAwGA1UECxMFYWRtaW4xEzARBgNVBAMTCm9yZzEtYWRtaW4wWTAT 71 | BgcqhkjOPQIBBggqhkjOPQMBBwNCAAT8zvJEg3FgJ5iUA5GO+n/j48bL83STpz7N 72 | TqejWIZNVTraxE4fjT6traKiswme7gT2NY9Jl0Dj4tbif9l2I9+Oo4IBCzCCAQcw 73 | DgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFO1zWPynvyER 74 | n9ml6XV5VvC9tIjTMB8GA1UdIwQYMBaAFPbIrI+lh8KayoRpW1YStWMhzJZSMCcG 75 | A1UdEQQgMB6CHG9yZzEtdGxzLWNhLTg1NjdiOTg5OWYtdzU3amYwfgYIKgMEBQYH 76 | CAEEcnsiYXR0cnMiOnsiYWJhYy5pbml0IjoidHJ1ZSIsImFkbWluIjoidHJ1ZSIs 77 | ImhmLkFmZmlsaWF0aW9uIjoiIiwiaGYuRW5yb2xsbWVudElEIjoib3JnMS1hZG1p 78 | biIsImhmLlR5cGUiOiJhZG1pbiJ9fTAKBggqhkjOPQQDAgNIADBFAiEAv99I2J9t 79 | WtOmIzpYix8OFl4Z+ZGRHtay83ux//sZP+MCID02hFqnNpOL/ggGFaDVpVQ/eu0t 80 | KTfVxZEMyZnJtAhp 81 | -----END CERTIFICATE----- 82 | HLF_PRIVATE_KEY_ORG1: | 83 | -----BEGIN PRIVATE KEY----- 84 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg7Lb+jwZqhxT3x0lT 85 | FpU0QSmioptgfv8TI2RP5Mjp9UKhRANCAAT8zvJEg3FgJ5iUA5GO+n/j48bL83ST 86 | pz7NTqejWIZNVTraxE4fjT6traKiswme7gT2NY9Jl0Dj4tbif9l2I9+O 87 | -----END PRIVATE KEY----- 88 | HLF_CONNECTION_PROFILE_ORG2: | 89 | { 90 | "name": "test-network-org2", 91 | "version": "1.0.0", 92 | "client": { 93 | "organization": "Org2", 94 | "connection": { 95 | "timeout": { 96 | "peer": { 97 | "endorser": "300" 98 | } 99 | } 100 | } 101 | }, 102 | "organizations": { 103 | "Org2": { 104 | "mspid": "Org2MSP", 105 | "peers": [ 106 | "org2-peers" 107 | ], 108 | "certificateAuthorities": [ 109 | "org2-ecert-ca" 110 | ] 111 | } 112 | }, 113 | "peers": { 114 | "org2-peers": { 115 | "url": "grpcs://org2-peer1:7051", 116 | "tlsCACerts": { 117 | "pem": "-----BEGIN CERTIFICATE-----\\nMIICKDCCAc6gAwIBAgIUJJ4wGOSCfw8XOOIx29o67wBpFB4wCgYIKoZIzj0EAwIw\\naDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK\\nEwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt\\nY2Etc2VydmVyMB4XDTIxMDkyMDExNDEwMFoXDTM2MDkxNjExNDEwMFowaDELMAkG\\nA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl\\ncmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMtY2Etc2Vy\\ndmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEyzGJLZX6pe59QAIBacjfzU4I\\nHezBYLyEu4ySpFx4xwxNLE4BWqLhB1VaOuenSQATM8pmSAy7i1830oM9elKWK6NW\\nMFQwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYE\\nFEoAAhmjq/3M8CFPc7N8SL53erL5MA8GA1UdEQQIMAaHBH8AAAEwCgYIKoZIzj0E\\nAwIDSAAwRQIhAJQ5PJOT4Gg8oiBU2KthMPkZqOLeu3Li4S3yBpLFgbsgAiB960P2\\nXPMu3HLoNXrktYOL9JzWlGyYRSPAnkap5Bsj0w==\\n-----END CERTIFICATE-----\\n" 118 | }, 119 | "grpcOptions": { 120 | "ssl-target-name-override": "org2-peer1", 121 | "hostnameOverride": "org2-peer1" 122 | } 123 | } 124 | }, 125 | "certificateAuthorities": { 126 | "org2-ecert-ca": { 127 | "url": "https://org2-ecert-ca", 128 | "caName": "org2-ecert-ca", 129 | "tlsCACerts": { 130 | "pem": ["-----BEGIN CERTIFICATE-----\\nMIICKDCCAc6gAwIBAgIUJAF4fQK1KsnvdaUjau462D/5HPYwCgYIKoZIzj0EAwIw\\naDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK\\nEwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt\\nY2Etc2VydmVyMB4XDTIxMDkxOTExMTcwMFoXDTM2MDkxNTExMTcwMFowaDELMAkG\\nA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl\\ncmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMtY2Etc2Vy\\ndmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8bLvzagP3YANMGHVomZoGCQD\\nRgM3SenagZQ4IWqNQJSV3yTxzdgAWnPhwc+B/HdAOvAq2Oz54FmiSL9dAJoivqNW\\nMFQwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYE\\nFDdBAwT47jtbj48aXdMfRvMPbD5tMA8GA1UdEQQIMAaHBH8AAAEwCgYIKoZIzj0E\\nAwIDSAAwRQIhAITSk4lYWqu12jZkR94aNoKT36ctaeKHuRvXs7m2qaHSAiAtUPO7\\nXlHtI9SDTRvI4DNSb2O7y7+B3WxVeCx50fivDw==\\n-----END CERTIFICATE-----\\n"] 131 | }, 132 | "httpOptions": { 133 | "verify": "false" 134 | } 135 | } 136 | } 137 | } 138 | HLF_CERTIFICATE_ORG2: | 139 | -----BEGIN CERTIFICATE----- 140 | MIIC2DCCAn6gAwIBAgIUY/B19uAV6H5zK4bgqF/BcYC79eEwCgYIKoZIzj0EAwIw 141 | aDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK 142 | EwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt 143 | Y2Etc2VydmVyMB4XDTIxMDkyMDExNDEwMFoXDTIyMDkyMDExNDYwMFowYTELMAkG 144 | A1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl 145 | cmxlZGdlcjEOMAwGA1UECxMFYWRtaW4xEzARBgNVBAMTCm9yZzItYWRtaW4wWTAT 146 | BgcqhkjOPQIBBggqhkjOPQMBBwNCAARKTC+25gFIgbLQgSQSec3DaUJOZS6aHBAi 147 | 0bmArVbMOxLUBT/W42ycXzfFJ9c0UAEZecDu8jxgBfEGWcbeWWMXo4IBCzCCAQcw 148 | DgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFGIXcrVhcyJ9 149 | WTH2zgc9/RdE1hJsMB8GA1UdIwQYMBaAFFS96ExY5RWOcsODBAfXZe+FQIq0MCcG 150 | A1UdEQQgMB6CHG9yZzItdGxzLWNhLTY5Yzg1Zjg5YmMtNzIyZ2cwfgYIKgMEBQYH 151 | CAEEcnsiYXR0cnMiOnsiYWJhYy5pbml0IjoidHJ1ZSIsImFkbWluIjoidHJ1ZSIs 152 | ImhmLkFmZmlsaWF0aW9uIjoiIiwiaGYuRW5yb2xsbWVudElEIjoib3JnMi1hZG1p 153 | biIsImhmLlR5cGUiOiJhZG1pbiJ9fTAKBggqhkjOPQQDAgNIADBFAiEAhrXwM7Ng 154 | IGxgF8irY7NbkQp1xqphy3tv6JbK6HPF+O8CIELMkzOclVK2rRC1K5PF99G7Cmmm 155 | KsVw31cJcV4NTDI7 156 | -----END CERTIFICATE----- 157 | HLF_PRIVATE_KEY_ORG2: | 158 | -----BEGIN PRIVATE KEY----- 159 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgPJgLniT9EqcaUNbi 160 | F3EqGyBP9LDg1baXR/5dV6xedt+hRANCAARKTC+25gFIgbLQgSQSec3DaUJOZS6a 161 | HBAi0bmArVbMOxLUBT/W42ycXzfFJ9c0UAEZecDu8jxgBfEGWcbeWWMX 162 | -----END PRIVATE KEY----- 163 | 164 | 165 | --- 166 | apiVersion: apps/v1 167 | kind: Deployment 168 | metadata: 169 | name: fabric-rest-sample 170 | spec: 171 | replicas: 1 172 | selector: 173 | matchLabels: 174 | app: fabric-rest-sample 175 | template: 176 | metadata: 177 | labels: 178 | app: fabric-rest-sample 179 | spec: 180 | containers: 181 | - name: main 182 | image: ghcr.io/hyperledger/fabric-rest-sample 183 | imagePullPolicy: IfNotPresent 184 | env: 185 | - name: LOG_LEVEL 186 | value: debug 187 | - name: HFC_LOGGING 188 | value: '{ "debug": "console" }' 189 | - name: PORT 190 | value: "3000" 191 | - name: RETRY_DELAY 192 | value: "3000" 193 | - name: MAX_RETRY_COUNT 194 | value: "5" 195 | - name: HLF_COMMIT_TIMEOUT 196 | value: "3000" 197 | - name: HLF_ENDORSE_TIMEOUT 198 | value: "30" 199 | - name: REDIS_HOST 200 | value: "localhost" 201 | - name: REDIS_PORT 202 | value: "6379" 203 | - name: ORG1_APIKEY 204 | value: "97834158-3224-4CE7-95F9-A148C886653E" 205 | - name: ORG2_APIKEY 206 | value: "BC42E734-062D-4AEE-A591-5973CB763430" 207 | - name: AS_LOCAL_HOST 208 | value: "false" 209 | - name: HLF_CHAINCODE_NAME 210 | value: "asset-transfer-basic" 211 | # - name: REDIS_USERNAME 212 | # value: redisuser 213 | # - name: REDIS_PASSWORD 214 | # value: redispasword 215 | 216 | envFrom: 217 | - configMapRef: 218 | name: fabric-rest-sample-config 219 | ports: 220 | - containerPort: 3000 221 | - name: redis 222 | image: redis:6.2.5 223 | ports: 224 | - containerPort: 6379 225 | 226 | --- 227 | apiVersion: v1 228 | kind: Service 229 | metadata: 230 | name: fabric-rest-sample 231 | spec: 232 | ports: 233 | - name: http 234 | port: 3000 235 | protocol: TCP 236 | selector: 237 | app: fabric-rest-sample 238 | 239 | 240 | #--- 241 | #apiVersion: networking.k8s.io/v1 242 | #kind: Ingress 243 | #metadata: 244 | # name: fabric-rest-sample 245 | # annotations: 246 | # nginx.ingress.kubernetes.io/rewrite-target: /$1 247 | #spec: 248 | # rules: 249 | # - http: 250 | # paths: 251 | # - path: "/fabric-rest-sample/(.*)" 252 | # - path: "/" 253 | # pathType: Prefix 254 | # backend: 255 | # service: 256 | # name: fabric-rest-sample 257 | # port: 258 | # number: 3000 259 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /SUT/fabric/chaincode/nftsamplecode/go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 3 | github.com/DATA-DOG/go-txdb v0.1.3/go.mod h1:DhAhxMXZpUJVGnT+p9IbzJoRKvlArO2pkHjnGX7o0n0= 4 | github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= 5 | github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= 6 | github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= 7 | github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= 8 | github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= 9 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 10 | github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= 11 | github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= 12 | github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= 13 | github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= 14 | github.com/cucumber/godog v0.8.0/go.mod h1:Cp3tEV1LRAyH/RuCThcxHS/+9ORZ+FMzPva2AZ5Ki+A= 15 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 16 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 17 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 18 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 19 | github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= 20 | github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= 21 | github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= 22 | github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w= 23 | github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= 24 | github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo= 25 | github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= 26 | github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= 27 | github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= 28 | github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= 29 | github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= 30 | github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= 31 | github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= 32 | github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= 33 | github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= 34 | github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= 35 | github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg= 36 | github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk= 37 | github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw= 38 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= 39 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 40 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 41 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 42 | github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= 43 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 44 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 45 | github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= 46 | github.com/hyperledger/fabric-chaincode-go v0.0.0-20200424173110-d7076418f212 h1:1i4lnpV8BDgKOLi1hgElfBqdHXjXieSuj8629mwBZ8o= 47 | github.com/hyperledger/fabric-chaincode-go v0.0.0-20200424173110-d7076418f212/go.mod h1:N7H3sA7Tx4k/YzFq7U0EPdqJtqvM4Kild0JoCc7C0Dc= 48 | github.com/hyperledger/fabric-contract-api-go v1.1.1 h1:gDhOC18gjgElNZ85kFWsbCQq95hyUP/21n++m0Sv6B0= 49 | github.com/hyperledger/fabric-contract-api-go v1.1.1/go.mod h1:+39cWxbh5py3NtXpRA63rAH7NzXyED+QJx1EZr0tJPo= 50 | github.com/hyperledger/fabric-protos-go v0.0.0-20190919234611-2a87503ac7c9/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= 51 | github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e h1:9PS5iezHk/j7XriSlNuSQILyCOfcZ9wZ3/PiucmSE8E= 52 | github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= 53 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 54 | github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= 55 | github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= 56 | github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= 57 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 58 | github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 59 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 60 | github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= 61 | github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 62 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 63 | github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= 64 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 65 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 66 | github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= 67 | github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= 68 | github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= 69 | github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= 70 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 71 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 72 | github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= 73 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 74 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 75 | github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 76 | github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= 77 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 78 | github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= 79 | github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 80 | github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= 81 | github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= 82 | github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= 83 | github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= 84 | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 85 | github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= 86 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 87 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 88 | github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= 89 | github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= 90 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 91 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 92 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 93 | github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= 94 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 95 | github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= 96 | github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= 97 | github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= 98 | github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= 99 | github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= 100 | github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= 101 | github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= 102 | github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= 103 | golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 104 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 105 | golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 106 | golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 107 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 108 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 109 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 110 | golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 111 | golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 112 | golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= 113 | golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 114 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 115 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 116 | golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 117 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 118 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 119 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 120 | golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 121 | golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 122 | golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542 h1:6ZQFf1D2YYDDI7eSwW8adlkkavTB9sw5I24FVtEvNUQ= 123 | golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 124 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 125 | golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= 126 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 127 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 128 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 129 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 130 | golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 131 | golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 132 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 133 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 134 | google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= 135 | google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 136 | google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= 137 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 138 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 139 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 140 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= 141 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 142 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 143 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 144 | gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= 145 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 146 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 147 | -------------------------------------------------------------------------------- /SUT/fabric/config/org0/configtx.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | --- 7 | ################################################################################ 8 | # 9 | # Section: Organizations 10 | # 11 | # - This section defines the different organizational identities which will 12 | # be referenced later in the configuration. 13 | # 14 | ################################################################################ 15 | Organizations: 16 | 17 | # SampleOrg defines an MSP using the sampleconfig. It should never be used 18 | # in production but may be used as a template for other definitions 19 | - &OrdererOrg 20 | # DefaultOrg defines the organization which is used in the sampleconfig 21 | # of the fabric.git development environment 22 | Name: OrdererOrg 23 | 24 | # ID to load the MSP definition as 25 | ID: OrdererMSP 26 | 27 | # MSPDir is the filesystem path which contains the MSP configuration 28 | MSPDir: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/msp 29 | 30 | # Policies defines the set of policies at this level of the config tree 31 | # For organization policies, their canonical path is usually 32 | # /Channel/// 33 | Policies: 34 | Readers: 35 | Type: Signature 36 | Rule: "OR('OrdererMSP.member')" 37 | Writers: 38 | Type: Signature 39 | Rule: "OR('OrdererMSP.member')" 40 | Admins: 41 | Type: Signature 42 | Rule: "OR('OrdererMSP.admin')" 43 | 44 | OrdererEndpoints: 45 | - org0-orderer1:6050 46 | - org0-orderer2:6050 47 | - org0-orderer3:6050 48 | 49 | - &Org1 50 | # DefaultOrg defines the organization which is used in the sampleconfig 51 | # of the fabric.git development environment 52 | Name: Org1MSP 53 | 54 | # ID to load the MSP definition as 55 | ID: Org1MSP 56 | 57 | MSPDir: /var/hyperledger/fabric/organizations/peerOrganizations/org1.example.com/msp 58 | 59 | # Policies defines the set of policies at this level of the config tree 60 | # For organization policies, their canonical path is usually 61 | # /Channel/// 62 | Policies: 63 | Readers: 64 | Type: Signature 65 | Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')" 66 | Writers: 67 | Type: Signature 68 | Rule: "OR('Org1MSP.admin', 'Org1MSP.client')" 69 | Admins: 70 | Type: Signature 71 | Rule: "OR('Org1MSP.admin')" 72 | Endorsement: 73 | Type: Signature 74 | Rule: "OR('Org1MSP.peer')" 75 | 76 | # leave this flag set to true. 77 | AnchorPeers: 78 | # AnchorPeers defines the location of peers which can be used 79 | # for cross org gossip communication. Note, this value is only 80 | # encoded in the genesis block in the Application section context 81 | - Host: org1-peer1 82 | Port: 7051 83 | 84 | - &Org2 85 | # DefaultOrg defines the organization which is used in the sampleconfig 86 | # of the fabric.git development environment 87 | Name: Org2MSP 88 | 89 | # ID to load the MSP definition as 90 | ID: Org2MSP 91 | 92 | MSPDir: /var/hyperledger/fabric/organizations/peerOrganizations/org2.example.com/msp 93 | 94 | # Policies defines the set of policies at this level of the config tree 95 | # For organization policies, their canonical path is usually 96 | # /Channel/// 97 | Policies: 98 | Readers: 99 | Type: Signature 100 | Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')" 101 | Writers: 102 | Type: Signature 103 | Rule: "OR('Org2MSP.admin', 'Org2MSP.client')" 104 | Admins: 105 | Type: Signature 106 | Rule: "OR('Org2MSP.admin')" 107 | Endorsement: 108 | Type: Signature 109 | Rule: "OR('Org2MSP.peer')" 110 | 111 | AnchorPeers: 112 | # AnchorPeers defines the location of peers which can be used 113 | # for cross org gossip communication. Note, this value is only 114 | # encoded in the genesis block in the Application section context 115 | - Host: org2-peer1 116 | Port: 7051 117 | 118 | ################################################################################ 119 | # 120 | # SECTION: Capabilities 121 | # 122 | # - This section defines the capabilities of fabric network. This is a new 123 | # concept as of v1.1.0 and should not be utilized in mixed networks with 124 | # v1.0.x peers and orderers. Capabilities define features which must be 125 | # present in a fabric binary for that binary to safely participate in the 126 | # fabric network. For instance, if a new MSP type is added, newer binaries 127 | # might recognize and validate the signatures from this type, while older 128 | # binaries without this support would be unable to validate those 129 | # transactions. This could lead to different versions of the fabric binaries 130 | # having different world states. Instead, defining a capability for a channel 131 | # informs those binaries without this capability that they must cease 132 | # processing transactions until they have been upgraded. For v1.0.x if any 133 | # capabilities are defined (including a map with all capabilities turned off) 134 | # then the v1.0.x peer will deliberately crash. 135 | # 136 | ################################################################################ 137 | Capabilities: 138 | # Channel capabilities apply to both the orderers and the peers and must be 139 | # supported by both. 140 | # Set the value of the capability to true to require it. 141 | Channel: &ChannelCapabilities 142 | # V2_0 capability ensures that orderers and peers behave according 143 | # to v2.0 channel capabilities. Orderers and peers from 144 | # prior releases would behave in an incompatible way, and are therefore 145 | # not able to participate in channels at v2.0 capability. 146 | # Prior to enabling V2.0 channel capabilities, ensure that all 147 | # orderers and peers on a channel are at v2.0.0 or later. 148 | V2_0: true 149 | 150 | # Orderer capabilities apply only to the orderers, and may be safely 151 | # used with prior release peers. 152 | # Set the value of the capability to true to require it. 153 | Orderer: &OrdererCapabilities 154 | # V2_0 orderer capability ensures that orderers behave according 155 | # to v2.0 orderer capabilities. Orderers from 156 | # prior releases would behave in an incompatible way, and are therefore 157 | # not able to participate in channels at v2.0 orderer capability. 158 | # Prior to enabling V2.0 orderer capabilities, ensure that all 159 | # orderers on channel are at v2.0.0 or later. 160 | V2_0: true 161 | 162 | # Application capabilities apply only to the peer network, and may be safely 163 | # used with prior release orderers. 164 | # Set the value of the capability to true to require it. 165 | Application: &ApplicationCapabilities 166 | # V2_0 application capability ensures that peers behave according 167 | # to v2.0 application capabilities. Peers from 168 | # prior releases would behave in an incompatible way, and are therefore 169 | # not able to participate in channels at v2.0 application capability. 170 | # Prior to enabling V2.0 application capabilities, ensure that all 171 | # peers on channel are at v2.0.0 or later. 172 | V2_0: true 173 | 174 | ################################################################################ 175 | # 176 | # SECTION: Application 177 | # 178 | # - This section defines the values to encode into a config transaction or 179 | # genesis block for application related parameters 180 | # 181 | ################################################################################ 182 | Application: &ApplicationDefaults 183 | 184 | # Organizations is the list of orgs which are defined as participants on 185 | # the application side of the network 186 | Organizations: 187 | 188 | # Policies defines the set of policies at this level of the config tree 189 | # For Application policies, their canonical path is 190 | # /Channel/Application/ 191 | Policies: 192 | Readers: 193 | Type: ImplicitMeta 194 | Rule: "ANY Readers" 195 | Writers: 196 | Type: ImplicitMeta 197 | Rule: "ANY Writers" 198 | Admins: 199 | Type: ImplicitMeta 200 | Rule: "MAJORITY Admins" 201 | LifecycleEndorsement: 202 | Type: Signature 203 | Rule: "OR('Org1MSP.peer','Org2MSP.peer')" 204 | Endorsement: 205 | Type: Signature 206 | Rule: "OR('Org1MSP.peer','Org2MSP.peer')" 207 | 208 | Capabilities: 209 | <<: *ApplicationCapabilities 210 | ################################################################################ 211 | # 212 | # SECTION: Orderer 213 | # 214 | # - This section defines the values to encode into a config transaction or 215 | # genesis block for orderer related parameters 216 | # 217 | ################################################################################ 218 | Orderer: &OrdererDefaults 219 | 220 | # Orderer Type: The orderer implementation to start 221 | OrdererType: etcdraft 222 | 223 | EtcdRaft: 224 | Consenters: 225 | - Host: org0-orderer1 226 | Port: 6050 227 | ClientTLSCert: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer1.org0.example.com/tls/signcerts/cert.pem 228 | ServerTLSCert: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer1.org0.example.com/tls/signcerts/cert.pem 229 | - Host: org0-orderer2 230 | Port: 6050 231 | ClientTLSCert: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer2.org0.example.com/tls/signcerts/cert.pem 232 | ServerTLSCert: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer2.org0.example.com/tls/signcerts/cert.pem 233 | - Host: org0-orderer3 234 | Port: 6050 235 | ClientTLSCert: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer3.org0.example.com/tls/signcerts/cert.pem 236 | ServerTLSCert: /var/hyperledger/fabric/organizations/ordererOrganizations/org0.example.com/orderers/org0-orderer3.org0.example.com/tls/signcerts/cert.pem 237 | 238 | 239 | # Options to be specified for all the etcd/raft nodes. The values here 240 | # are the defaults for all new channels and can be modified on a 241 | # per-channel basis via configuration updates. 242 | Options: 243 | # TickInterval is the time interval between two Node.Tick invocations. 244 | #TickInterval: 500ms default 245 | TickInterval: 2500ms 246 | 247 | # ElectionTick is the number of Node.Tick invocations that must pass 248 | # between elections. That is, if a follower does not receive any 249 | # message from the leader of current term before ElectionTick has 250 | # elapsed, it will become candidate and start an election. 251 | # ElectionTick must be greater than HeartbeatTick. 252 | # ElectionTick: 10 default 253 | ElectionTick: 5 254 | 255 | # HeartbeatTick is the number of Node.Tick invocations that must 256 | # pass between heartbeats. That is, a leader sends heartbeat 257 | # messages to maintain its leadership every HeartbeatTick ticks. 258 | HeartbeatTick: 1 259 | 260 | # MaxInflightBlocks limits the max number of in-flight append messages 261 | # during optimistic replication phase. 262 | MaxInflightBlocks: 5 263 | 264 | # SnapshotIntervalSize defines number of bytes per which a snapshot is taken 265 | SnapshotIntervalSize: 16 MB 266 | 267 | # Batch Timeout: The amount of time to wait before creating a batch 268 | BatchTimeout: 2s 269 | 270 | # Batch Size: Controls the number of messages batched into a block 271 | BatchSize: 272 | 273 | # Max Message Count: The maximum number of messages to permit in a batch 274 | MaxMessageCount: 10 275 | 276 | # Absolute Max Bytes: The absolute maximum number of bytes allowed for 277 | # the serialized messages in a batch. 278 | AbsoluteMaxBytes: 99 MB 279 | 280 | # Preferred Max Bytes: The preferred maximum number of bytes allowed for 281 | # the serialized messages in a batch. A message larger than the preferred 282 | # max bytes will result in a batch larger than preferred max bytes. 283 | PreferredMaxBytes: 512 KB 284 | 285 | # Organizations is the list of orgs which are defined as participants on 286 | # the orderer side of the network 287 | Organizations: 288 | 289 | # Policies defines the set of policies at this level of the config tree 290 | # For Orderer policies, their canonical path is 291 | # /Channel/Orderer/ 292 | Policies: 293 | Readers: 294 | Type: ImplicitMeta 295 | Rule: "ANY Readers" 296 | Writers: 297 | Type: ImplicitMeta 298 | Rule: "ANY Writers" 299 | Admins: 300 | Type: ImplicitMeta 301 | Rule: "MAJORITY Admins" 302 | # BlockValidation specifies what signatures must be included in the block 303 | # from the orderer for the peer to validate it. 304 | BlockValidation: 305 | Type: ImplicitMeta 306 | Rule: "ANY Writers" 307 | 308 | ################################################################################ 309 | # 310 | # CHANNEL 311 | # 312 | # This section defines the values to encode into a config transaction or 313 | # genesis block for channel related parameters. 314 | # 315 | ################################################################################ 316 | Channel: &ChannelDefaults 317 | # Policies defines the set of policies at this level of the config tree 318 | # For Channel policies, their canonical path is 319 | # /Channel/ 320 | Policies: 321 | # Who may invoke the 'Deliver' API 322 | Readers: 323 | Type: ImplicitMeta 324 | Rule: "ANY Readers" 325 | # Who may invoke the 'Broadcast' API 326 | Writers: 327 | Type: ImplicitMeta 328 | Rule: "ANY Writers" 329 | # By default, who may modify elements at this config level 330 | Admins: 331 | Type: ImplicitMeta 332 | Rule: "MAJORITY Admins" 333 | 334 | # Capabilities describes the channel level capabilities, see the 335 | # dedicated Capabilities section elsewhere in this file for a full 336 | # description 337 | Capabilities: 338 | <<: *ChannelCapabilities 339 | 340 | ################################################################################ 341 | # 342 | # Profile 343 | # 344 | # - Different configuration profiles may be encoded here to be specified 345 | # as parameters to the configtxgen tool 346 | # 347 | ################################################################################ 348 | Profiles: 349 | 350 | # test network profile with application (not system) channel. 351 | TwoOrgsApplicationGenesis: 352 | <<: *ChannelDefaults 353 | Orderer: 354 | <<: *OrdererDefaults 355 | Organizations: 356 | - *OrdererOrg 357 | Capabilities: *OrdererCapabilities 358 | Application: 359 | <<: *ApplicationDefaults 360 | Organizations: 361 | - *Org1 362 | - *Org2 363 | Capabilities: *ApplicationCapabilities 364 | 365 | 366 | # 367 | # Unclear lineage for these profiles: nano-fab? 368 | # 369 | # TwoOrgsOrdererGenesis will construct a system channel as it has a Consortiums stanza, which is not 370 | # compatible with osnadmin. 371 | # 372 | # @enyeart - which profile should be used for the kube test network? 373 | # 374 | TwoOrgsOrdererGenesis: 375 | <<: *ChannelDefaults 376 | Orderer: 377 | <<: *OrdererDefaults 378 | OrdererType: etcdraft 379 | Organizations: 380 | - *OrdererOrg 381 | Capabilities: 382 | <<: *OrdererCapabilities 383 | Consortiums: 384 | SampleConsortium: 385 | Organizations: 386 | - *Org1 387 | - *Org2 388 | TwoOrgsChannel: 389 | Consortium: SampleConsortium 390 | <<: *ChannelDefaults 391 | Application: 392 | <<: *ApplicationDefaults 393 | Organizations: 394 | - *Org1 395 | - *Org2 396 | Capabilities: 397 | <<: *ApplicationCapabilities 398 | Org1Channel: 399 | Consortium: SampleConsortium 400 | <<: *ChannelDefaults 401 | Application: 402 | <<: *ApplicationDefaults 403 | Organizations: 404 | - *Org1 405 | Capabilities: 406 | <<: *ApplicationCapabilities 407 | Org2Channel: 408 | Consortium: SampleConsortium 409 | <<: *ChannelDefaults 410 | Application: 411 | <<: *ApplicationDefaults 412 | Organizations: 413 | - *Org2 414 | Capabilities: 415 | <<: *ApplicationCapabilities 416 | --------------------------------------------------------------------------------