Skip to content

Commit c7d55b7

Browse files
feat(nimbus): default to archive, enable era files download (#473)
1 parent f1e22db commit c7d55b7

File tree

4 files changed

+71
-7
lines changed

4 files changed

+71
-7
lines changed

charts/nimbus/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.5.23
18+
version: 0.6.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/nimbus/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Deploy and scale [Nimbus](https://github.com/status-im/nimbus-eth2) inside Kubernetes with ease
44

5-
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.5.23](https://img.shields.io/badge/Version-0.5.23-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: multiarch-v25.1.0](https://img.shields.io/badge/AppVersion-multiarch--v25.1.0-informational?style=flat-square)
5+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.6.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: multiarch-v25.1.0](https://img.shields.io/badge/AppVersion-multiarch--v25.1.0-informational?style=flat-square)
66

77
## Chart Features
88

@@ -112,6 +112,7 @@ We do not recommend that you upgrade the application by overriding `image.tag`.
112112
| nimbus.extraContainers | Additional containers to inject to this graph node group - an array of Container objects | list | `[]` |
113113
| nimbus.extraInitContainers | Additional init containers to inject to this graph node group - an array of Container objects | list | `[]` |
114114
| nimbus.extraLabels | Extra labels to attach to the Pod for matching against | object | `{}` |
115+
| nimbus.history | History preservation mode, archive or prune | string | `"archive"` |
115116
| nimbus.initChownData.enabled | Init container to set the correct permissions to access data directories | bool | `true` |
116117
| nimbus.initChownData.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` |
117118
| nimbus.initChownData.image.repository | Container repository | string | `"busybox"` |
@@ -143,11 +144,16 @@ We do not recommend that you upgrade the application by overriding `image.tag`.
143144
| nimbus.terminationGracePeriodSeconds | Amount of time to wait before force-killing the container | int | `60` |
144145
| nimbus.tolerations | | list | `[]` |
145146
| nimbus.trustedNodeSync.enabled | Enable init container to do a trusted checkpoint sync from another Consensus Client (be careful) | bool | `false` |
147+
| nimbus.trustedNodeSync.eraFiles | Use era files for an archive node | bool | `true` |
148+
| nimbus.trustedNodeSync.eraFilesUrl | URL for downloading era files | string | `"https://mainnet.era.nimbus.team/"` |
146149
| nimbus.trustedNodeSync.extraArgs | Additional CLI arguments | list | `[]` |
150+
| nimbus.trustedNodeSync.initContainer.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` |
151+
| nimbus.trustedNodeSync.initContainer.image.repository | Container image to fetch era files | string | `"ghcr.io/graphops/docker-builds/init-stream-download"` |
152+
| nimbus.trustedNodeSync.initContainer.image.tag | Container tag | string | `"latest"` |
147153
| nimbus.trustedNodeSync.trustedNodeUrl | URL to the Trusted Consensus Client Node URL. See https://eth-clients.github.io/checkpoint-sync-endpoints/ | string | `""` |
148154
| nimbus.updateStrategyType | Choice of StatefulSet updateStrategy (OnDelete|RollingUpdate) | string | `"RollingUpdate"` |
149-
| nimbus.volumeClaimSpec | [PersistentVolumeClaimSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#persistentvolumeclaimspec-v1-core) for storage | object | `{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"300Gi"}},"storageClassName":null}` |
150-
| nimbus.volumeClaimSpec.resources.requests.storage | The amount of disk space to provision | string | `"300Gi"` |
155+
| nimbus.volumeClaimSpec | [PersistentVolumeClaimSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#persistentvolumeclaimspec-v1-core) for storage | object | `{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"2Ti"}},"storageClassName":null}` |
156+
| nimbus.volumeClaimSpec.resources.requests.storage | The amount of disk space to provision | string | `"2Ti"` |
151157
| nimbus.volumeClaimSpec.storageClassName | The storage class to use when provisioning a persistent volume | string | `nil` |
152158
| prometheus.serviceMonitors.enabled | Enable monitoring by creating `ServiceMonitor` CRDs ([prometheus-operator](https://github.com/prometheus-operator/prometheus-operator)) | bool | `false` |
153159
| prometheus.serviceMonitors.interval | | string | `nil` |

charts/nimbus/templates/nimbus/statefulset.yaml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,43 @@ spec:
142142
mountPath: "/storage"
143143
{{- end }}
144144
{{- if $values.trustedNodeSync.enabled }}
145+
{{- if $values.trustedNodeSync.eraFiles }}
146+
- name: init-era-files
147+
image: "{{ $values.trustedNodeSync.initContainer.image.repository }}:{{ $values.trustedNodeSync.initContainer.image.tag }}"
148+
imagePullPolicy: {{ .Values.image.pullPolicy }}
149+
securityContext:
150+
readOnlyRootFilesystem: true
151+
capabilities:
152+
drop:
153+
- ALL
154+
env:
155+
- name: ERA_FILES_URL
156+
value: {{ $values.trustedNodeSync.eraFilesUrl }}
157+
command:
158+
- sh
159+
- -ac
160+
- |
161+
set -x;
162+
ERA_FILES_STATE_FILE=/storage/era/.init-era-files
163+
TRUSTED_NODE_SYNC_STATE_FILE=/storage/.init-trusted-node-sync
164+
if [ -f "$TRUSTED_NODE_SYNC_STATE_FILE" ]; then
165+
echo "Trusted Node Sync already ran. Skipping..."
166+
elif [ ! -f "$ERA_FILES_STATE_FILE" ]; then
167+
mkdir -p /storage/era
168+
cd /storage/era
169+
wget --no-parent -A '*.era' -q --show-progress -nd -r -c "$ERA_FILES_URL"
170+
[ "$?" != "0" ] && echo "Download failed" && exit 1
171+
echo $ERA_FILES_URL > $ERA_FILES_STATE_FILE
172+
else
173+
cat $ERA_FILES_STATE_FILE
174+
echo "Era files already downloaded. Skipping..."
175+
fi
176+
volumeMounts:
177+
- name: storage
178+
mountPath: /storage
179+
- name: tmp
180+
mountPath: /tmp
181+
{{- end }}
145182
- name: init-trusted-node-sync
146183
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
147184
imagePullPolicy: {{ .Values.image.pullPolicy }}
@@ -161,12 +198,18 @@ spec:
161198
/home/user/nimbus-eth2/build/nimbus_beacon_node \
162199
trustedNodeSync \
163200
--data-dir=/storage \
201+
{{- if $values.trustedNodeSync.eraFiles }}
202+
--reindex=true \
203+
{{- end }}
164204
{{- range $arg := $values.trustedNodeSync.extraArgs }}
165205
{{- $arg | nindent 18 }} \
166206
{{- end }}
167207
--trusted-node-url=$TRUSTED_NODE_URL
168-
echo $?
169-
echo $TRUSTED_NODE_URL > $TRUSTED_NODE_SYNC_STATE_FILE
208+
if [ $? -eq 0 ]; then
209+
echo $TRUSTED_NODE_URL > $TRUSTED_NODE_SYNC_STATE_FILE
210+
else
211+
exit 1
212+
fi
170213
else
171214
cat $TRUSTED_NODE_SYNC_STATE_FILE
172215
echo "Trusted node sync already run. Skipping..."
@@ -207,6 +250,7 @@ spec:
207250
set -ex;
208251
exec /home/user/nimbus-eth2/build/nimbus_beacon_node \
209252
--data-dir=/storage \
253+
--history={{ $values.history }} \
210254
{{- if $values.executionClientUrl }}
211255
--web3-url={{ $values.executionClientUrl }} \
212256
{{- end }}

charts/nimbus/values.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ grafana:
7070
nimbus:
7171
# -- URL to the Execution Client Engine API. Will use configured JWT to authenticate.
7272
executionClientUrl: "" # e.g. http://erigon:8551
73+
# -- History preservation mode, archive or prune
74+
history: archive
7375
# -- JWT to use to authenticate with Execution Client. Specify either `existingSecret` OR `fromLiteral`.
7476
jwt:
7577
# -- Load the JWT from an existing Kubernetes Secret. Takes precedence over `fromLiteral` if set.
@@ -95,7 +97,7 @@ nimbus:
9597
resources:
9698
requests:
9799
# -- The amount of disk space to provision
98-
storage: 300Gi
100+
storage: 2Ti
99101

100102
# Increasing the grace termination period prevents Kubernetes
101103
# from killing the node process prematurely. Premature shutdown
@@ -180,6 +182,18 @@ nimbus:
180182
trustedNodeUrl: ""
181183
# -- Additional CLI arguments
182184
extraArgs: []
185+
# -- Use era files for an archive node
186+
eraFiles: true
187+
# -- URL for downloading era files
188+
eraFilesUrl: https://mainnet.era.nimbus.team/
189+
initContainer:
190+
image:
191+
# -- Container image to fetch era files
192+
repository: ghcr.io/graphops/docker-builds/init-stream-download
193+
# -- Container tag
194+
tag: latest
195+
# -- Container pull policy
196+
pullPolicy: IfNotPresent
183197

184198
p2pNodePort:
185199
# -- Expose P2P port via NodePort

0 commit comments

Comments
 (0)