Adding RUN_MODEs regtest and testnet

This commit is contained in:
Leopere 2019-04-23 23:37:56 -04:00
parent c68d0d5e6d
commit d53d871408

View file

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function set_config() {
CONFIG_PATH=/etc/lbry/lbrycrd.conf CONFIG_PATH=/etc/lbry/lbrycrd.conf
if [ -f "$CONFIG_PATH" ] if [ -f "$CONFIG_PATH" ]
then then
@ -15,6 +16,8 @@ else
echo "rpcbind=0.0.0.0" >> $CONFIG_PATH echo "rpcbind=0.0.0.0" >> $CONFIG_PATH
#echo "bind=0.0.0.0" >> $CONFIG_PATH #echo "bind=0.0.0.0" >> $CONFIG_PATH
fi fi
}
## Ensure perms are correct prior to running main binary ## Ensure perms are correct prior to running main binary
/usr/bin/fix-permissions /usr/bin/fix-permissions
@ -22,6 +25,7 @@ fi
## You can optionally specify a run mode if you want to use lbry defined presets for compatibility. ## You can optionally specify a run mode if you want to use lbry defined presets for compatibility.
case $RUN_MODE in case $RUN_MODE in
default ) default )
set_config
lbrycrdd -server -conf=$CONFIG_PATH -printtoconsole lbrycrdd -server -conf=$CONFIG_PATH -printtoconsole
;; ;;
## If it's a first run you need to do a full index including all transactions ## If it's a first run you need to do a full index including all transactions
@ -30,11 +34,45 @@ case $RUN_MODE in
## This is generally specific to chainquery. ## This is generally specific to chainquery.
reindex ) 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. ## 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 lbrycrdd -server -txindex -reindex -conf=$CONFIG_PATH -printtoconsole
;; ;;
chainquery ) chainquery )
## If your only goal is to run Chainquery against this instance of lbrycrd and you're starting a ## 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. ## fresh local dataset use this run mode.
set_config
lbrycrdd -server -txindex -conf=$CONFIG_PATH -printtoconsole lbrycrdd -server -txindex -conf=$CONFIG_PATH -printtoconsole
;; ;;
regtest )
## Set config params
## TODO: Make this more automagic in the future.
echo "rpcuser=lbry" > /data/.lbrycrd/lbrycrd.conf
echo "rpcpassword=lbry" >> /data/.lbrycrd/lbrycrd.conf
echo "rpcport=11337" >> /data/.lbrycrd/lbrycrd.conf
echo "rpcbind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf
echo "rpcallowip=0.0.0.0/0" >> /data/.lbrycrd/lbrycrd.conf
echo "regtest=1" >> /data/.lbrycrd/lbrycrd.conf
echo "txindex=1" >> /data/.lbrycrd/lbrycrd.conf
echo "server=1" >> /data/.lbrycrd/lbrycrd.conf
echo "printtoconsole=1" >> /data/.lbrycrd/lbrycrd.conf
#nohup advance &>/dev/null &
su -c "lbrycrdd -conf=/data/.lbrycrd/lbrycrd.conf" lbrycrd
;;
testnet )
## Set config params
## TODO: Make this more automagic in the future.
echo "rpcuser=lbry" > /data/.lbrycrd/lbrycrd.conf
echo "rpcpassword=lbry" >> /data/.lbrycrd/lbrycrd.conf
echo "rpcport=11337" >> /data/.lbrycrd/lbrycrd.conf
echo "rpcbind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf
echo "rpcallowip=0.0.0.0/0" >> /data/.lbrycrd/lbrycrd.conf
echo "testnet=1" >> /data/.lbrycrd/lbrycrd.conf
echo "txindex=1" >> /data/.lbrycrd/lbrycrd.conf
echo "server=1" >> /data/.lbrycrd/lbrycrd.conf
echo "printtoconsole=1" >> /data/.lbrycrd/lbrycrd.conf
#nohup advance &>/dev/null &
su -c "lbrycrdd -conf=/data/.lbrycrd/lbrycrd.conf" lbrycrd
;;
esac esac