download wallet snapshot on first run

This commit is contained in:
Alex Grintsvayg 2019-09-16 09:51:22 -04:00 committed by Lex Berezhny
parent a7b205603c
commit 32ee7feea8
2 changed files with 18 additions and 2 deletions

View file

@ -8,7 +8,7 @@ RUN mkdir -p /home/$user/
RUN chown -R $user:$user /home/$user/ RUN chown -R $user:$user /home/$user/
# install python, pip, git and clean up # install python, pip, git and clean up
RUN apt-get update && apt-get -y --no-install-recommends install build-essential git python3.7 python3.7-dev python3-pip && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get -y --no-install-recommends install build-essential git tar wget python3.7 python3.7-dev python3-pip && rm -rf /var/lib/apt/lists/*
# create and chown database dir # create and chown database dir
ARG db_dir=/database ARG db_dir=/database
@ -53,4 +53,5 @@ ENV BANDWIDTH_LIMIT=1000000000000000000000000000000000000000000
ENV MAX_SESSIONS=1000000000 ENV MAX_SESSIONS=1000000000
ENV MAX_SEND=1000000000000000000 ENV MAX_SEND=1000000000000000000
ENV EVENT_LOOP_POLICY=uvloop ENV EVENT_LOOP_POLICY=uvloop
ENTRYPOINT ["/home/lbry/.local/bin/torba-server"] COPY ./lbry/scripts/wallet_server_entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -0,0 +1,15 @@
#!/bin/bash
# entrypoint for wallet server Docker image
SNAPSHOT_URL="${SNAPSHOT_URL:-}" #off by default. latest snapshot at https://lbry.com/snapshot/wallet
if [[ -n "$SNAPSHOT_URL" ]] && [[ ! -f /database/claims.db ]]; then
echo "Downloading wallet snapshot from $SNAPSHOT_URL"
wget -O wallet_snapshot.tar.bz2 "$SNAPSHOT_URL"
echo "Extracting snapshot..."
tar xvjf wallet_snapshot.tar.bz2 --directory /database
rm wallet_snapshot.tar.bz2
fi
/home/lbry/.local/bin/torba-server "$@"