Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(charts): snapshot startup for sequencer #1876

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/sequencer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 26 additions & 0 deletions charts/sequencer/files/scripts/init-cometbft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions charts/sequencer/templates/statefulsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand Down
16 changes: 13 additions & 3 deletions charts/sequencer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,7 +34,7 @@ images:
repo: ghcr.io/astriaorg/sequencer
pullPolicy: IfNotPresent
tag: 1.0.0
devTag: latest
devTag: local

moniker: ""
genesis:
Expand Down
Loading