peitho

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2021 License: MIT

README

Peitho - Hyperledger Fabric chaincode Cloud-native managed system

The chaincode of Hyperledger Fabric can be handed over to k8s for management, which is suitable for deploying the Hyperledger Fabric alliance chain on k8s, and solves the problem of chaincode being free from k8s control.

简体中文

Features

  • K8s fully managed chaincode
  • There is no intrusion to the fabric, just configure the CORE_VM_ENDPOINT environment variable to Peitho service.
  • Support fabric 1.4.x 2.0 and above

Architecture

Architecture

Getting Started

Building

1.get source code

git clone https://github.com/tianrandailove/peitho

2.compile

cd peitho
make build

3.build image

make image

Using

  1. configure peitho-configmap.yaml
# Copyright 2021 Ke Fan <litesky@foxmail.com>. All rights reserved.
# Use of this source code is governed by a MIT style
# license that can be found in the LICENSE file.

apiVersion: v1
data:
  kubeconfig: |-
    #k8s access configuration file
  peitho.yml: |-
    k8s:
      namespace: fabric #namespace 
      kubeconfig: /root/kube/kubeconfig #k8s access configuration file path
      dns: #If the chaincode and the peer are not in the same environment, the peer address resolution needs to be configured
        - 127.0.0.1:peer0.org1.example.com
        - 127.0.0.1:peer1.org1.example.com
        - 127.0.0.1:peer0.org2.example.com
        - 127.0.0.1:peer1.org2.example.com
    docker:
      endpoint: unix:///host/var/run/docker.sock # docker access endpoint
      registry: #like harbor
        server-address: #registry server address
          xxx.xxx.xxx.xxx:xxxx
        project: #project name
          chaincode
        email: #email
          litesky@foxmail.com
        username: #username
          admin
        password: #password
          harbor

    log:
      name: peitho # Logger name 
      development: true # Whether it is a development mode. If it is in development mode, the stack trace will be performed on DPanicLevel.
      level: debug # Log level, the priority from low to high is: debug, info, warn, error, dpanic, panic, fatal.
      format: console # Supported log output format, currently supports console and json. The console is actually the text format.
      enable-color: true # Whether to enable color output, true: yes, false: no
      disable-caller: true # Whether to open the caller, if open, the file, function and line number of the call log will be displayed in the log
      disable-stacktrace: false # Whether to prohibit printing stack information at panic and above levels
kind: ConfigMap
metadata:
  name: peitho-configmap
  namespace: fabric

  1. configure peitho-deployment.yaml
# Copyright 2021 Ke Fan <litesky@foxmail.com>. All rights reserved.
# Use of this source code is governed by a MIT style
# license that can be found in the LICENSE file.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: peitho
spec:
  replicas: 1
  selector:
    matchLabels:
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
    spec:
      containers:
      - image: tianrandailoving/peitho:latest
        imagePullPolicy: Always
        name: peitho
        ports:
        - containerPort: 8080
          name: peitho
          protocol: TCP
        resources: {}
        securityContext:
          allowPrivilegeEscalation: false
          privileged: false
          readOnlyRootFilesystem: false
          runAsNonRoot: false
        stdin: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        tty: true
        volumeMounts:
        - mountPath: /host/var/run/
          name: vol2
        - mountPath: /root/peitho.yml
          name: vol1
          subPath: peitho.yml
        - mountPath: /root/kube/kubeconfig
          name: vol1
          subPath: kubeconfig
      dnsConfig: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - hostPath:
          path: /var/run/
          type: ""
        name: vol2
      - configMap:
          defaultMode: 256
          items:
          - key: peitho.yml
            path: peitho.yml
          - key: kubeconfig
            path: kubeconfig
          name: peitho-configmap
          optional: false
        name: vol1
  1. create configmap and deployment
kubectl apply -f peitho-configmap.yaml
kubectl apply -f peitho-deployment.yaml
  1. change peer env
- name: CORE_VM_ENDPOINT
  value: tcp://peitho:8080

Authors

License

Peitho is licensed under the MIT.

Others

get peitho image

docker pull tianrandailoving/peitho:latest

Directories

Path Synopsis
cmd
internal
peitho/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.
pkg
app
docker
Package docker is a generated GoMock package.
Package docker is a generated GoMock package.
k8s
Package k8s is a generated GoMock package.
Package k8s is a generated GoMock package.
log
log/logrus
Package logrus adds a hook to the logrus logger hooks.
Package logrus adds a hook to the logrus logger hooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL