forked from LBRYCommunity/lbry-sdk
allow wallet snapshots using different compression algos
This commit is contained in:
parent
20fa7bd852
commit
6bca90c4f7
2 changed files with 12 additions and 3 deletions
|
@ -7,6 +7,7 @@ ARG projects_dir=/home/$user
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get -y --no-install-recommends install \
|
apt-get -y --no-install-recommends install \
|
||||||
wget \
|
wget \
|
||||||
|
tar unzip \
|
||||||
build-essential \
|
build-essential \
|
||||||
python3 \
|
python3 \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
|
|
|
@ -2,14 +2,22 @@
|
||||||
|
|
||||||
# entrypoint for wallet server Docker image
|
# entrypoint for wallet server Docker image
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
SNAPSHOT_URL="${SNAPSHOT_URL:-}" #off by default. latest snapshot at https://lbry.com/snapshot/wallet
|
SNAPSHOT_URL="${SNAPSHOT_URL:-}" #off by default. latest snapshot at https://lbry.com/snapshot/wallet
|
||||||
|
|
||||||
if [[ -n "$SNAPSHOT_URL" ]] && [[ ! -f /database/claims.db ]]; then
|
if [[ -n "$SNAPSHOT_URL" ]] && [[ ! -f /database/claims.db ]]; then
|
||||||
|
files="$(ls)"
|
||||||
echo "Downloading wallet snapshot from $SNAPSHOT_URL"
|
echo "Downloading wallet snapshot from $SNAPSHOT_URL"
|
||||||
wget --no-verbose -O wallet_snapshot.tar.bz2 "$SNAPSHOT_URL"
|
wget --no-verbose --trust-server-names --content-disposition "$SNAPSHOT_URL"
|
||||||
echo "Extracting snapshot..."
|
echo "Extracting snapshot..."
|
||||||
tar xvjf wallet_snapshot.tar.bz2 --directory /database
|
filename="$(grep -vf <(echo "$files") <(ls))" # finds the file that was not there before
|
||||||
rm wallet_snapshot.tar.bz2
|
case "$filename" in
|
||||||
|
*.tgz|*.tar.gz|*.tar.bz2 ) tar xvf "$filename" --directory /database ;;
|
||||||
|
*.zip ) unzip "$filename" -d /database ;;
|
||||||
|
* ) echo "Don't know how to extract ${filename}. SNAPSHOT COULD NOT BE LOADED" && exit 1 ;;
|
||||||
|
esac
|
||||||
|
rm "$filename"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/home/lbry/.local/bin/torba-server "$@"
|
/home/lbry/.local/bin/torba-server "$@"
|
||||||
|
|
Loading…
Reference in a new issue