Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions charts/binancechain/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
cloudbuild.yaml
17 changes: 17 additions & 0 deletions charts/binancechain/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
appVersion: 1.0.0
description: binancechain is building the Internet of Trusted Things, an open network where all physical and virtual “things” —
humans, machines, and businesses — can interact with full trust and privacy.
engine: gotpl
home: https://binancechain.io
keywords:
- binancechain
- cryptocurrency
maintainers:
- email: [email protected]
name: voron
name: binancechain
sources:
- https://github.com/kubernetes/charts
- https://github.com/binancechainproject/binancechain-core/
version: 0.1.0
63 changes: 63 additions & 0 deletions charts/binancechain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# binancechain

[binancechain](https://binancechain.com) is a distributed consensus platform with meta-consensus capability. binancechain not only comes to consensus about the state of its ledger, like Bitcoin or Ethereum.
It also attempts to come to consensus about how the protocol and the nodes should adapt and upgrade.
## Introduction

This chart bootstraps a single binancechain node deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
Docker image was taken from [binancechain on Docker hub](https://hub.docker.com/r/binancechain/binancechain/tags)

## Prerequisites

- Kubernetes 1.8+
- PV provisioner support in the underlying infrastructure

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
$ helm install --name my-release stable/binancechain
```

The command deploys binancechain on the Kubernetes cluster in the default configuration.
The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```bash
$ helm delete my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following table lists the configurable parameters of the binancechain chart and their default values.

Parameter | Description | Default
------------------------------- | ------------------------------------------------- | ----------------------------------------------------------
`image.repository` | Image source repository name | `dysnix/docker-binancechain`
`image.tag` | `binancechain` release tag. | `0.17.1`
`image.pullPolicy` | Image pull policy | `IfNotPresent`
`service.rpcPort` | RPC port | `8732`
`service.p2pPort` | P2P port | `9732`
`persistence.enabled` | Create a volume to store data | `true`
`persistence.accessMode` | ReadWriteOnce or ReadOnly | `ReadWriteOnce`
`persistence.size` | Size of persistent volume claim | `300Gi`
`resources` | CPU/Memory resource requests/limits | `{}`
`terminationGracePeriodSeconds` | Wait time before forcefully terminating container | `30`


Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```bash
$ helm install --name my-release -f values.yaml stable/binancechain
```

> **Tip**: You can use the default [values.yaml](values.yaml)

14 changes: 14 additions & 0 deletions charts/binancechain/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
binancechain RPC can be accessed via port {{ .Values.service.rpcPort }} on the following DNS name from within your cluster:
{{ template "binancechain.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local

To connect to binancechain RPC:

1. Forward the port for the node:

$ kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "binancechain.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{ .items[0].metadata.name }") {{ .Values.service.rpcPort }}

2. Test connection:

$ curl http://127.0.0.1:{{ .Values.service.rpcPort }}/monitor/heads/{{ .Values.binancechain.chain_id }}

3. See https://codelabs.binancechain.io for details
113 changes: 113 additions & 0 deletions charts/binancechain/templates/_app.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml

[base]
# Interval blocks of breathe block, if breatheBlockInterval is 0, breathe block will be created every day.
breatheBlockInterval = 0
# Size of account cache
accountCacheSize = 30000
# Size of signature cache
signatureCacheSize = 30000
# Running mode when start up, 0: Normal, 1: TransferOnly, 2: RecoverOnly
startMode = 0
# Concurrency of OrderKeeper, should be power of 2
orderKeeperConcurrency = 2
# Days count back for breathe block
breatheBlockDaysCountBack = 7

[upgrade]
# Block height of BEP6 upgrade
BEP6Height = 20300000
# Block height of BEP9 upgrade
BEP9Height = 20300000
# Block height of BEP10 upgrade
BEP10Height = 20300000
# Block height of BEP19 upgrade
BEP19Height = 20300000
# Block height of BEP12 upgrade
BEP12Height = 25120000
# Block height of BEP3 upgrade
BEP3Height = 41277000
# Block height of FixSignBytesOverflow upgrade
FixSignBytesOverflowHeight = 51467800
# Block height of LotSizeOptimization upgrade
LotSizeUpgradeHeight = 51467800
# Block height of changing listing rule upgrade
ListingRuleUpgradeHeight = 51467800
# Block height of FixZeroBalanceHeight upgrade
FixZeroBalanceHeight = 51467800
# Block height of BEP8 upgrade
BEP8Height = 99550000
# Block height of BEP67 upgrade
BEP67Height = 99550000
# Block height of BEP70 upgrade
BEP70Height = 99550000

[addr]
# Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
bech32PrefixAccAddr = "bnb"
# Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
bech32PrefixAccPub = "bnbp"
# Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
bech32PrefixValAddr = "bva"
# Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
bech32PrefixValPub = "bvap"
# Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
bech32PrefixConsAddr = "bca"
# Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
bech32PrefixConsPub = "bcap"

##### publication related configurations #####
[publication]
# configurations ends with Kafka can be a semi-colon separated host-port list
# Whether we want publish market data (this includes trades and order)
publishOrderUpdates = true
orderUpdatesTopic = "orders"
orderUpdatesKafka = "127.0.0.1:9092"

# Whether we want publish account balance to notify browser db indexer persist latest account balance change
publishAccountBalance = true
accountBalanceTopic = "accounts"
accountBalanceKafka = "127.0.0.1:9092"

# Whether we want publish order book changes
publishOrderBook = true
orderBookTopic = "orders"
orderBookKafka = "127.0.0.1:9092"

# Whether we want publish block fee changes
publishBlockFee = true
blockFeeTopic = "accounts"
blockFeeKafka = "127.0.0.1:9092"

# Whether we want publish transfers
publishTransfer = true
transferTopic = "transfers"
transferKafka = "127.0.0.1:9092"

# Global setting
publicationChannelSize = "10000"
publishKafka = false
publishLocal = true
# max size in megabytes of marketdata json file before rotate
localMaxSize = 1024
# max days of marketdata json files to keep before deleted
localMaxAge = 1000

[log]

# Write logs to console instead of file
logToConsole = true

## The below parameters take effect only when logToConsole is false
# Log file root, if not set, use home path
logFileRoot = ""
# Log file path relative to log file root path
logFilePath = "bnc.log"
# Number of logs keep in memory before writing to file
logBuffSize = 10000


[dex]
# The suffixed symbol of BUSD
BUSDSymbol = "BUSD-BD1"
39 changes: 39 additions & 0 deletions charts/binancechain/templates/_check_node_health.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env sh
set -ex # -e exits on error

usage() { echo "Usage: $0 <datadir> <max_lag_in_seconds> <last_synced_block_file>]" 1>&2; exit 1; }

datadir="$1"
max_lag_in_seconds="$2"
last_synced_block_file="$3"

if [ -z "${datadir}" ] || [ -z "${max_lag_in_seconds}" ] || [ -z "${last_synced_block_file}" ]; then
usage
fi

set +e

block_timestamp=$(binancechain-client --chain {{ .Values.binancechain.chain_id }} --block head get timestamp -s)

set -e
# https://unix.stackexchange.com/a/367406/255685
if [ -z "${block_timestamp}" ] || [ ${block_timestamp} -le 0 ]; then
echo "Block number returned by the node is empty or not a number"
exit 1
fi

if [ ! -f ${last_synced_block_file} ]; then
old_block_timestamp="";
else
old_block_timestamp=$(cat ${last_synced_block_file});
fi;

if [ "${block_timestamp}" != "${old_block_timestamp}" ]; then
mkdir -p $(dirname "${last_synced_block_file}")
echo ${block_timestamp} > ${last_synced_block_file}
fi

file_age=$(($(date +%s) - $(date -r ${last_synced_block_file} +%s)));
max_age=${max_lag_in_seconds};
echo "${last_synced_block_file} age is $file_age seconds. Max healthy age is $max_age seconds";
if [ ${file_age} -lt ${max_age} ]; then exit 0; else exit 1; fi
45 changes: 45 additions & 0 deletions charts/binancechain/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "binancechain.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "binancechain.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "binancechain.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "binancechain.labels" -}}
app.kubernetes.io/name: {{ include "binancechain.name" . }}
helm.sh/chart: {{ include "binancechain.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
7 changes: 7 additions & 0 deletions charts/binancechain/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ .Release.Name }}-scripts"
data:
check_node_health.sh: |
{{- include (print $.Template.BasePath "/_check_node_health.sh") . | nindent 4 }}
29 changes: 29 additions & 0 deletions charts/binancechain/templates/ilb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ if .Values.internalLB }}
## use this to aggregate internal pods behind
## a single load balanced IP
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-ilb
labels:
chain: {{ .Values.binancechain.chain_id }}
{{ include "binancechain.labels" . | indent 4 }}
annotations:
cloud.google.com/load-balancer-type: "Internal"
cloud.google.com/network-tier: "PREMIUM"
spec:
type: LoadBalancer
{{ if .Values.internalLBIP }}
loadBalancerIP: {{ .Values.internalLBIP }}
{{ end }}
ports:
- name: {{ .Values.service.rpcPortName }}
port: {{ .Values.service.rpcPort }}
targetPort: {{ .Values.service.rpcPortName }}
- name: {{ .Values.service.p2pPortName }}
port: {{ .Values.service.p2pPort }}
targetPort: {{ .Values.service.p2pPortName }}
selector:
app.kubernetes.io/name: {{ include "binancechain.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}
22 changes: 22 additions & 0 deletions charts/binancechain/templates/lb-p2p.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{ if .Values.externalLBp2p }}
## use this if you want to expose blockchain p2p (not RPC) to public
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-lb-p2p
labels:
chain: {{ .Values.binancechain.chain_id }}
{{ include "binancechain.labels" . | indent 4 }}
spec:
type: LoadBalancer
{{ if .Values.externalLBp2pIP -}}
loadBalancerIP: {{ .Values.externalLBp2pIP }}
{{ end -}}
ports:
- name: {{ .Values.service.p2pPortName }}
port: {{ .Values.service.p2pPort }}
targetPort: {{ .Values.service.p2pPortName }}
selector:
app.kubernetes.io/name: {{ include "binancechain.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}
Loading