Skip to content

Commit

Permalink
Merge pull request #37 from pokt-foundation/adjust-uplink-container
Browse files Browse the repository at this point in the history
Install latest uplink
  • Loading branch information
ManInWeb3 authored Sep 3, 2022
2 parents ee924e8 + 5cc9f1c commit 5dd92d0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/blockchain-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
21 changes: 16 additions & 5 deletions charts/blockchain-node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,35 +103,46 @@ 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}}
- name: FLAG
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 }}
Expand Down

0 comments on commit 5dd92d0

Please sign in to comment.