-
Notifications
You must be signed in to change notification settings - Fork 951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add helm-charts for explorer-db & explorer #353
base: main
Are you sure you want to change the base?
Changes from 1 commit
4998ea4
711f89e
a3b88eb
83276f3
20d92d9
2d6e176
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
## Prerequisites | ||
|
||
- Kubernetes 1.9+ | ||
- A running Hyperledger Fabric network on kubernetes. | ||
|
||
## Installing the Chart | ||
|
||
To install the chart with the release name `explorer`: | ||
|
||
```bash | ||
$ helm install explorer/ --name explorer | ||
``` | ||
|
||
The command deploys the Blockchain Explorer & Explorer-DB on the Kubernetes cluster in the default configuration. The [Configuration](#configuration) section lists the parameters that can be configured during installation. | ||
|
||
## Test the Chart | ||
|
||
To test the chart with the release name `explorer`: | ||
|
||
```bash | ||
$ helm test explorer | ||
``` | ||
|
||
The command tests the Blockchain Explorer & Explorer-DB on the Kubernetes cluster. | ||
|
||
## Uninstalling the Chart | ||
|
||
To uninstall/delete the `explorer` deployment: | ||
|
||
```bash | ||
$ helm delete explorer | ||
``` | ||
|
||
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 Blockchain Explorer & Explorer-DB chart and default values. | ||
|
||
| Parameter | Description | Default | | ||
| --------------------------------- | ------------------------------------------------- | ------------------------- | | ||
| `explorer.image.repository` | `explorer` image repository | `hyperledger/explorer` | | ||
| `explorer.image.tag` | `explorer` image tag | `latest` | | ||
| `explorer.username` | `explorer` username | ` ` | | ||
| `explorer.password` | `explorer` password | ` ` | | ||
| `image.pullPolicy` | Image pull policy | `IfNotPresent` | | ||
| `db.image.repository` | `explorer-db` image repository | `hyperledger/explorer-db` | | ||
| `db.image.tag` | `explorer-db` image tag | `latest` | | ||
| `db.DATABASE_DATABASE` | `explorer-db` DATABASE_DATABASE name | ` ` | | ||
| `db.DATABASE_USERNAME` | `explorer-db` DATABASE_USERNAME name | ` ` | | ||
| `db.DATABASE_PASSWORD` | `explorer-db` DATABASE_PASSWORD name | ` ` | | ||
| `explorer.service.port` | TCP port for requests to explorer | `8080` | | ||
| `explorer.service.type` | K8S service type exposing ports, e.g. `ClusterIP` | `ClusterIP` | | ||
| `explorer.ingress.enabled` | If true, Ingress will be created | `false` | | ||
| `explorer.ingress.annotations` | Ingress annotations | `{}` | | ||
| `explorer.ingress.path` | Ingress path | `/` | | ||
| `explorer.ingress.hosts` | Ingress hostnames | ` ` | | ||
| `db.service.port` | TCP port for requests to explorer-db | `5432` | | ||
| `db.service.type` | K8S service type exposing ports, e.g. `ClusterIP` | `ClusterIP` | | ||
| `resources` | CPU/Memory resource requests/limits | `{}` | | ||
| `replicaCount` | Replicacount of pods | `1` | | ||
| `network.channel` | HLF network channel name | ` ` | | ||
| `network.mspid` | HLF network peer org mspid | ` ` | | ||
| `network.peername` | HLF network peername | ` ` | | ||
| `network.peerurl` | HLF network peerurl | ` ` | | ||
| `network.adminPrivateKey` | HLF network peer adminPrivateKey | ` ` | | ||
| `network.signedCert` | HLF network peer signedCert | ` ` | | ||
| `network.tlsCACerts` | HLF network peer tlsCACerts | ` ` | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 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 | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
name: blockchain-explorer | ||
description: A Helm chart for blockchain explorer | ||
|
||
type: application | ||
|
||
version: 0.1.0 | ||
|
||
appVersion: "1.16.0" | ||
|
||
keywords: | ||
- blockchain | ||
- hyperledger | ||
- explorer | ||
- explorer-db | ||
|
||
sources: | ||
- https://github.com/hyperledger-labs/blockchain-explorer | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: explorer-config | ||
namespace: {{ $.Values.namespace }} | ||
labels: | ||
name: {{ .Release.Name }}-app | ||
app.kubernetes.io/name: {{ .Release.Name }}-app | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
annotations: | ||
{{- toYaml .Values.annotations | nindent 6 }} | ||
data: | ||
|
||
test-network.json: |- | ||
{ | ||
"name": "basic-network", | ||
"version": "1.0.0", | ||
"client": { | ||
"tlsEnable": true, | ||
"adminCredential": { | ||
"id": "{{ .Values.explorer.username | default "exploreradmin"}}", | ||
"password": "{{ .Values.explorer.password | default "exploreradminpw"}}" | ||
}, | ||
"enableAuthentication": true, | ||
"organization": "{{ .Values.network.mspid}}", | ||
"connection": { | ||
"timeout": { | ||
"peer": { | ||
"endorser": "300" | ||
}, | ||
"orderer": "300" | ||
} | ||
} | ||
}, | ||
"channels": { | ||
"{{ .Values.network.channel}}": { | ||
"peers": { | ||
"{{ .Values.network.peername}}": {} | ||
}, | ||
"connection": { | ||
"timeout": { | ||
"peer": { | ||
"endorser": "6000", | ||
"eventHub": "6000", | ||
"eventReg": "6000" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"organizations": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something to improve upon later: One instance of Explorer can be used for multiple organizations. There can be a different user login session seeing altogether a different network configuration. This section shall be more flexible to handle that. |
||
"{{ .Values.network.mspid}}": { | ||
"mspid": "{{ .Values.network.mspid}}", | ||
"adminPrivateKey": { | ||
"pem": "{{ .Values.network.adminPrivateKey}}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please load private key from either a secret store or create in-memory volume to load it from an external secret storage. |
||
|
||
}, | ||
"peers": [ | ||
"{{ .Values.network.peername}}" | ||
], | ||
"signedCert": { | ||
"pem": "{{ .Values.network.signedCert}}" | ||
} | ||
} | ||
}, | ||
"peers": { | ||
"{{ .Values.network.peername}}": { | ||
"tlsCACerts": { | ||
"pem": "{{ .Values.network.tlsCACerts}}" | ||
}, | ||
"url": "{{ .Values.network.peerurl}}" | ||
} | ||
} | ||
} | ||
|
||
config.json: |- | ||
{ | ||
"network-configs": { | ||
"basic-network": { | ||
"name": "basic-network", | ||
"profile": "./test-network.json" | ||
} | ||
}, | ||
"license": "Apache-2.0" | ||
} | ||
|
||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: explorer-env | ||
namespace: {{ $.Values.namespace }} | ||
labels: | ||
name: {{ .Release.Name }}-app | ||
app.kubernetes.io/name: {{ .Release.Name }}-app | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
annotations: | ||
{{- toYaml .Values.annotations | nindent 6 }} | ||
data: | ||
DATABASE_HOST: {{ .Release.Name }}-db | ||
DATABASE_DATABASE: {{ $.Values.db.database | default "fabricexplorer" }} | ||
DATABASE_USERNAME: {{ $.Values.db.database_username | default "hppoc" }} | ||
DATABASE_PASSWD: {{ $.Values.db.database_password | default "password" }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the private key, the password parameter is sensitive, it shall be loaded in from a secret store. |
||
LOG_LEVEL_APP: {{ $.Values.explorer.logging.app_log | default "debug" }} | ||
LOG_LEVEL_DB: {{ $.Values.explorer.logging.db_log | default "debug" }} | ||
LOG_CONSOLE_STDOUT: "{{ $.Values.explorer.logging.log_console_stdout | default "true" }}" | ||
DISCOVERY_AS_LOCALHOST: "{{ $.Values.explorer.logging.discovery_as_localhost | default "false" }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ .Release.Name }}-db | ||
namespace: {{ $.Values.namespace }} | ||
labels: | ||
name: {{ .Release.Name }}-db | ||
app.kubernetes.io/name: {{ .Release.Name }}-db | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
annotations: | ||
{{- toYaml .Values.annotations | nindent 6 }} | ||
spec: | ||
serviceName: {{ .Release.Name }}-db | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: {{ .Release.Name }}-db | ||
app.kubernetes.io/name: {{ .Release.Name }}-db | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-db | ||
app.kubernetes.io/name: {{ .Release.Name }}-db | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.db.image.repository }}:{{ .Values.db.image.tag }}" | ||
imagePullPolicy: {{ .Values.pullPolicy }} | ||
envFrom: | ||
- configMapRef: | ||
name: explorer-db-env | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
|
||
ports: | ||
- containerPort: {{ .Values.db.service.port }} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Release.Name }}-db | ||
namespace: {{ $.Values.namespace }} | ||
labels: | ||
name: {{ .Release.Name }}-db | ||
app.kubernetes.io/name: {{ .Release.Name }}-db | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
annotations: | ||
{{- toYaml .Values.annotations | nindent 6 }} | ||
spec: | ||
type: {{ .Values.db.service.type }} | ||
selector: | ||
app: {{ .Release.Name }}-db | ||
ports: | ||
- port: {{ .Values.db.service.port }} | ||
targetPort: {{ .Values.db.service.port }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Release.Name }}-app | ||
namespace: {{ $.Values.namespace }} | ||
labels: | ||
name: {{ .Release.Name }}-app | ||
app.kubernetes.io/name: {{ .Release.Name }}-app | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
annotations: | ||
{{- toYaml .Values.annotations | nindent 6 }} | ||
|
||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: {{ .Release.Name }}-app | ||
app.kubernetes.io/name: {{ .Release.Name }}-app | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-app | ||
app.kubernetes.io/name: {{ .Release.Name }}-app | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
volumes: | ||
- name: explorer-config | ||
configMap: | ||
name: explorer-config | ||
items: | ||
- key: config.json | ||
path: config.json | ||
- key: test-network.json | ||
path: test-network.json | ||
|
||
containers: | ||
- name: {{ .Release.Name }}-app | ||
image: "{{ .Values.explorer.image.repository }}:{{ .Values.explorer.image.tag }}" | ||
imagePullPolicy: {{ .Values.pullPolicy }} | ||
envFrom: | ||
- configMapRef: | ||
name: explorer-env | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
|
||
ports: | ||
- containerPort: {{ .Values.explorer.service.port }} | ||
|
||
volumeMounts: | ||
- mountPath: /opt/explorer/app/platform/fabric/config.json | ||
name: explorer-config | ||
subPath: config.json | ||
- mountPath: /opt/explorer/app/platform/fabric/test-network.json | ||
name: explorer-config | ||
subPath: test-network.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
{{- if .Values.explorer.ingress.enabled -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ .Release.Name }}-app-ingress | ||
namespace: {{ $.Values.namespace }} | ||
labels: | ||
name: {{ .Release.Name }}-app | ||
app.kubernetes.io/name: {{ .Release.Name }}-app | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
annotations: {{- toYaml .Values.explorer.ingress.annotations | nindent 6 }} | ||
|
||
spec: | ||
|
||
rules: | ||
- host: {{ .Values.explorer.ingress.hosts }} | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: {{ .Release.Name }}-app | ||
port: | ||
number: {{ .Values.explorer.service.port }} | ||
path: {{ .Values.explorer.ingress.path }} | ||
pathType: Prefix | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename it something more meaningful?