2018-10-14 14:30:06 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-10-11 02:28:43 +02:00
|
|
|
|
2018-11-07 00:36:04 +01:00
|
|
|
# ## ToDo: Get a test case to see if this is the first run or a repeat run.
|
2018-10-06 20:54:41 +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 specific to chainquery.
|
2018-10-06 18:56:35 +02:00
|
|
|
|
2018-10-06 20:54:41 +02:00
|
|
|
## Ensure perms are correct prior to running main binary
|
2018-11-09 07:30:21 +01:00
|
|
|
mkdir -p /data/.lbrycrd
|
|
|
|
chown -R lbrycrd:lbrycrd /data
|
|
|
|
chmod -R 755 /data/
|
2018-11-07 00:32:25 +01:00
|
|
|
|
|
|
|
## TODO: Consider a config directory for future magic.
|
|
|
|
# chown -R 1000:1000 /etc/lbrycrd
|
|
|
|
# chmod -R 755 /etc/lbrycrd
|
2018-11-07 00:29:26 +01:00
|
|
|
rm -f /var/run/lbrycrd.pid
|
2018-11-09 07:30:21 +01:00
|
|
|
|
2018-10-06 20:54:41 +02:00
|
|
|
|
|
|
|
## Set config params
|
2018-11-07 00:32:25 +01:00
|
|
|
## TODO: Make this more automagic in the future.
|
2018-11-09 07:30:21 +01:00
|
|
|
echo "rpcuser=lbryrpc\nrpcpassword=${RPC_PASSWORD:-changeme}" > /data/.lbrycrd/lbrycrd.conf
|
2018-11-29 20:07:39 +01:00
|
|
|
echo "rpcallowip=${RPC_ALLOW_IP:-10.6.1.3}" >> /data/.lbrycrd/lbrycrd.conf
|
2018-11-09 07:30:21 +01:00
|
|
|
echo "rpcuser=${RPC_USER:-lbryrpc}" >> /data/.lbrycrd/lbrycrd.conf
|
2018-10-06 20:54:41 +02:00
|
|
|
|
2018-10-11 03:18:06 +02:00
|
|
|
## Control this invocation through envvar.
|
2018-10-11 03:20:00 +02:00
|
|
|
case ${RUN_MODE:-default} in
|
2018-10-11 03:18:06 +02:00
|
|
|
default )
|
2018-11-09 07:30:21 +01:00
|
|
|
su -c "lbrycrdd -server -conf=/data/.lbrycrd/ -printtoconsole" lbrycrd
|
2018-10-11 03:18:06 +02:00
|
|
|
;;
|
|
|
|
reindex )
|
2018-11-09 07:30:21 +01:00
|
|
|
su -c "lbrycrdd -server -txindex -reindex -conf=/data/.lbrycrd/ -printtoconsole" lbrycrd
|
2018-10-11 03:18:06 +02:00
|
|
|
;;
|
|
|
|
chainquery )
|
2018-11-09 07:30:21 +01:00
|
|
|
su -c "lbrycrdd -server -txindex -conf=/data/.lbrycrd/ -printtoconsole" lbrycrd
|
2018-10-11 03:18:06 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2018-11-07 00:32:25 +01:00
|
|
|
## TODO: Look into what we can do with these launch params
|
2018-10-06 20:54:41 +02:00
|
|
|
## We were unsure if these function as intended so they were disabled for the time being.
|
|
|
|
# -port=${PORT:-9246} \
|
|
|
|
# -data=${DATA_DIR:-/data/} \
|
|
|
|
# -pid=${PID_FILE:/var/run/lbrycrdd.pid} \
|
|
|
|
# -rpcport=${RPC_PORT:-9245} \
|
|
|
|
# -rpcpassword=${RPC_PASSWORD:-changeme} \
|
|
|
|
# -rpcuser=${RPC_USER:-lbryrpc} \
|
2018-11-29 20:07:39 +01:00
|
|
|
# -rpcallowip=${RPC_ALLOW_IP:-10.6.1.3}
|