diff --git a/.gitignore b/.gitignore index 310a24c..14c2793 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .project - +.idea diff --git a/1/bitcoin.conf b/1/bitcoin.conf index efa6337..4e0de2f 100644 --- a/1/bitcoin.conf +++ b/1/bitcoin.conf @@ -3,6 +3,8 @@ regtest=1 dnsseed=0 upnp=0 +txindex=1 + # listen on different ports than default testnet port=19000 rpcport=19001 diff --git a/2/bitcoin.conf b/2/bitcoin.conf index 8ced156..3a36512 100644 --- a/2/bitcoin.conf +++ b/2/bitcoin.conf @@ -3,6 +3,8 @@ regtest=1 dnsseed=0 upnp=0 +txindex=1 + # don't listen on a port, just connect to node 1 listen=0 connect=127.0.0.1:19000 diff --git a/Dockerfile b/Dockerfile index 17ed803..454f68e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,12 @@ MAINTAINER Sean Lavine # add bitcoind from the official PPA RUN apt-get update -RUN apt-get install --yes software-properties-common +RUN apt-get install --yes software-properties-common supervisor RUN add-apt-repository --yes ppa:bitcoin/bitcoin RUN apt-get update -# install bitcoind (from PPA) and make -RUN apt-get install --yes bitcoind make +# install bitcoind (from PPA) +RUN apt-get install --yes bitcoind # create a non-root user RUN adduser --disabled-login --gecos "" tester @@ -25,12 +25,9 @@ ADD . /home/tester/bitcoin-testnet-box # make tester user own the bitcoin-testnet-box RUN chown -R tester:tester /home/tester/bitcoin-testnet-box -# use the tester user when running the image -USER tester +RUN mkdir -p /var/log/supervisor # run commands from inside the testnet-box directory WORKDIR /home/tester/bitcoin-testnet-box -# expose two rpc ports for the nodes to allow outside container access -EXPOSE 19001 19011 -CMD ["/bin/bash"] +CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/README.md b/README.md index 15326db..3cfb7bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # bitcoin-testnet-box -[![docker pulls](https://img.shields.io/docker/pulls/freewil/bitcoin-testnet-box.svg?style=flat)](https://hub.docker.com/r/freewil/bitcoin-testnet-box/) +[![docker pulls](https://img.shields.io/docker/pulls/freewil/bitcoin-testnet-box.svg?style=flat)](https://hub.docker.com/r/softwaremill/bitcoin-testbox/) + +Based on https://github.com/freewil/bitcoin-testnet-box Create your own private bitcoin testnet @@ -139,10 +141,13 @@ an isolated container. ### Building docker image Pull the image - * `docker pull freewil/bitcoin-testnet-box` + * `docker pull softwaremill/bitcoin-testnet-box` or build it yourself from this directory - * `docker build -t bitcoin-testnet-box .` + * `docker build -t softwaremill/bitcoin-testbox .` + +You can also push it to the docker hub: + `docker push softwaremill/bitcoin-testbox` ### Running docker container The docker image will run two bitcoin nodes in the background and is meant to be @@ -150,9 +155,6 @@ attached to allow you to type in commands. The image also exposes the two JSON-RPC ports from the nodes if you want to be able to access them from outside the container. - `$ docker run -t -i -p 19001:19001 -p 19011:19011 freewil/bitcoin-testnet-box` - -or if you built the docker image yourself: + `$ docker run -t -p 19001:19001 -p 19011:19011 softwaremill/bitcoin-testbox` - `$ docker run -t -i -p 19001:19001 -p 19011:19011 bitcoin-testnet-box` diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..7ca668e --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,30 @@ +[supervisord] +nodaemon = true + +[program:node1] +user = tester +command = bitcoind -datadir=1 +; start nodes before bitcoin-cli +priority = 100 +stdout_logfile = /var/log/node1.log +stderr_logfile = /var/log/node1err.log +autorestart = true + + +[program:node2] +user = tester +command = bitcoind -datadir=2 +; start nodes before bitcoin-cli +priority = 100 +stdout_logfile = /var/log/node2.log +stderr_logfile = /var/log/node2err.log +autorestart = true + + +; generate some blocks, to have some bitcoins to test transfers etc. + +[program:generate-bitcoins] +user = tester +command = bitcoin-cli -datadir=1 generate 500 +startsecs = 0 +autorestart = unexpected