lbry-docker/chainquery/stuff/start.sh

52 lines
2.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
## Config setup
Chainquery works mostly and so does lbrycrd Merge branch 'master' of github.com:lbryio/lbry-docker Starting on a .travis.yml but may be unnecessary Renamed www.spee.ch and lbrynet-daemon to reflect their upstream repos. Disabled Adminer Started debug for chainquery container. Get latest release tagged url from github API remove zip.zip maybe? debugging curl explicit unzip Adding -o for unzip simplified, removed debug and fixed curl reverted to original unzip function Pull chainquery from prep container passing alternative config path Aligned config path location with linux spec updated config location maybe don't be as explicit adding debug for chainqueryconfig.toml Fixes magicless chainquery and starts on bootstrap added chainquery/.gitignore to ignore large blobs. fixed Dockerfile up to use staged prep and production removed db-seed.sh as we have quick-bootstrap.sh start.sh needed modification to pull config from the right location in the linux FS Added chainquery/.dockerignore to prevent extremely long build times in the future Removed fancy bash vars in chainquery/.env Started work on getting quick-bootstrap.sh ready for release. Switch to lbrynet network Switched network name to lbrynet Merge branch 'leopere' of github.com:lbryio/lbry-docker into leopere Remove debugging access port bind Expose chainquery to the internet Merge branch 'leopere' of github.com:lbryio/lbry-docker into leopere Removed now unnecessary run command Undo Cleanup and commenting on environment variables Start getting ready for adding chainquery start.sh magic Quick update
2018-11-05 04:42:35 +01:00
## Setup Values
DEBUGMODE=$(echo "debugmode=$DEBUGMODE")
2018-11-12 04:20:38 +01:00
LBRYCRDURL=$(echo "lbrycrdurl=\"rpc://$RPC_USER:$RPC_PASSWORD@10.5.1.2:9245\"")
MYSQLDSN=$(echo "mysqldsn=\"$MYSQL_USER:$MYSQL_PASSWORD@tcp($MYSQL_SERVER:3306)/$MYSQL_DATABASE\"")
APIMYSQLDSN=$(echo "apimysqldsn=\"$MYSQL_USER:$MYSQL_PASSWORD@tcp($MYSQL_SERVER:3306)/$MYSQL_DATABASE\"")
## Setup Defaults
DEBUGMODE_DEFAULT='#DEFAULT-debugmode=false'
LBRYCRDURL_DEFAULT='#DEFAULT-lbrycrdurl="rpc://lbry:lbry@localhost:9245"'
MYSQLDSN_DEFAULT='#DEFAULT-mysqldsn="lbry:lbry@tcp(localhost:3306)/chainquery"'
2018-11-12 04:40:27 +01:00
APIMYSQLDSN_DEFAULT='#DEFAULT-apimysqldsn="lbry:lbry@tcp(localhost:3306)/chainquery"'
## Add setup value variable name to this list to get processed on container start
CONFIG_SETTINGS=(
2018-11-12 04:40:27 +01:00
DEBUGMODE
LBRYCRDURL
2018-11-12 04:40:27 +01:00
MYSQLDSN
APIMYSQLDSN
)
2018-11-12 03:20:04 +01:00
function set_configs() {
## Set configs on container start if not already set.
for i in "${!CONFIG_SETTINGS[@]}"; do
## Indirect references http://tldp.org/LDP/abs/html/ivr.html
eval FROM_STRING=\$"${CONFIG_SETTINGS[$i]}_DEFAULT"
eval TO_STRING=\$${CONFIG_SETTINGS[$i]}
## TODO: Add a bit more magic to make sure that you're only configuring things if not set by config mounts.
sed -i "s~$FROM_STRING~"$TO_STRING"~g" /etc/lbry/chainqueryconfig.toml
done
echo "Reading config for debugging."
cat /etc/lbry/chainqueryconfig.toml
}
if [[ ! -f /etc/lbry/chainqueryconfig.toml ]]; then
echo "[INFO]: Did not find chainqueryconfig.toml"
echo " Installing default and configuring with provided environment variables if any."
2018-11-12 03:20:04 +01:00
## Install fresh copy of config file.
echo "cp -v /etc/lbry/chainqueryconfig.toml.orig /etc/lbry/chainqueryconfig.toml"
cp -v /etc/lbry/chainqueryconfig.toml.orig /etc/lbry/chainqueryconfig.toml
ls -lAh /etc/lbry/
set_configs
else
echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/lbry"
fi
Chainquery works mostly and so does lbrycrd Merge branch 'master' of github.com:lbryio/lbry-docker Starting on a .travis.yml but may be unnecessary Renamed www.spee.ch and lbrynet-daemon to reflect their upstream repos. Disabled Adminer Started debug for chainquery container. Get latest release tagged url from github API remove zip.zip maybe? debugging curl explicit unzip Adding -o for unzip simplified, removed debug and fixed curl reverted to original unzip function Pull chainquery from prep container passing alternative config path Aligned config path location with linux spec updated config location maybe don't be as explicit adding debug for chainqueryconfig.toml Fixes magicless chainquery and starts on bootstrap added chainquery/.gitignore to ignore large blobs. fixed Dockerfile up to use staged prep and production removed db-seed.sh as we have quick-bootstrap.sh start.sh needed modification to pull config from the right location in the linux FS Added chainquery/.dockerignore to prevent extremely long build times in the future Removed fancy bash vars in chainquery/.env Started work on getting quick-bootstrap.sh ready for release. Switch to lbrynet network Switched network name to lbrynet Merge branch 'leopere' of github.com:lbryio/lbry-docker into leopere Remove debugging access port bind Expose chainquery to the internet Merge branch 'leopere' of github.com:lbryio/lbry-docker into leopere Removed now unnecessary run command Undo Cleanup and commenting on environment variables Start getting ready for adding chainquery start.sh magic Quick update
2018-11-05 04:42:35 +01:00
## 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
chainquery serve --configpath "/etc/lbry/"