Skip to content

Commit

Permalink
add a docker for litecoin v0.16.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
YihaoPeng committed Nov 30, 2018
1 parent 3fa000b commit ece4ee7
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docker/litecoind/v0.16.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Dockerfile
#
# @author zhibiao.pan@bitmain.com, yihao.peng@bitmain.com
# @copyright btc.com
# @since 2016-08-01
#
#
FROM phusion/baseimage:0.10.2
MAINTAINER YihaoPeng <yihao.peng@bitmain.com>

ENV HOME /root
ENV TERM xterm
CMD ["/sbin/my_init"]

# use aliyun source
ADD sources-aliyun.com.list /etc/apt/sources.list

RUN apt-get update
RUN apt-get install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3
RUN apt-get install -y libboost-all-dev libzmq3-dev curl wget net-tools

# build litecoind
RUN mkdir ~/source
RUN cd ~/source && wget https://github.com/litecoin-project/litecoin/archive/v0.16.3.tar.gz
RUN cd ~/source \
&& tar zxf v0.16.3.tar.gz && cd litecoin-0.16.3 \
&& ./autogen.sh \
&& ./configure --disable-wallet --disable-tests \
&& make -j4 && make install

# mkdir litecoind data dir
RUN mkdir -p /root/.litecoin
RUN mkdir -p /root/scripts

# logrotate
ADD logrotate-litecoind /etc/logrotate.d/litecoind

#
# services
#
# service for mainnet
RUN mkdir /etc/service/litecoind
ADD run /etc/service/litecoind/run
RUN chmod +x /etc/service/litecoind/run
69 changes: 69 additions & 0 deletions docker/litecoind/v0.16.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Docker for Litecoind v0.16.3
============================

* Docker Image OS: `Ubuntu 16.04 LTS`
* litecoind: `v0.16.3`

## Install Docker

```
# Use 'curl -sSL https://get.daocloud.io/docker | sh' instead of this line
# when your server is in China.
wget -qO- https://get.docker.com/ | sh
service docker start
service docker status
```

## Build Docker Images

```
cd /work
git clone https://github.com/btccom/btcpool.git
cd btcpool/docker/litecoind/v0.16.3
# If your server is in China, please check "Dockerfile" and uncomment some lines.
# If you want to enable testnet3, please uncomment several lines behind `# service for testnet3`
# build
docker build -t litecoind:0.16.3 .
# docker build --no-cache -t litecoind:0.16.3 .
# mkdir for litecoind
mkdir -p /work/litecoind
# litecoin.conf
touch /work/litecoind/litecoin.conf
```

### litecoin.conf example

```
rpcuser=litecoinrpc
# generate random rpc password:
# $ strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo
rpcpassword=xxxxxxxxxxxxxxxxxxxxxxxxxx
rpcthreads=4
rpcallowip=172.16.0.0/12
rpcallowip=192.168.0.0/16
rpcallowip=10.0.0.0/8
# use 1G memory for utxo, depends on your machine's memory
dbcache=1000
# set maximum BIP141 block weight
blockmaxweight=4000000
```

## Start Docker Container

```
# start docker
docker run -it -v /work/litecoind:/root/.litecoin --name litecoind -p 9331-9333:9331-9333 --restart always -d litecoind:0.16.3
# login
docker exec -it litecoind /bin/bash
litecoin-cli getblockchaininfo
```
6 changes: 6 additions & 0 deletions docker/litecoind/v0.16.3/logrotate-litecoind
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/root/.litecoin/debug.log /root/.litecoin/testnet3/debug.log {
daily
rotate 3
missingok
copytruncate
}
13 changes: 13 additions & 0 deletions docker/litecoind/v0.16.3/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/bash
#
# run shell for litecoind
#
# @copyright btc.com
# @author zhibiao.pan@bitmain.com
#
export LC_ALL=C
SROOT=$(cd $(dirname "$0"); pwd)
cd $SROOT

OPT_ZMQ="-zmqpubrawblock=tcp://0.0.0.0:9331 -zmqpubrawtx=tcp://0.0.0.0:9331 -zmqpubhashtx=tcp://0.0.0.0:9331 -zmqpubhashblock=tcp://0.0.0.0:9331"
litecoind -conf="/root/.litecoin/litecoin.conf" -datadir="/root/.litecoin" $OPT_ZMQ
10 changes: 10 additions & 0 deletions docker/litecoind/v0.16.3/sources-aliyun.com.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

0 comments on commit ece4ee7

Please sign in to comment.