Skip to content

Commit

Permalink
fetch genesis from remote source
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiker committed Feb 15, 2024
1 parent aaf7d36 commit 2dcfa41
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 145 deletions.
56 changes: 21 additions & 35 deletions templates/helm/templates/blockscout.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: blockscout
namespace: {{ .Release.Namespace }}
Expand Down Expand Up @@ -35,7 +35,7 @@ spec:
value: base
- name: CHAIN_ID
- name: CHAIN_SPEC_PATH
value: /genesis.json
value: {{ .Values.genesis.source }}/genesis.json
- name: CHECKSUM_ADDRESS_HASHES
value: "true"
- name: CHECKSUM_FUNCTION
Expand All @@ -61,9 +61,9 @@ spec:
- name: EMISSION_FORMAT
value: DEFAULT
- name: ETHEREUM_JSONRPC_HTTP_URL
value: http://sequencer:{{ .Values.sequencer.opGeth.port.rpc }}/
value: http://node:{{ .Values.node.opGeth.port.rpc }}/
- name: ETHEREUM_JSONRPC_TRACE_URL
value: http://sequencer:{{ .Values.sequencer.opGeth.port.rpc }}/
value: http://node:{{ .Values.node.opGeth.port.rpc }}/
- name: ETHEREUM_JSONRPC_VARIANT
value: geth
- name: EXTERNAL_APPS
Expand Down Expand Up @@ -135,15 +135,6 @@ spec:
ports:
- containerPort: {{ .Values.blockscout.port }}
protocol: TCP
volumeMounts:
- mountPath: /genesis.json
name: genesis-pvc
readOnly: true
volumes:
- name: genesis-pvc
persistentVolumeClaim:
claimName: genesis-pvc
readOnly: true

---

Expand All @@ -164,7 +155,7 @@ spec:
---

apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: blockscout-postgres
namespace: {{ .Release.Namespace }}
Expand Down Expand Up @@ -195,29 +186,24 @@ spec:
protocol: TCP
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: blockscout-postgres-pvc
name: blockscout-postgres-volume
volumes:
- name: blockscout-postgres-pvc
- name: blockscout-postgres-volume
persistentVolumeClaim:
claimName: blockscout-postgres-pvc

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: blockscout-postgres-pvc
namespace: {{ .Release.Namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.blockscout.db.storage }}
{{- if .Values.global.storageClassName }}
storageClassName: {{ .Values.global.storageClassName }}
{{ end }}
volumeMode: Filesystem
claimName: blockscout-postgres-volume
volumeClaimTemplates:
- metadata:
name: blockscout-postgres-volume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.blockscout.db.storage }}
{{- if .Values.storageClassName }}
storageClassName: {{ .Values.storageClassName }}
{{- end }}
volumeMode: Filesystem

---

Expand Down
10 changes: 5 additions & 5 deletions templates/helm/templates/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ spec:
- extract:
{{- if .Values.externalSecret.prefix }}
key: {{ .Values.externalSecret.prefix }}/private-keys
{{ else }}
{{- else }}
key: {{ $.Release.Namespace }}/{{ $.Release.Name }}/private-keys
{{ end }}
{{ else }}
{{- end }}
{{- else }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -42,7 +42,7 @@ stringData:
PROPOSER_KEY: {{ .Values.env.PROPOSER_KEY }}
SEQUENCER_KEY: {{ .Values.env.SEQUENCER_KEY }}
type: Opaque
{{ end }}
{{- end }}

---

Expand All @@ -57,4 +57,4 @@ spec:
aws:
service: SecretsManager
region: us-east-2
{{ end }}
{{- end }}
15 changes: 0 additions & 15 deletions templates/helm/templates/genesis-pvc.yaml

This file was deleted.

111 changes: 58 additions & 53 deletions templates/helm/templates/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,32 @@ spec:
selector:
matchLabels:
name: node
replicas: {{ .Values.nodes.replicas }}
replicas: {{ .Values.node.replicas }}
template:
metadata:
labels:
name: node
spec:
initContainers:
- name: fetch-genesis
image: curlimages/curl
command: ["sh", "-c"]
args:
- |
curl -L --remote-name-all $GENESIS_SOURCE/{genesis.json,rollup.json} ; \
hexdump -vn32 -e'4/4 "%08x"' /dev/urandom > /genesis/jwt.txt
workingDir: /genesis
env:
- name: GENESIS_SOURCE
value: "{{ .Values.genesis.source }}"
volumeMounts:
- mountPath: /genesis
name: genesis-volume
securityContext:
runAsUser: 0
runAsNonRoot: false
- name: genesis-init
image: {{ .Values.nodes.opGeth.image }}
image: {{ .Values.node.opGeth.image }}
args:
- init
- --datadir=/data
Expand All @@ -24,25 +41,24 @@ spec:
- mountPath: /data
name: op-geth-volume
- mountPath: /genesis
name: genesis-pvc
readOnly: true
name: genesis-volume
containers:
- name: op-geth
image: {{ .Values.nodes.opGeth.image }}
image: {{ .Values.node.opGeth.image }}
args:
- --datadir=/data
- --http
- --http.port={{ .Values.nodes.opGeth.port.rpc }}
- --http.port={{ .Values.node.opGeth.port.rpc }}
- --http.addr=0.0.0.0
- --http.vhosts=*
- --http.corsdomain=*
- --http.api=web3,debug,eth,txpool,net,engine
- --ws
- --ws.port={{ .Values.nodes.opGeth.port.wsrpc }}
- --ws.port={{ .Values.node.opGeth.port.wsrpc }}
- --ws.addr=0.0.0.0
- --ws.origins=*
- --ws.api=debug,eth,txpool,net,engine
- --authrpc.port={{ .Values.nodes.opGeth.port.authrpc }}
- --authrpc.port={{ .Values.node.opGeth.port.authrpc }}
- --authrpc.addr=0.0.0.0
- --authrpc.vhosts=*
- --authrpc.jwtsecret=/genesis/jwt.txt
Expand All @@ -52,28 +68,28 @@ spec:
- --maxpeers=0
- --rollup.disabletxpoolgossip=true
ports:
- containerPort: {{ .Values.nodes.opGeth.port.rpc }}
- containerPort: {{ .Values.node.opGeth.port.rpc }}
protocol: TCP
- containerPort: {{ .Values.nodes.opGeth.port.wsrpc }}
- containerPort: {{ .Values.node.opGeth.port.wsrpc }}
protocol: TCP
- containerPort: {{ .Values.nodes.opGeth.port.authrpc }}
- containerPort: {{ .Values.node.opGeth.port.authrpc }}
protocol: TCP
volumeMounts:
- mountPath: /data
name: op-geth-volume
- mountPath: /genesis
name: genesis-pvc
name: genesis-volume
readOnly: true
livenessProbe:
exec:
command:
- nc
- -z
- localhost
- "{{ .Values.nodes.opGeth.port.rpc }}"
- "{{ .Values.node.opGeth.port.rpc }}"
periodSeconds: 5
- name: op-node
image: {{ .Values.nodes.opNode.image }}
image: {{ .Values.node.opNode.image }}
command:
- sh
- -c
Expand All @@ -82,15 +98,14 @@ spec:
op-node \
--l1=$(L1_RPC) \
--l1.rpckind=any \
--l2=http://localhost:{{ .Values.nodes.opGeth.port.authrpc }} \
--l2=http://localhost:{{ .Values.node.opGeth.port.authrpc }} \
--l2.jwt-secret=/genesis/jwt.txt \
--rollup.config=/genesis/rollup.json \
--rpc.addr=0.0.0.0 \
--rpc.port={{ .Values.nodes.opNode.port.rpc }} \
--rpc.port={{ .Values.node.opNode.port.rpc }} \
--rpc.enable-admin \
--p2p.static="$(cat /genesis/sequencer_multiaddr)" \
--p2p.listen.ip=0.0.0.0 \
--p2p.listen.tcp={{ .Values.nodes.opNode.port.p2p }} \
--p2p.listen.tcp={{ .Values.node.opNode.port.p2p }} \
--sequencer.enabled=false \
--verifier.l1-confs=3 \
--log.level=debug
Expand All @@ -101,58 +116,52 @@ spec:
name: env-cm
key: L1_RPC
ports:
- containerPort: {{ .Values.nodes.opNode.port.rpc }}
- containerPort: {{ .Values.node.opNode.port.rpc }}
protocol: TCP
- containerPort: {{ .Values.nodes.opNode.port.p2p }}
- containerPort: {{ .Values.node.opNode.port.p2p }}
protocol: TCP
- containerPort: {{ .Values.nodes.opNode.port.p2p }}
- containerPort: {{ .Values.node.opNode.port.p2p }}
protocol: UDP
volumeMounts:
- mountPath: /data
name: op-node-volume
- mountPath: /genesis
name: genesis-pvc
name: genesis-volume
readOnly: true
livenessProbe:
exec:
command:
- nc
- -z
- localhost
- "{{ .Values.nodes.opNode.port.rpc }}"
- "{{ .Values.node.opNode.port.rpc }}"
periodSeconds: 5
volumes:
- name: genesis-pvc
- name: genesis-volume
persistentVolumeClaim:
claimName: genesis-pvc
readOnly: true
- name: predeploy-json-cm
configMap:
name: predeploy-json-cm
claimName: genesis-volume
volumeClaimTemplates:
- metadata:
name: op-geth-volume
name: genesis-volume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.nodes.opGeth.volume.storage }}
{{- if .Values.global.storageClassName }}
storageClassName: {{ .Values.global.storageClassName }}
{{ end }}
storage: {{ .Values.genesis.volume.storage }}
{{- if .Values.storageClassName }}
storageClassName: {{ .Values.storageClassName }}
{{- end }}
volumeMode: Filesystem
- metadata:
name: op-node-volume
name: op-geth-volume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.nodes.opNode.volume.storage }}
{{- if .Values.global.storageClassName }}
storageClassName: {{ .Values.global.storageClassName }}
{{ end }}
storage: {{ .Values.node.opGeth.volume.storage }}
{{- if .Values.storageClassName }}
storageClassName: {{ .Values.storageClassName }}
{{- end }}
volumeMode: Filesystem

---
Expand All @@ -169,23 +178,19 @@ spec:
ports:
- protocol: TCP
name: op-geth-rpc
port: {{ .Values.nodes.opGeth.port.rpc }}
targetPort: {{ .Values.nodes.opGeth.port.rpc }}
port: {{ .Values.node.opGeth.port.rpc }}
targetPort: {{ .Values.node.opGeth.port.rpc }}
- protocol: TCP
name: op-geth-wsrpc
port: {{ .Values.nodes.opGeth.port.wsrpc }}
targetPort: {{ .Values.nodes.opGeth.port.wsrpc }}
- protocol: TCP
name: op-geth-authrpc
port: {{ .Values.nodes.opGeth.port.authrpc }}
targetPort: {{ .Values.nodes.opGeth.port.authrpc }}
port: {{ .Values.node.opGeth.port.wsrpc }}
targetPort: {{ .Values.node.opGeth.port.wsrpc }}
- protocol: TCP
name: op-node-rpc
port: {{ .Values.nodes.opNode.port.rpc }}
targetPort: {{ .Values.nodes.opNode.port.rpc }}
port: {{ .Values.node.opNode.port.rpc }}
targetPort: {{ .Values.node.opNode.port.rpc }}
- protocol: TCP
name: op-node-p2p
port: {{ .Values.nodes.opNode.port.p2p }}
port: {{ .Values.node.opNode.port.p2p }}
- protocol: UDP
name: op-node-p2p-udp
port: {{ .Values.nodes.opNode.port.p2p }}
port: {{ .Values.node.opNode.port.p2p }}
8 changes: 4 additions & 4 deletions templates/helm/templates/op-batcher.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: op-batcher
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
name: op-batcher
replicas: 1
replicas: {{ .Values.opBatcher.replicas }}
template:
metadata:
labels:
Expand All @@ -24,8 +24,8 @@ spec:
op-batcher \
--private-key=$(BATCHER_KEY) \
--l1-eth-rpc=$(L1_RPC) \
--l2-eth-rpc=http://sequencer:{{ .Values.sequencer.opGeth.port.rpc }} \
--rollup-rpc=http://sequencer:{{ .Values.sequencer.opNode.port.rpc }} \
--l2-eth-rpc=http://node:{{ .Values.node.opGeth.port.rpc }} \
--rollup-rpc=http://node:{{ .Values.node.opNode.port.rpc }} \
--rpc.port={{ .Values.opBatcher.port.rpc }} \
--rpc.addr=0.0.0.0 \
--rpc.enable-admin \
Expand Down
Loading

0 comments on commit 2dcfa41

Please sign in to comment.