2018-10-14 14:30:06 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-10-11 02:28:43 +02:00
|
|
|
|
2019-04-17 01:00:39 +02:00
|
|
|
CONFIG_PATH=/etc/lbry/lbrycrd.conf
|
|
|
|
if [ -f "$CONFIG_PATH" ]
|
|
|
|
then
|
|
|
|
echo "Using the config file that was mounted into the container."
|
|
|
|
else
|
|
|
|
echo "Creating a fresh config file from environment variables."
|
|
|
|
## Set config params
|
|
|
|
mkdir -p `dirname $CONFIG_PATH`
|
|
|
|
echo "rpcuser=$RPC_USER" > $CONFIG_PATH
|
|
|
|
echo "rpcpassword=$RPC_PASSWORD" >> $CONFIG_PATH
|
|
|
|
echo "rpcallowip=$RPC_ALLOW_IP" >> $CONFIG_PATH
|
|
|
|
echo "rpcport=9245" >> $CONFIG_PATH
|
|
|
|
echo "rpcbind=0.0.0.0" >> $CONFIG_PATH
|
|
|
|
#echo "bind=0.0.0.0" >> $CONFIG_PATH
|
|
|
|
fi
|
2018-11-09 07:30:21 +01:00
|
|
|
|
2019-04-17 01:00:39 +02:00
|
|
|
## Ensure perms are correct prior to running main binary
|
|
|
|
/usr/bin/fix-permissions
|
2018-10-06 20:54:41 +02:00
|
|
|
|
2019-04-17 16:38:56 +02:00
|
|
|
## You can optionally specify a run mode if you want to use lbry defined presets for compatibility.
|
2018-11-13 02:27:11 +01:00
|
|
|
case $RUN_MODE in
|
2018-10-11 03:18:06 +02:00
|
|
|
default )
|
2019-04-17 01:00:39 +02:00
|
|
|
lbrycrdd -server -conf=$CONFIG_PATH -printtoconsole
|
2018-10-11 03:18:06 +02:00
|
|
|
;;
|
2019-04-17 16:38:56 +02:00
|
|
|
## 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
|
|
|
|
## not specified it will only create an index for transactions that are related to the wallet or have unspent outputs.
|
|
|
|
## This is generally specific to chainquery.
|
2018-10-11 03:18:06 +02:00
|
|
|
reindex )
|
2019-04-17 16:38:56 +02:00
|
|
|
## 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.
|
2019-04-17 01:00:39 +02:00
|
|
|
lbrycrdd -server -txindex -reindex -conf=$CONFIG_PATH -printtoconsole
|
2018-10-11 03:18:06 +02:00
|
|
|
;;
|
|
|
|
chainquery )
|
2019-04-17 16:38:56 +02:00
|
|
|
## 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.
|
2019-04-17 01:00:39 +02:00
|
|
|
lbrycrdd -server -txindex -conf=$CONFIG_PATH -printtoconsole
|
2018-10-11 03:18:06 +02:00
|
|
|
;;
|
|
|
|
esac
|