-
Notifications
You must be signed in to change notification settings - Fork 66
Stop downloading ancient version of litecoin #19
Description
downloading old versions automatically
Currently when installing litecore-node it's preinstall script download installs an ancient version v0.13.2.1-litecore-rc2 of a special version of litecoin.
That ancient version of litecoin is indeed downloaded twice! Once when npm install runs and a second time when litecore-node install runs. This is awful on so many levels!
Instead litecore-node should NOT download any binary at all but let the user decide which version to run.
skip that useless download
When setting
SKIP_BITCOIN_DOWNLOAD=1
VERIFY_BITCOIN_DOWNLOAD=0
it skips the download but later bails out because something tries to chmod the nonexisting binary litecoind:
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
> litecore-node@3.1.11 preinstall /usr/local/lib/node_modules/litecore-node
> ./scripts/download
/usr/local/bin/litecore-node -> /usr/local/lib/node_modules/litecore-node/bin/litecore-node
npm ERR! path /usr/local/lib/node_modules/litecore-node/bin/litecoind
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/litecore-node/bin/litecoind'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-06-14T14_11_25_422Z-debug.log
There are so many workarounds needed to get this installed and running in a meaningfull manner...
For a sane way to use litecoin-node see below: Remove all the auto-installed litecoin versions and install the latest version on your own.
Example Dockerfile with newest litecoin binary included
#
# build with: docker build . -t mytag -f <Dockerfile>
#
FROM node:8-slim
# litecore-node can't be installed without it downloading an ancient
# version of litecoin. We do remove the ancient version below in
# `remove not needed files`
# ENV SKIP_BITCOIN_DOWNLOAD=1
ENV VERIFY_BITCOIN_DOWNLOAD=0
# install dependencies etc in one big RUN statement
RUN apt-get update \
&& extraPackages=" \
python \
libzmq5 \
" \
&& buildDepends=" \
build-essential \
jq \
libzmq3-dev \
" \
&& apt-get install -y --no-install-recommends \
$extraPackages \
$buildDepends \
\
&& npm install -g litecore-node --unsafe-perm=true \
\
&& cd /root \
&& litecore-node create litecore-node \
\
&& cd /root/litecore-node \
&& litecore-node install insight-lite-api \
\
# apply changes to litecore-node.json via 'jq` tool
&& jq '.servicesConfig.bitcoind.spawn.exec = "/usr/local/bin/litecoind"' < litecore-node.json \
| jq '.servicesConfig += {"insight-lite-api":{"disableRateLimiter":true}}' > /tmp/modified.json \
&& mv /tmp/modified.json litecore-node.json \
\
&& ln -snf /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
&& echo 'Europe/Berlin' > /etc/timezone \
\
# move everything to /litecore-node
&& mv /root/litecore-node /litecore-node \
&& chown -R node:node /litecore-node \
\
# remove not needed files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDepends \
&& rm -rf \
/var/lib/apt/lists/* \
/root/.npm \
/root/.node-gyp \
\
/usr/local/lib/node_modules/litecore-node/bin/litecoin* \
/usr/local/bin/litecoind \
/litecore-node/node_modules/litecore-node/bin/litecoin* \
/litecore-node/node_modules/.bin/litecoind \
\
/litecore-node/node_modules/*/test \
/litecore-node/node_modules/zeromq/windows \
/litecore-node/node_modules/litecore-node/*/test \
/litecore-node/node_modules/litecore-node/*/benchmarks \
\
/usr/local/lib/node_modules/litecore-node/test \
/usr/local/lib/node_modules/litecore-node/benchmarks \
/usr/local/lib/node_modules/litecore-node/node_modules/*/test \
/usr/local/lib/node_modules/litecore-node/node_modules/zeromq/windows
ENV LITECOIN_OS x86_64-linux-gnu
ENV LITECOIN_VERSION 0.17.1
ENV LITECOIN_FILENAME litecoin-${LITECOIN_VERSION}-${LITECOIN_OS}.tar.gz
ENV LITECOIN_SHA256 9cab11ba75ea4fb64474d4fea5c5b6851f9a25fe9b1d4f7fc9c12b9f190fed07
RUN curl -fSL "https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/${LITECOIN_FILENAME}" -o /tmp/litecoin.tar.gz \
&& echo "$LITECOIN_SHA256 /tmp/litecoin.tar.gz" | sha256sum -c - \
&& tar -C /usr/local --strip-components=1 -xzf /tmp/litecoin.tar.gz \
&& ldconfig \
&& rm /tmp/litecoin.tar.gz /usr/local/bin/litecoin-qt /usr/local/bin/test_litecoin
USER node
WORKDIR /litecore-node
EXPOSE 3001
ENV NODE_ENV production
CMD litecore-node startbitcoin.conf
server=1
whitelist=127.0.0.1
txindex=1
addressindex=1
timestampindex=1
spentindex=1
zmqpubrawtx=tcp://127.0.0.1:29332
zmqpubhashblock=tcp://127.0.0.1:29332
rpcallowip=127.0.0.1
rpcuser=bitcoin
rpcpassword=local321
disablewallet=1