diff --git a/install/.dockerignore b/install/.dockerignore new file mode 100644 index 0000000..3e95f18 --- /dev/null +++ b/install/.dockerignore @@ -0,0 +1,3 @@ +SatoshiPortal +data +script diff --git a/install/Dockerfile b/install/Dockerfile new file mode 100644 index 0000000..8f5c30b --- /dev/null +++ b/install/Dockerfile @@ -0,0 +1,13 @@ +FROM alpine + +RUN apk add --update --no-cache \ + curl \ + dialog + +RUN mkdir /volume /script /data + +WORKDIR /script + +ENV TRACING=1 + +CMD ["./configure.sh"] diff --git a/install/bitcoind/script/configure.sh b/install/bitcoind/script/configure.sh new file mode 100755 index 0000000..c2f9930 --- /dev/null +++ b/install/bitcoind/script/configure.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# TODO: config entry for persistent volume of bitcoind + +dialog --colors --textbox trace.sh 40 80 + + diff --git a/install/bitcoind/script/trace.sh b/install/bitcoind/script/trace.sh new file mode 100644 index 0000000..34a18df --- /dev/null +++ b/install/bitcoind/script/trace.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +trace() +{ + if [ -n "${TRACING}" ]; then + echo "[$(date +%Y-%m-%dT%H:%M:%S%z)] ${1}" > /dev/stderr + fi +} + +trace_rc() +{ + if [ -n "${TRACING}" ]; then + echo "[$(date +%Y-%m-%dT%H:%M:%S%z)] Last return code: ${1}" > /dev/stderr + fi +} diff --git a/install/bitcoind/templates/bitcoin.conf b/install/bitcoind/templates/bitcoin.conf new file mode 100644 index 0000000..ca7e8ec --- /dev/null +++ b/install/bitcoind/templates/bitcoin.conf @@ -0,0 +1,11 @@ +# testnet +testnet=1 + +#lnd opts +txindex=1 +zmqpubrawblock=tcp://0.0.0.0:18501 +zmqpubrawtx=tcp://0.0.0.0:18502 + +# general opts +rpcuser=%RPCUSER% +rpcpassword=%RPCPASSWORD% diff --git a/install/script/cyphernodeconf.sh b/install/script/cyphernodeconf.sh new file mode 100755 index 0000000..99dad8b --- /dev/null +++ b/install/script/cyphernodeconf.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +. ./trace.sh + +# this will run configure.sh of the specified package inside a +# cyphernodeconf container. This way we ensure we have the right +# environment and do not pollute the host machine with utility +# commands not needed for runtime + +cyphernodeconf_configure() { + PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + DATA_PATH=$PWD/../data + SCRIPT_PATH=$PWD/../$1/script + VOLUME_PATH=/tmp + docker run -v $VOLUME_PATH:/volume \ + -v $DATA_PATH:/data \ + -v $SCRIPT_PATH:/script\ + --log-driver=none\ + --rm -it cyphernodeconf:latest +} \ No newline at end of file diff --git a/install/script/install.sh b/install/script/install.sh index a186b92..b7f86fe 100755 --- a/install/script/install.sh +++ b/install/script/install.sh @@ -2,6 +2,7 @@ . ./trace.sh . ./docker.sh +. ./cyphernodeconf.sh trace "Updating SatoshiPortal dockers" git submodule update --recursive --remote @@ -15,3 +16,9 @@ build_docker_image ../SatoshiPortal/dockers/$arch/LN/c-lightning clnimg build_docker_image ../../cron_docker/ proxycronimg build_docker_image ../../proxy_docker/ btcproxyimg build_docker_image ../../pycoin_docker/ pycoinimg + +# build setup docker image +build_docker_image ../ cyphernodeconf + +# configure bitcoind +cyphernodeconf_configure bitcoind \ No newline at end of file