From c75125fb55715f0dc8fc5977ad13594098b469d5 Mon Sep 17 00:00:00 2001 From: "github-merge-queue[bot]" Date: Tue, 21 Jan 2025 18:54:33 +0000 Subject: [PATCH] Changes from astriaorg/astria@92d2d463788c9f12d2a9969cd27e63d3d9c582dd --- charts/sequencer/Chart.yaml | 2 +- .../sequencer/files/scripts/init-cometbft.sh | 26 +++++++++++++++++++ charts/sequencer/templates/statefulsets.yaml | 6 +++++ charts/sequencer/values.yaml | 14 ++++++++-- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/charts/sequencer/Chart.yaml b/charts/sequencer/Chart.yaml index 832ce7d..5107f39 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. diff --git a/charts/sequencer/files/scripts/init-cometbft.sh b/charts/sequencer/files/scripts/init-cometbft.sh index 9cc643f..4c9ddb4 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 362a410..aa1fdf7 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 80bd795..2a23f01 100644 --- a/charts/sequencer/values.yaml +++ b/charts/sequencer/values.yaml @@ -9,12 +9,22 @@ global: useTTY: true dev: false +snapshotLoad: + enabled: false + 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