Skip to content

Commit

Permalink
put sequencer and rollup in the same pod to init seq from rollup storage
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasochem committed Feb 10, 2024
1 parent 51e2745 commit 6af52d2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 62 deletions.
10 changes: 0 additions & 10 deletions charts/tezos/scripts/evm-proxy.sh

This file was deleted.

22 changes: 22 additions & 0 deletions charts/tezos/scripts/evm-sequencer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set -e

TEZ_VAR=/var/tezos
TEZ_BIN=/usr/local/bin
CLIENT_DIR="$TEZ_VAR/client"
ROLLUP_DATA_DIR="$TEZ_VAR/rollup"
SEQUENCER_DATA_DIR="$TEZ_VAR/sequencer"

set -x

octez-evm-node init from rollup node ${ROLLUP_DATA_DIR} \
--data-dir ${SEQUENCER_DATA_DIR}


CMD="$TEZ_BIN/octez-evm-node run sequencer \
with endpoint http://rollup-${MY_POD_NAME}:8932 \
signing with edsk3rw6fcwjPe5xkGWAbSquLDQALKP8XyMhy4c6PQGr7qQKTYa8rX \
--data-dir ${SEQUENCER_DATA_DIR} \
--time-between-blocks 6 \
--rpc-addr 0.0.0.0"

exec $CMD
5 changes: 3 additions & 2 deletions charts/tezos/scripts/smart-rollup-node.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -ex
set -e

TEZ_VAR=/var/tezos
TEZ_BIN=/usr/local/bin
Expand All @@ -9,7 +9,8 @@ ROLLUP_DATA_DIR_PREIMAGES="$ROLLUP_DATA_DIR/wasm_2_0_0"
xxd -p -c 0 /usr/local/share/tezos/evm_kernel/evm_installer.wasm | tr -d '\n' > /var/tezos/smart-rollup-boot-sector
mkdir -p "$ROLLUP_DATA_DIR_PREIMAGES"
cp /usr/local/share/tezos/evm_kernel/* "$ROLLUP_DATA_DIR_PREIMAGES"
ls -al $ROLLUP_DATA_DIR

set -x
$TEZ_BIN/octez-smart-rollup-node \
--endpoint http://tezos-node-rpc:8732 \
-d $CLIENT_DIR \
Expand Down
74 changes: 24 additions & 50 deletions charts/tezos/templates/octez-rollup-node.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,24 @@
{{- range $k, $v := .Values.smartRollupNodes }}

{{- if $v.evm_proxy | default false }}
apiVersion: v1
kind: Service
metadata:
name: evm-proxy-{{ $k }}
name: sequencer-{{ $k }}
namespace: {{ $.Release.Namespace }}
spec:
type: NodePort
ports:
- port: 8545
name: evm-proxy
name: sequencer
selector:
app: evm-proxy-{{ $k }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: evm-proxy-{{ $k }}
namespace: {{ $.Release.Namespace }}
{{- if $v.evm_proxy.annotations | default false }}
{{- with $v.evm_proxy.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
podManagementPolicy: Parallel
replicas: 1
serviceName: evm-proxy-{{ $k }}
selector:
matchLabels:
app: evm-proxy-{{ $k }}
template:
metadata:
labels:
app: evm-proxy-{{ $k }}
spec:
containers:
- name: octez-evm-proxy
image: "{{ $.Values.images.octez }}"
imagePullPolicy: {{ $.Values.images_pull_policy }}
ports:
- containerPort: 8545
name: evm-proxy
command:
- /bin/sh
args:
- "-c"
- |
{{ tpl ($.Files.Get "scripts/evm-proxy.sh") $ | indent 12 }}
env:
- name: MY_POD_NAME
value: {{ $k }}
securityContext:
fsGroup: 1000
app: rollup-{{ $k }}
---
{{- if $v.evm_proxy.ingress | default false }}
{{- if $v.evm_proxy.ingress.enabled | default false }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: evm-proxy-{{ $k }}
name: sequencer-{{ $k }}
namespace: {{ $.Release.Namespace }}
{{- with $v.evm_proxy.ingress.labels }}
labels:
Expand Down Expand Up @@ -91,10 +48,9 @@ spec:
path: /
backend:
service:
name: evm-proxy-{{ $k }}
name: sequencer-{{ $k }}
port:
name: evm-proxy
{{- end }}
name: sequencer
{{- end }}
{{- end }}
---
Expand Down Expand Up @@ -159,6 +115,24 @@ spec:
{{- $cleanKey := regexReplaceAll "[0-9]+$" $key "" }}
{{ $cleanKey }}:{{ $value }}
{{- end }}
- name: octez-sequencer
image: "{{ $.Values.images.octez }}"
imagePullPolicy: {{ $.Values.images_pull_policy }}
ports:
- containerPort: 8545
name: sequencer
command:
- /bin/sh
args:
- "-c"
- |
{{ tpl ($.Files.Get "scripts/evm-sequencer.sh") $ | indent 12 }}
volumeMounts:
- mountPath: /var/tezos
name: var-volume
env:
- name: MY_POD_NAME
value: {{ $k }}
initContainers:
- image: {{ $.Values.tezos_k8s_images.utils }}
imagePullPolicy: {{ $.Values.tezos_k8s_images_pull_policy }}
Expand Down

0 comments on commit 6af52d2

Please sign in to comment.