From 09443f7a8459ec024c7a44a830c1773317e64cf4 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Thu, 12 Dec 2024 16:19:43 -0800 Subject: [PATCH 1/4] feat(charts): snapshot startup for sequencer --- .../sequencer/files/scripts/init-cometbft.sh | 26 +++++++++++++++++++ charts/sequencer/templates/statefulsets.yaml | 6 +++++ charts/sequencer/values.yaml | 16 +++++++++--- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/charts/sequencer/files/scripts/init-cometbft.sh b/charts/sequencer/files/scripts/init-cometbft.sh index 9cc643f81b..4c9ddb4389 100644 --- a/charts/sequencer/files/scripts/init-cometbft.sh +++ b/charts/sequencer/files/scripts/init-cometbft.sh @@ -4,13 +4,39 @@ set -o errexit -o nounset # Only need to configure cometbft data if not already initialized if [ ! -d "/cometbft/data" ]; then + # Load the snapshot on load if enabled + {{- if .Values.snapshotLoad.enabled }} + echo "Downdloading snapshot..." + rclone config create r2 s3 \ + provider={{ .Values.snapshotLoad.config.provider }} \ + access_key_id={{ .Values.snapshotLoad.config.accessKeyId }} \ + secret_access_key={{ .Values.snapshotLoad.config.secretAccessKey }} \ + region={{ .Values.snapshotLoad.config.region }} \ + endpoint={{ .Values.snapshotLoad.config.endpoint }} \ + acl={{ .Values.snapshotLoad.config.acl }} + rclone copy -P r2:astria-mainnet-snapshots/ /snapshot/ + + echo "Extracting snapshot..." + mkdir /cometbft/data + mkdir /sequencer/penumbra.db + tar -C /cometbft/data/ --strip-components=2 -xzf /snapshot/cometbft_*.tar.gz cometbft/data + tar -C /sequencer/penumbra.db/ --strip-components=2 -xzf /snapshot/sequencer_*.tar.gz sequencer/penumbra.db + rm /snapshot/cometbft_*.tar.gz /snapshot/sequencer_*.tar.gz + {{- else }} + # Otherwise initialize with basic values + echo "Intializing cometbft with empty data directory..." cp -LR /data/ /cometbft/data + {{- end }} +else + echo "CometBFT data directory already initialized" fi # Don't replace the config directory if it already exists if [ ! -d "/cometbft/config" ]; then + echo "Creating Config Directory..." cp -LR /config/ /cometbft/config else + echo "Updating config directory..." cp /config/* /cometbft/config/ fi diff --git a/charts/sequencer/templates/statefulsets.yaml b/charts/sequencer/templates/statefulsets.yaml index 362a410f61..aa1fdf79d0 100644 --- a/charts/sequencer/templates/statefulsets.yaml +++ b/charts/sequencer/templates/statefulsets.yaml @@ -31,6 +31,12 @@ spec: - mountPath: /cometbft name: sequencer-shared-storage-vol subPath: {{ .Values.moniker }}/cometbft + - mountPath: /sequencer + name: sequencer-shared-storage-vol + subPath: {{ .Values.moniker }}/sequencer + - mountPath: /snapshot + name: sequencer-shared-storage-vol + subPath: {{ .Values.moniker }}/snapshot containers: - name: sequencer image: {{ include "sequencer.image" . }} diff --git a/charts/sequencer/values.yaml b/charts/sequencer/values.yaml index 80bd795258..a8e74db918 100644 --- a/charts/sequencer/values.yaml +++ b/charts/sequencer/values.yaml @@ -9,12 +9,22 @@ global: useTTY: true dev: false +snapshotLoad: + enabled: true + config: + provider: Cloudflare + accessKeyId: 0d8d8005e468dd86498bde6dfa02044f + secretAccessKey: e33ea43e00d9b655cb72d8a8107fa2957bd6b77e5718df0a26f259956532bba8 + region: auto + endpoint: https://fb1caa337c8e4e3101363ca1240e03ca.r2.cloudflarestorage.com + acl: private + # sequencer core images images: init: - repo: ghcr.io/tomwright/dasel + repo: rclone/rclone pullPolicy: IfNotPresent - tag: alpine + tag: 1.56.0 cometBFT: repo: docker.io/cometbft/cometbft pullPolicy: IfNotPresent @@ -24,7 +34,7 @@ images: repo: ghcr.io/astriaorg/sequencer pullPolicy: IfNotPresent tag: 1.0.0 - devTag: latest + devTag: local moniker: "" genesis: From 30dfa76d88a9355f5eba9821f67b43d4472dd96b Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Mon, 13 Jan 2025 11:16:13 -0800 Subject: [PATCH 2/4] disable snapshotload default --- charts/sequencer/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/sequencer/values.yaml b/charts/sequencer/values.yaml index a8e74db918..1f3684d4ca 100644 --- a/charts/sequencer/values.yaml +++ b/charts/sequencer/values.yaml @@ -10,7 +10,7 @@ global: dev: false snapshotLoad: - enabled: true + enabled: false config: provider: Cloudflare accessKeyId: 0d8d8005e468dd86498bde6dfa02044f From 9ba2efe20ed1c4f5b69dab0afd22f38ed9a42e49 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Mon, 13 Jan 2025 11:21:03 -0800 Subject: [PATCH 3/4] update sequencer chart version --- charts/sequencer/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/sequencer/Chart.yaml b/charts/sequencer/Chart.yaml index 832ce7df76..5107f393d6 100644 --- a/charts/sequencer/Chart.yaml +++ b/charts/sequencer/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.1 +version: 1.0.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. From 91d9a0d03ebfdc1eaa69c04adc7b5edb24676558 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Tue, 14 Jan 2025 13:13:26 -0800 Subject: [PATCH 4/4] update tag --- charts/sequencer/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/sequencer/values.yaml b/charts/sequencer/values.yaml index 1f3684d4ca..2a23f01e26 100644 --- a/charts/sequencer/values.yaml +++ b/charts/sequencer/values.yaml @@ -34,7 +34,7 @@ images: repo: ghcr.io/astriaorg/sequencer pullPolicy: IfNotPresent tag: 1.0.0 - devTag: local + devTag: latest moniker: "" genesis: