From 5f402ebc7ae07938cdaf07e56d8140e9b0073a72 Mon Sep 17 00:00:00 2001 From: Dan Garthwaite Date: Wed, 9 Oct 2019 20:48:46 -0400 Subject: [PATCH] Changes to allow RUN_MODE=regtest to stuff/auto_advance.sh --- lbrycrd/Dockerfile-linux-x86_64-production | 2 +- lbrycrd/compose/docker-compose.yml-regtest | 13 ++++++++++++- lbrycrd/stuff/advance_blocks.sh | 5 ++--- lbrycrd/stuff/start.sh | 13 +++++++------ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/lbrycrd/Dockerfile-linux-x86_64-production b/lbrycrd/Dockerfile-linux-x86_64-production index 25721e9..639acbc 100644 --- a/lbrycrd/Dockerfile-linux-x86_64-production +++ b/lbrycrd/Dockerfile-linux-x86_64-production @@ -11,7 +11,7 @@ COPY ./stuff/start.sh start COPY ./stuff/healthcheck.sh healthcheck COPY ./stuff/advance_blocks.sh advance COPY ./stuff/fix-permissions.c fix-permissions.c -RUN curl -L -o ./lbrycrd-linux.zip $(curl -s https://api.github.com/repos/lbryio/lbrycrd/releases | grep -F 'lbrycrd-linux.zip' | grep download | head -n 1 | cut -d'"' -f4) && \ +RUN curl --progress-bar -L -o ./lbrycrd-linux.zip $(curl -s https://api.github.com/repos/lbryio/lbrycrd/releases | grep -F 'lbrycrd-linux.zip' | grep download | head -n 1 | cut -d'"' -f4) && \ unzip ./lbrycrd-linux.zip && \ gcc fix-permissions.c -o fix-permissions && \ chmod +x ./lbrycrdd ./lbrycrd-cli ./lbrycrd-tx ./start ./healthcheck ./fix-permissions ./advance diff --git a/lbrycrd/compose/docker-compose.yml-regtest b/lbrycrd/compose/docker-compose.yml-regtest index 49ea759..5868e32 100644 --- a/lbrycrd/compose/docker-compose.yml-regtest +++ b/lbrycrd/compose/docker-compose.yml-regtest @@ -1,11 +1,17 @@ version: '3.4' +networks: + lbry-network: + external: true + services: ############# ## Lbrycrd ## ############# lbrycrd: - image: lbry/lbrycrd:linux-x86_64-production + build: + context: . + dockerfile: Dockerfile-linux-x86_64-production restart: always ports: - "11336:29246" @@ -13,5 +19,10 @@ services: ## host volumes for persistent data such as wallet private keys. volumes: - "../persist/data:/data" + networks: + lbry-network: + ipv4_address: 10.6.1.2 environment: - RUN_MODE=regtest + - PORT=29245 + - AUTO_ADVANCE=1 diff --git a/lbrycrd/stuff/advance_blocks.sh b/lbrycrd/stuff/advance_blocks.sh index f29b28b..ebbe993 100755 --- a/lbrycrd/stuff/advance_blocks.sh +++ b/lbrycrd/stuff/advance_blocks.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -while true; do - lbrycrd-cli -conf=/data/.lbrycrd/lbrycrd.conf generate 1 >> /tmp/output.log - sleep 2 +while sleep 2; do + lbrycrd-cli -conf=/etc/lbry/lbrycrd.conf generate 1 done diff --git a/lbrycrd/stuff/start.sh b/lbrycrd/stuff/start.sh index 8c29bf1..d14e57c 100755 --- a/lbrycrd/stuff/start.sh +++ b/lbrycrd/stuff/start.sh @@ -56,7 +56,7 @@ function set_config() { case $RUN_MODE in default ) set_config - lbrycrdd -server -conf=$CONFIG_PATH -printtoconsole + exec lbrycrdd -server -conf=$CONFIG_PATH -printtoconsole ;; ## If it's a first run you need to do a full index including all transactions ## tx index creates an index of every single transaction in the block history if @@ -65,13 +65,13 @@ case $RUN_MODE in reindex ) ## Apply this RUN_MODE in the case you need to update a dataset. NOTE: you do not need to use `RUN_MODE reindex` for more than one complete run. set_config - lbrycrdd -server -txindex -reindex -conf=$CONFIG_PATH -printtoconsole + exec lbrycrdd -server -txindex -reindex -conf=$CONFIG_PATH -printtoconsole ;; chainquery ) ## If your only goal is to run Chainquery against this instance of lbrycrd and you're starting a ## fresh local dataset use this run mode. set_config - lbrycrdd -server -txindex -conf=$CONFIG_PATH -printtoconsole + exec lbrycrdd -server -txindex -conf=$CONFIG_PATH -printtoconsole ;; regtest ) ## Set config params @@ -87,8 +87,9 @@ case $RUN_MODE in echo "server=1" >> $CONFIG_PATH echo "printtoconsole=1" >> $CONFIG_PATH - #nohup advance &>/dev/null & - lbrycrdd -conf=$CONFIG_PATH $1 + [ "${AUTO_ADVANCE:-0}" == "1" ] && nohup advance &>/dev/null & + + exec lbrycrdd -conf=$CONFIG_PATH $1 ;; testnet ) ## Set config params @@ -105,7 +106,7 @@ case $RUN_MODE in echo "printtoconsole=1" >> $CONFIG_PATH #nohup advance &>/dev/null & - lbrycrdd -conf=$CONFIG_PATH $1 + exec lbrycrdd -conf=$CONFIG_PATH $1 ;; * ) echo "Error, you must define a RUN_MODE environment variable."