From 5cc9f1c174e85622fbdce3bd7f4323e6cee5c8b4 Mon Sep 17 00:00:00 2001 From: vlad-she <16667906+vlad-she@users.noreply.github.com> Date: Sun, 4 Sep 2022 07:38:48 +1200 Subject: [PATCH] Install latest uplink --- charts/blockchain-node/Chart.yaml | 2 +- .../templates/statefulset.yaml | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/charts/blockchain-node/Chart.yaml b/charts/blockchain-node/Chart.yaml index d8f207b..cd69801 100644 --- a/charts/blockchain-node/Chart.yaml +++ b/charts/blockchain-node/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy a blockchain node type: application -version: 0.0.4 +version: 0.0.5 appVersion: "1.16.0" diff --git a/charts/blockchain-node/templates/statefulset.yaml b/charts/blockchain-node/templates/statefulset.yaml index b085cb3..1e9f0f9 100644 --- a/charts/blockchain-node/templates/statefulset.yaml +++ b/charts/blockchain-node/templates/statefulset.yaml @@ -103,7 +103,7 @@ spec: # TODO: If dataSnapshotURL not given flag dataSnapshotURL must be created, to avoid case when initialy the flag not set, and then was added # Init container to download and extract given snapshot - name: download-data-snapshot - image: storjlabs/uplink:latest + image: alpine:latest env: - name: UPLINK_ACCESS_TOKEN value: {{ $.Values.global.uplinkAccessToken | quote}} @@ -111,27 +111,38 @@ spec: value: "{{ $sts.persistence.volumeMountPath }}/snapshot-extracted" - name: DATA_DIR value: "{{ $sts.persistence.volumeMountPath }}/data" + - name: UPLINK_RELEASE + value: "https://github.com/storj/storj/releases/latest/download/uplink_linux_amd64.zip" - name: UPLINK - value: "/app/uplink" + value: "{{ $sts.persistence.volumeMountPath }}/uplink" workingDir: {{ $sts.persistence.volumeMountPath }} command: - 'sh' - '-c' - | set -exu + if [[ -f $FLAG ]]; then echo "Data already extracted. Skipping." echo "If you wish to re-download data, delete the file '$FLAG'" else + wget $UPLINK_RELEASE -O $(dirname $UPLINK)/uplink_linux_amd64.zip + unzip -o $(dirname $UPLINK)/uplink_linux_amd64.zip -d $(dirname $UPLINK) + + START_TIME="$(date +%s)" rm -rf $DATA_DIR mkdir -p $DATA_DIR cd $DATA_DIR SJ_FILENAME="$(wget --server-response --spider {{ $sts.persistence.pocketDataSnapshotURL }} 2>&1 | grep -iroh -m1 'location:[[:space:]]\+https\?://[a-zA-Z0-9~#%&_+=,.?/-]\+' | cut -d" " -f2 | rev | cut -d'/' -f1|rev|cut -d'?' -f1)" - $UPLINK cp --access="$UPLINK_ACCESS_TOKEN" sj://pocket-public-blockchains/$SJ_FILENAME - | tar xvzf - - echo "Snapshot download completed." + $UPLINK cp \ + --parallelism 8 --parallelism-chunk-size 0 \ + --access="$UPLINK_ACCESS_TOKEN" \ + sj://pocket-public-blockchains/$SJ_FILENAME - | tar xvzf - + echo "Snapshot download completed. Took: $(($(date +%s)-${START_TIME})) sec." echo "$SJ_FILENAME" > $FLAG - fi + rm $UPLINK $(dirname $UPLINK)/uplink_linux_amd64.zip + fi volumeMounts: - name: {{ $volumeName }} mountPath: {{ $sts.persistence.volumeMountPath }}