From 4ef799030dfe60ab91ca51d8b19c5d9358cd4cbb Mon Sep 17 00:00:00 2001 From: Leopere Date: Wed, 10 Oct 2018 21:18:06 -0400 Subject: [PATCH] Adding control mechanism to launch in different run mode. --- lbrycrd/docker-compose.yml | 2 ++ lbrycrd/start.sh | 32 +++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/lbrycrd/docker-compose.yml b/lbrycrd/docker-compose.yml index d1c2ec3..097d8d4 100644 --- a/lbrycrd/docker-compose.yml +++ b/lbrycrd/docker-compose.yml @@ -17,6 +17,8 @@ services: labels: - "traefik.expose=false" user: "${UID:-1000}:${GID:-1000}" + environment: + RUN_MODE: chainquery expose: - 9245 - 9246 diff --git a/lbrycrd/start.sh b/lbrycrd/start.sh index 66a72f7..b33d1d0 100755 --- a/lbrycrd/start.sh +++ b/lbrycrd/start.sh @@ -20,13 +20,31 @@ echo -e "rpcuser=lbryrpc\nrpcpassword=${RPC_PASSWORD:-changeme}" > ~/.lbrycrd/lb echo -e "rpcallowip=${RPC_ALLOW_IP:-10.5.1.3}" >> ~/.lbrycrd/lbrycrd.conf echo -e "rpcuser=${RPC_USER:-lbryrpc}" >> ~/.lbrycrd/lbrycrd.conf -## For now keeping this simple. Potentially eventually add all command args as envvars for the Dockerfile or use safe way to add args via docker-compose.yml -lbrycrdd \ - -server \ - -txindex \ - -reindex \ - -conf=$HOME/.lbrycrd/lbrycrd.conf \ - -printtoconsole +## Control this invocation through envvar. +case ${$RUN_MODE:-default} in + default ) + lbrycrdd \ + -server \ + -conf=$HOME/.lbrycrd/lbrycrd.conf \ + -printtoconsole + ;; + reindex ) + lbrycrdd \ + -server \ + -txindex \ + -reindex \ + -conf=$HOME/.lbrycrd/lbrycrd.conf \ + -printtoconsole + ;; + chainquery ) + lbrycrdd \ + -server \ + -txindex \ + -conf=$HOME/.lbrycrd/lbrycrd.conf \ + -printtoconsole + ;; +esac + ## We were unsure if these function as intended so they were disabled for the time being. # -port=${PORT:-9246} \