-
Notifications
You must be signed in to change notification settings - Fork 83
Feat/btcd nodes #810
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
base: main
Are you sure you want to change the base?
Feat/btcd nodes #810
Changes from all commits
61ff6e2
4a83c49
e199ba7
6d3ead2
3708b3f
9cc2a85
a170ff7
b537fc7
ba751a7
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,47 @@ | ||
| nodes: | ||
| - name: tank-0001 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0002 | ||
| - tank-0003 | ||
| - name: tank-0002 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0003 | ||
| - tank-0004 | ||
| - name: tank-0003 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0004 | ||
| - tank-0005 | ||
| - name: tank-0004 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0005 | ||
| - tank-0006 | ||
| - name: tank-0005 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0006 | ||
| - name: tank-0006 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| caddy: | ||
| enabled: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| chain: regtest | ||
|
|
||
| implementation: btcd | ||
| restartPolicy: OnFailure | ||
|
|
||
| # TODO: find a better approach to can mine blocks (this address is just for tests) | ||
| config: | | ||
|
Contributor
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. We have |
||
| miningaddr=Sh6VJ4TabWtfBm9kvLWPzj8WGNsMmtyaGF | ||
|
|
||
| collectLogs: true | ||
| metricsExport: false | ||
|
|
||
| resources: {} | ||
|
|
||
| image: | ||
| repository: lucasdbr05/btcd | ||
| pullPolicy: IfNotPresent | ||
| tag: "latest" | ||
| 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,9 @@ | ||
| apiVersion: v2 | ||
| name: btcd | ||
| description: A Helm chart for btcd (alternative Bitcoin full node in Go) | ||
|
|
||
| # Application chart | ||
| type: application | ||
|
|
||
| version: 0.1.0 | ||
| appVersion: 0.1.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Thank you for installing {{ include "btcd.fullname" . }}. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "btcd.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create a default fully qualified app name. | ||
| */}} | ||
| {{- define "btcd.fullname" -}} | ||
| {{- if .Values.fullnameOverride }} | ||
| {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create chart name and version as used by the chart label. | ||
| */}} | ||
| {{- define "btcd.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "btcd.labels" -}} | ||
| helm.sh/chart: {{ include "btcd.chart" . }} | ||
| {{ include "btcd.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "btcd.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "btcd.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Map chain name to btcd config file flag | ||
| */}} | ||
| {{- define "btcd.chainFlag" -}} | ||
| {{- if eq .Values.global.chain "regtest" -}} | ||
| simnet=1 | ||
|
Contributor
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. btcd doesn't have a regtest? is simnet different in any other way? |
||
| {{- else if eq .Values.global.chain "signet" -}} | ||
| signet=1 | ||
| {{- else if eq .Values.global.chain "testnet" -}} | ||
| testnet=1 | ||
| {{- else -}} | ||
| {{/* mainnet: no flag needed */}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }} | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| data: | ||
| btcd.conf: | | ||
| {{ include "btcd.chainFlag" . }} | ||
| rpclisten=0.0.0.0:{{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| rpcuser={{ .Values.global.rpcuser }} | ||
| rpcpass={{ .Values.global.rpcpassword }} | ||
| listen=0.0.0.0:{{ index .Values.global .Values.global.chain "P2PPort" }} | ||
| debuglevel=info | ||
| txindex=1 | ||
| {{- $p2pPort := index .Values.global .Values.global.chain "P2PPort" }} | ||
| {{- range .Values.addnode }} | ||
| {{- printf "addpeer=%s:%v" . $p2pPort | nindent 4 }} | ||
| {{- end }} | ||
| {{- .Values.config | nindent 4 }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }} | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| {{- with .Values.podLabels }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| chain: {{ .Values.global.chain }} | ||
| P2PPort: "{{ index .Values.global .Values.global.chain "P2PPort" }}" | ||
| RPCPort: "{{ index .Values.global .Values.global.chain "RPCListenPort" }}" | ||
| rpcpassword: {{ .Values.global.rpcpassword }} | ||
| app: {{ include "btcd.fullname" . }} | ||
| implementation: btcd | ||
| {{- if .Values.collectLogs }} | ||
| collect_logs: "true" | ||
| {{- end }} | ||
| annotations: | ||
| init_peers: "{{ .Values.addnode | len }}" | ||
| spec: | ||
| restartPolicy: "{{ .Values.restartPolicy }}" | ||
| {{- with .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| securityContext: | ||
| {{- toYaml .Values.podSecurityContext | nindent 4 }} | ||
| {{- if .Values.loadSnapshot.enabled }} | ||
| initContainers: | ||
| - name: download-blocks | ||
| image: alpine:latest | ||
| command: ["/bin/sh", "-c"] | ||
| args: | ||
| - | | ||
| apk add --no-cache curl | ||
| mkdir -p /root/.btcd/data | ||
| curl -L {{ .Values.loadSnapshot.url }} | tar -xz -C /root/.btcd/data | ||
| volumeMounts: | ||
| - name: data | ||
| mountPath: /root/.btcd | ||
| {{- end }} | ||
| containers: | ||
| - name: btcd | ||
| securityContext: | ||
| {{- toYaml .Values.securityContext | nindent 8 }} | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| command: | ||
| - "/bin/linux_amd64/btcd" | ||
| args: | ||
| - "--configfile=/root/.btcd/btcd.conf" | ||
| {{- if .Values.extraArgs }} | ||
| {{- range (split " " .Values.extraArgs) }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| ports: | ||
| - name: rpc | ||
| containerPort: {{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| protocol: TCP | ||
| - name: p2p | ||
| containerPort: {{ index .Values.global .Values.global.chain "P2PPort" }} | ||
| protocol: TCP | ||
| livenessProbe: | ||
| {{- toYaml .Values.livenessProbe | nindent 8 }} | ||
| readinessProbe: | ||
| {{- toYaml .Values.readinessProbe | nindent 8 }} | ||
| tcpSocket: | ||
| port: {{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| resources: | ||
| {{- toYaml .Values.resources | nindent 8 }} | ||
| volumeMounts: | ||
| {{- with .Values.volumeMounts }} | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| - mountPath: /root/.btcd | ||
| name: data | ||
| - mountPath: /root/.btcd/btcd.conf | ||
| name: config | ||
| subPath: btcd.conf | ||
| {{- if .Values.metricsExport }} | ||
| - name: prometheus | ||
| image: bitcoindevproject/bitcoin-exporter:latest | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - name: prom-metrics | ||
| containerPort: {{ .Values.prometheusMetricsPort }} | ||
| protocol: TCP | ||
| env: | ||
| - name: BITCOIN_RPC_HOST | ||
| value: "127.0.0.1" | ||
| - name: BITCOIN_RPC_PORT | ||
| value: "{{ index .Values.global .Values.global.chain "RPCListenPort" }}" | ||
| - name: BITCOIN_RPC_USER | ||
| value: {{ .Values.global.rpcuser }} | ||
| - name: BITCOIN_RPC_PASSWORD | ||
| value: {{ .Values.global.rpcpassword }} | ||
| {{- end }} | ||
| {{- with .Values.extraContainers }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| volumes: | ||
| {{- with .Values.volumes }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| - name: data | ||
| {{- if .Values.persistence.enabled }} | ||
| {{- if .Values.persistence.existingClaim }} | ||
| persistentVolumeClaim: | ||
| claimName: {{ .Values.persistence.existingClaim }} | ||
| {{- else }} | ||
| persistentVolumeClaim: | ||
| claimName: {{ include "btcd.fullname" . }}.{{ .Release.Namespace }}-btcd-data | ||
| {{- end }} | ||
| {{- else }} | ||
| emptyDir: {} | ||
| {{- end }} | ||
| - name: config | ||
| configMap: | ||
| name: {{ include "btcd.fullname" . }} | ||
| {{- with .Values.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }}.{{ .Release.Namespace }}-btcd-data | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| annotations: | ||
| "helm.sh/resource-policy": keep | ||
| spec: | ||
| accessModes: | ||
| - {{ .Values.persistence.accessMode }} | ||
| resources: | ||
| requests: | ||
| storage: {{ .Values.persistence.size }} | ||
| {{- if .Values.persistence.storageClass }} | ||
| storageClassName: {{ .Values.persistence.storageClass }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }} | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| app: {{ include "btcd.fullname" . }} | ||
| spec: | ||
| type: {{ .Values.service.type }} | ||
| ports: | ||
| - port: {{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| targetPort: rpc | ||
| protocol: TCP | ||
| name: rpc | ||
| - port: {{ index .Values.global .Values.global.chain "P2PPort" }} | ||
| targetPort: p2p | ||
| protocol: TCP | ||
| name: p2p | ||
| - port: {{ .Values.prometheusMetricsPort }} | ||
| targetPort: prom-metrics | ||
| protocol: TCP | ||
| name: prometheus-metrics | ||
| selector: | ||
| {{- include "btcd.selectorLabels" . | nindent 4 }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| {{- if .Values.metricsExport }} | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }} | ||
| labels: | ||
| app.kubernetes.io/name: btcd-metrics | ||
| release: prometheus | ||
| spec: | ||
| endpoints: | ||
| - port: prometheus-metrics | ||
| interval: {{ .Values.metricsScrapeInterval | default "15s" }} | ||
| selector: | ||
| matchLabels: | ||
| app: {{ include "btcd.fullname" . }} | ||
| {{- 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.
c47fbbb
Is this required for btcd? For lnd for example we expect it to crash and restart a few times on deployment while it waits for the bitcoin core node to come up. However, for bitcoin core itself we usually don't want this, because if bitcoin core crashes we don't want it to silently restart, we want to know why it crashed.