Skip to content

Commit

Permalink
update op-geth snapshot script
Browse files Browse the repository at this point in the history
update snapshot script
  • Loading branch information
coutug committed Sep 27, 2024
1 parent eaddd3c commit d52110f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions charts/geth/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
{{- if .Values.restoreSnapshot.enabled }}
initContainers:
- name: snapshot
image: busybox:stable
image: danysk/zstd:1.5.6
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args:
Expand All @@ -35,9 +35,25 @@ spec:
rm -rf "$RESTORE_PATH"
echo "Downloading and extracting $SNAPSHOT_URL..."
mkdir -p "$RESTORE_PATH"
wget -c "${SNAPSHOT_URL}" -O - | tar -xz -C "$RESTORE_PATH"
# Decompress based on file extension
if [[ "$SNAPSHOT_URL" == *.tar.zst ]]; then
echo "*.tar.zst file detected..."
wget -c "$SNAPSHOT_URL" -O - | zstd -d | tar -x -C "$RESTORE_PATH"
elif [[ "$SNAPSHOT_URL" == *.zst ]]; then
echo "*.zst file detected..."
wget -c "$SNAPSHOT_URL" -O - | zstd -d -rm -o "$RESTORE_PATH"
elif [[ "$SNAPSHOT_URL" == *.tar ]]; then
echo "*.tar file detected..."
wget -c "$SNAPSHOT_URL" -O - | tar -xz -C "$RESTORE_PATH"
else
echo "Unrecognised file format downloaded. Only .tar, .zst and .tar.zst supported."
exit 1
fi
[ "$?" != "0" ] && echo "Streaming download failed" && exit 1
echo "${SNAPSHOT_URL}" > ${STORAGE_PATH}/from_snapshot
echo "Snapshot finished!"
else
echo "Snapshot configuration already restored, continuing..."
fi
Expand Down

0 comments on commit d52110f

Please sign in to comment.