Skip to content

Commit fbf0bc1

Browse files
committed
add forkobserver
Adds an optional fork-observer module.
1 parent 087b2b5 commit fbf0bc1

File tree

15 files changed

+394
-6
lines changed

15 files changed

+394
-6
lines changed

resources/charts/bitcoincore/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ regtestConfig: |
118118
rpcport=18443
119119
rpcallowip=0.0.0.0/0
120120
rpcbind=0.0.0.0
121+
rest=1
121122
122123
baseConfig: |
123124
checkmempool=0
@@ -134,4 +135,4 @@ baseConfig: |
134135
135136
config: ""
136137

137-
connect: []
138+
connect: []
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: fork-observer
3+
description: A Helm chart for fork-observer
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: 0.1.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fork-observer is watching you
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "fork-observer.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "fork-observer.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}
18+
{{- end }}
19+
{{- end }}
20+
21+
{{/*
22+
Create chart name and version as used by the chart label.
23+
*/}}
24+
{{- define "fork-observer.chart" -}}
25+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
26+
{{- end }}
27+
28+
{{/*
29+
Common labels
30+
*/}}
31+
{{- define "fork-observer.labels" -}}
32+
helm.sh/chart: {{ include "fork-observer.chart" . }}
33+
{{ include "fork-observer.selectorLabels" . }}
34+
{{- if .Chart.AppVersion }}
35+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
36+
{{- end }}
37+
app.kubernetes.io/managed-by: {{ .Release.Service }}
38+
{{- end }}
39+
40+
{{/*
41+
Selector labels
42+
*/}}
43+
{{- define "fork-observer.selectorLabels" -}}
44+
app.kubernetes.io/name: {{ include "fork-observer.name" . }}
45+
app.kubernetes.io/instance: {{ .Release.Name }}
46+
{{- end }}
47+
48+
{{/*
49+
Create the name of the service account to use
50+
*/}}
51+
{{- define "fork-observer.serviceAccountName" -}}
52+
{{- if .Values.serviceAccount.create }}
53+
{{- default (include "fork-observer.fullname" .) .Values.serviceAccount.name }}
54+
{{- else }}
55+
{{- default "default" .Values.serviceAccount.name }}
56+
{{- end }}
57+
{{- end }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "fork-observer.fullname" . }}
5+
labels:
6+
{{- include "fork-observer.labels" . | nindent 4 }}
7+
data:
8+
config.toml: |
9+
{{- .Values.configQueryInterval | nindent 4 }}
10+
{{- .Values.baseConfig | nindent 4 }}
11+
{{- .Values.config | nindent 8 }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: {{ include "fork-observer.fullname" . }}
5+
labels:
6+
{{- include "fork-observer.labels" . | nindent 4 }}
7+
{{- with .Values.podLabels }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
app: {{ include "fork-observer.fullname" . }}
11+
spec:
12+
restartPolicy: "{{ .Values.restartPolicy }}"
13+
{{- with .Values.imagePullSecrets }}
14+
imagePullSecrets:
15+
{{- toYaml . | nindent 4 }}
16+
{{- end }}
17+
securityContext:
18+
{{- toYaml .Values.podSecurityContext | nindent 4 }}
19+
containers:
20+
- name: {{ .Chart.Name }}
21+
securityContext:
22+
{{- toYaml .Values.securityContext | nindent 8 }}
23+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
24+
imagePullPolicy: {{ .Values.image.pullPolicy }}
25+
ports:
26+
- name: web
27+
containerPort: {{ .Values.port }}
28+
protocol: TCP
29+
livenessProbe:
30+
{{- toYaml .Values.livenessProbe | nindent 8 }}
31+
readinessProbe:
32+
{{- toYaml .Values.readinessProbe | nindent 8 }}
33+
resources:
34+
{{- toYaml .Values.resources | nindent 8 }}
35+
volumeMounts:
36+
{{- with .Values.volumeMounts }}
37+
{{- toYaml . | nindent 8 }}
38+
{{- end }}
39+
- mountPath: /app/config.toml
40+
name: config
41+
subPath: config.toml
42+
volumes:
43+
{{- with .Values.volumes }}
44+
{{- toYaml . | nindent 4 }}
45+
{{- end }}
46+
- configMap:
47+
name: {{ include "fork-observer.fullname" . }}
48+
name: config
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "fork-observer.fullname" . }}
5+
labels:
6+
{{- include "fork-observer.labels" . | nindent 4 }}
7+
app: {{ include "fork-observer.fullname" . }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
ports:
11+
- port: {{ .Values.port }}
12+
targetPort: web
13+
protocol: TCP
14+
name: rpc
15+
selector:
16+
{{- include "fork-observer.selectorLabels" . | nindent 4 }}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Default values for fork-observer.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
namespace: warnet
5+
6+
restartPolicy: Always
7+
8+
image:
9+
repository: b10c/fork-observer
10+
pullPolicy: IfNotPresent
11+
# Overrides the image tag whose default is the chart appVersion.
12+
tag: "latest"
13+
14+
imagePullSecrets: []
15+
nameOverride: ""
16+
fullnameOverride: ""
17+
18+
podLabels:
19+
app: "warnet"
20+
mission: "observer"
21+
22+
podSecurityContext: {}
23+
# fsGroup: 2000
24+
25+
securityContext: {}
26+
# capabilities:
27+
# drop:
28+
# - ALL
29+
# readOnlyRootFilesystem: true
30+
# runAsNonRoot: true
31+
# runAsUser: 1000
32+
33+
service:
34+
type: ClusterIP
35+
36+
resources: {}
37+
# We usually recommend not to specify default resources and to leave this as a conscious
38+
# choice for the user. This also increases chances charts run on environments with little
39+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
40+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
41+
# limits:
42+
# cpu: 100m
43+
# memory: 128Mi
44+
# requests:
45+
# cpu: 100m
46+
# memory: 128Mi
47+
48+
livenessProbe:
49+
exec:
50+
command:
51+
- pidof
52+
- fork-observer
53+
failureThreshold: 3
54+
initialDelaySeconds: 5
55+
periodSeconds: 5
56+
successThreshold: 1
57+
timeoutSeconds: 1
58+
readinessProbe:
59+
failureThreshold: 1
60+
periodSeconds: 1
61+
successThreshold: 1
62+
tcpSocket:
63+
port: 2323
64+
timeoutSeconds: 1
65+
66+
# Additional volumes on the output Deployment definition.
67+
volumes: []
68+
# - name: foo
69+
# secret:
70+
# secretName: mysecret
71+
# optional: false
72+
73+
# Additional volumeMounts on the output Deployment definition.
74+
volumeMounts: []
75+
# - name: foo
76+
# mountPath: "/etc/foo"
77+
# readOnly: true
78+
79+
port: 2323
80+
81+
configQueryInterval: |
82+
# Interval for checking for new blocks
83+
query_interval = 20
84+
85+
baseConfig: |
86+
# Database path of the key value store. Will be created if non-existing.
87+
database_path = "db"
88+
89+
# path to the location of the static www files
90+
www_path = "./www"
91+
92+
# Webserver listen address
93+
address = "0.0.0.0:2323"
94+
95+
# Custom footer for the site.
96+
footer_html = """
97+
<div class="my-2">
98+
<div>
99+
<span class="text-muted">Warnet fork-observer</span>
100+
</div>
101+
</div>
102+
"""
103+
104+
[[networks]]
105+
id = 0xDEADBE
106+
name = "Warnet"
107+
description = "A Warnet"
108+
min_fork_height = 0
109+
max_interesting_heights = 100
110+
[pool_identification]
111+
enable = false
112+
113+
config: ""

resources/networks/6_node_bitcoin/network.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ nodes:
2727
- name: tank-0005
2828
connect:
2929
- tank-0006
30-
- name: tank-0006
30+
- name: tank-0006
31+
fork_observer: true

0 commit comments

Comments
 (0)