put blockchain cache in image

This commit is contained in:
Jeffrey Paul 2016-09-06 04:21:53 +02:00
parent be3618ce2a
commit 7eb49c0fef
2 changed files with 21 additions and 4 deletions

View File

@ -1,5 +1,7 @@
FROM phusion/baseimage:0.9.19
ARG STEEMD_BLOCKCHAIN=https://cdn.datavibe.net/f/eeqj/20160906.steemd-blockchain.tbz2
# steem:master as of 2016-08-18
ARG STEEMD_REPO=https://github.com/steemit/steem.git
ARG STEEMD_REV=master
@ -35,6 +37,7 @@ RUN \
libssl-dev \
libtool \
ncurses-dev \
pbzip2 \
python3 \
python3-dev \
&& \
@ -117,9 +120,14 @@ RUN \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/var/cache/* \
/usr/include \
/usr/local/include
# add blockchain cache to image
ADD $STEEMD_BLOCKCHAIN /var/cache/steemd/blocks.tbz2
RUN chmod a+rx /var/cache/steemd /var/cache/steemd/*
ENV HOME /var/lib/steemd
RUN useradd -s /bin/bash -m -d /var/lib/steemd steemd

View File

@ -46,15 +46,24 @@ if [[ ! -z "$STEEMD_PRIVATE_KEY" ]]; then
ARGS+=" --private-key=$STEEMD_PRIVATE_KEY"
fi
# without --data-dir it uses cwd as datadir(!)
# who knows what else it dumps into current dir
cd $HOME
# overwrite local config with image one
cp /etc/steemd/config.ini $HOME/config.ini
chown steemd:steemd $HOME/config.ini
if [[ ! -d $HOME/blockchain ]]; then
# init with blockchain cached in image
ARGS+=" --replay-blockchain"
mkdir -p $HOME/blockchain/database
cd $HOME/blockchain/database
tar xvjpf /var/cache/steemd/blocks.tbz2
chown -R steemd:steemd $HOME/blockchain
fi
# without --data-dir it uses cwd as datadir(!)
# who knows what else it dumps into current dir
cd $HOME
# slow down restart loop if flapping
sleep 1