Skip to content

Commit

Permalink
allow setting the snapshot archive format to extract using the correc…
Browse files Browse the repository at this point in the history
…t tool
  • Loading branch information
PierreBesson committed Aug 12, 2021
1 parent f5eea32 commit d43048a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: node
description: A Helm chart to deploy Substrate/Polkadot nodes
type: application
version: 0.4.0
version: 0.5.0
appVersion: "0.0.1"
11 changes: 6 additions & 5 deletions charts/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ This will deploy a single Polkadot node with the default configuration.

Polkadot:
```console
helm install polkadot-node parity/node --set node.chainDataSnapshotUrl=https://dot-rocksdb.polkashots.io/snapshot
helm install polkadot-node parity/node --set node.chainDataSnapshotUrl=https://dot-rocksdb.polkashots.io/snapshot --set node.chainDataSnapshotFormat=7z
```

Kusama:
```console
helm install kusama-node parity/node --set node.chainDataSnapshotUrl=https://ksm-rocksdb.polkashots.io/snapshot --set node.chainPath=ksmcc3
helm install kusama-node parity/node --set node.chainDataSnapshotUrl=https://ksm-rocksdb.polkashots.io/snapshot --set node.chainDataSnapshotFormat=7z --set node.chainPath=ksmcc3
```
⚠️ For some chains where the local directory name is different from the chain ID, `node.chainPath` need to be set to a custom value.
⚠️ For some chains where the local directory name is different from the chain ID, `node.chainPath` needs to be set to a custom value.

## Parameters

Expand All @@ -46,9 +46,10 @@ helm install kusama-node parity/node --set node.chainDataSnapshotUrl=https://ksm
| `node.dataVolumeSize` | The size of the chain data PersistentVolume | `100Gi` |
| `node.replica` | Number of replica in the node StatefulSet | `1` |
| `node.chainDataSnapshotUrl` | Download and load chain data from a snapshot archive http URL | `` |
| `node.chainDataSnapshotExtractionPath` | The path at which the snapshot archive downloaded from a http URL will be extracted | `/data/chains/${CHAIN_PATH}` |
| `node.chainDataSnapshotExtractionPath` | The path at which the snapshot archive downloaded from a http URL will be extracted | `/data/chains/${CHAIN_PATH}` |
| `node.chainDataSnapshotFormat` | The snapshot archive format (`tar` or `7z`) | `tar` |
| `node.chainDataGcsBucketUrl` | Sync chain data files from a GCS bucket (eg. `gs://bucket-name/folder-name`) | `` |
| `node.chainPath` | Path at which the chain database files are located (`/data/chains/${CHAIN_PATH}`) | `nil` (if undefined, fallbacks to the value in `node.chain`) |
| `node.chainPath` | Path at which the chain database files are located (`/data/chains/${CHAIN_PATH}`) | `nil` (if undefined, fallbacks to the value in `node.chain`) |
| `node.chainDataKubernetesVolumeSnapshot` | Initialize the chain data volume from a Kubernetes VolumeSnapshot | `` |
| `node.resources.limits` | The resources limits (cpu/memory) for nodes | `{}` |
| `node.resources.requests` | The resources requests (cpu/memory) for nodes | `{}` |
Expand Down
10 changes: 6 additions & 4 deletions charts/node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ spec:
args:
- -c
- |
if [[ -d "/data/chains/${CHAIN_PATH}/db" ]]; then
if [ -d "/data/chains/${CHAIN_PATH}/db" ]; then
echo "Database directory already exists, skipping snapshot download"
else
SNAPSHOT_URL="{{ .Values.node.chainDataSnapshotUrl }}"
wget -O /data/snapshot $SNAPSHOT_URL
if [[ ! -f /data/snapshot ]]; then
wget -O /data/snapshot ${SNAPSHOT_URL}
if [ ! -f /data/snapshot ]; then
echo "Failed to download snapshot"
exit 1
fi
mkdir -p /data/chains/${CHAIN_PATH}/db/
if [[ $(expr match "$SNAPSHOT_URL" ".*7z") != 0 ]]; then
if [ "${SNAPSHOT_FORMAT}" == "7z" ]; then
7z x /data/snapshot -o/data/chains/${CHAIN_PATH}/
else
tar xvf /data/snapshot --directory={{ .Values.node.chainDataSnapshotExtractionPath }}
Expand All @@ -55,6 +55,8 @@ spec:
env:
- name: CHAIN_PATH
value: {{ default .Values.node.chain .Values.node.chainPath }}
- name: SNAPSHOT_FORMAT
value: {{ default "tar" .Values.node.chainDataSnapshotFormat }}
volumeMounts:
- mountPath: /data
name: chain-data
Expand Down
1 change: 1 addition & 0 deletions charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ node:
replicas: 1
#chainDataSnapshotUrl: ""
chainDataSnapshotExtractionPath: "/data/chains/${CHAIN_PATH}"
chainDataSnapshotFormat: tar
#chainPath: ""
#chainDataKubernetesVolumeSnapshot: ""
#chainDataGcsBucketUrl: ""
Expand Down

0 comments on commit d43048a

Please sign in to comment.