From 8c92b2c3aff99c9271610e1aad44cd36231c8212 Mon Sep 17 00:00:00 2001 From: Leopere Date: Sat, 6 Oct 2018 14:54:41 -0400 Subject: [PATCH 1/4] This is far from complete but is functional Chainquery depends on a fully indexed blockchain comments expand on this. Reindexing should only happen when a flag is set in docker-compose envvars --- lbrycrd/start.sh | 89 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/lbrycrd/start.sh b/lbrycrd/start.sh index 72520cb..93f517a 100755 --- a/lbrycrd/start.sh +++ b/lbrycrd/start.sh @@ -1,20 +1,34 @@ -#!/bin/bash -## ToDo: -## Get a test case to see if this is the first run or a repeat run -## 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. - -## Ensure perms are correct prior to running main binary -chown -R 1000:1000 /data -chmod -R 755 /data -chown -R 1000:1000 /etc/lbrycrdd -chmod -R 755 /etc/lbrycrdd -rm -f /var/run/lbrycrdd.pid - -## 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 -## Command to initialize +# #!/bin/bash +# ## ToDo: +# ## Get a test case to see if this is the first run or a repeat run +# ## 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. +# +# ## Ensure perms are correct prior to running main binary +# chown -R 1000:1000 /data +# chmod -R 755 /data +# chown -R 1000:1000 /etc/lbrycrdd +# chmod -R 755 /etc/lbrycrdd +# rm -f /var/run/lbrycrdd.pid +# +# ## 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 +# ## Command to initialize +# # lbrycrdd \ +# # -conf=${CONF_PATH:-/etc/lbrycrdd/lbrycrdd.conf} \ +# # -data=${DATA_DIR:-/data/} \ +# # -port=${PORT:-9246} \ +# # -pid=${PID_FILE:/var/run/lbrycrdd.pid} \ +# # -printtoconsole \ +# # -rpcport=${RPC_PORT:-9245} \ +# # -rpcpassword=${RPC_PASSWORD:-changeme} \ +# # -rpcuser=${RPC_USER:-lbryrpc} \ +# # -rpcallowip=${RPC_ALLOW_IP:-10.10.0.2} \ +# # -reindex \ +# # -txindex +# +# ## Command to run for long term. # lbrycrdd \ # -conf=${CONF_PATH:-/etc/lbrycrdd/lbrycrdd.conf} \ # -data=${DATA_DIR:-/data/} \ @@ -25,18 +39,35 @@ rm -f /var/run/lbrycrdd.pid # -rpcpassword=${RPC_PASSWORD:-changeme} \ # -rpcuser=${RPC_USER:-lbryrpc} \ # -rpcallowip=${RPC_ALLOW_IP:-10.10.0.2} \ -# -reindex \ # -txindex +#!/bin/bash -## Command to run for long term. +## Ensure perms are correct prior to running main binary +chown -R 1000:1000 /data +chmod -R 755 /data +chown -R 1000:1000 /etc/lbrycrdd +chmod -R 755 /etc/lbrycrdd +rm -f /var/run/lbrycrdd.pid +mkdir -p ~/.lbrycrd + +## Set config params +echo -e "rpcuser=lbryrpc\nrpcpassword=${RPC_PASSWORD:-changeme}" > ~/.lbrycrd/lbrycrd.conf +echo -e "rpcallowip=${RPC_ALLOW_IP:-10.10.0.2}" >> ~/.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 \ - -conf=${CONF_PATH:-/etc/lbrycrdd/lbrycrdd.conf} \ - -data=${DATA_DIR:-/data/} \ - -port=${PORT:-9246} \ - -pid=${PID_FILE:/var/run/lbrycrdd.pid} \ - -printtoconsole \ - -rpcport=${RPC_PORT:-9245} \ - -rpcpassword=${RPC_PASSWORD:-changeme} \ - -rpcuser=${RPC_USER:-lbryrpc} \ - -rpcallowip=${RPC_ALLOW_IP:-10.10.0.2} \ - -txindex + -server \ + -txindex \ + -reindex \ + -conf=$HOME/.lbrycrd/lbrycrd.conf \ + -printtoconsole + +## 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} \ +# -rpcallowip=${RPC_ALLOW_IP:-10.10.0.2} From 3308850b3ff69cf8041d2a4c51a7e6f59b424512 Mon Sep 17 00:00:00 2001 From: Leopere Date: Sat, 6 Oct 2018 15:50:41 -0400 Subject: [PATCH 2/4] added my.cnf for SQL DB optimizations --- chainquery/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/chainquery/docker-compose.yml b/chainquery/docker-compose.yml index d329d0a..c5548ff 100644 --- a/chainquery/docker-compose.yml +++ b/chainquery/docker-compose.yml @@ -30,6 +30,7 @@ services: - 3306 volumes: - ./data/db:/var/lib/mysql + - ./my.cnf:/etc/mysql/conf.d/chainquery-optimizations.cnf ################ ## Chainquery ## From 70253b6d0fa14bc6869399ee226a68d2925c81cd Mon Sep 17 00:00:00 2001 From: Leopere Date: Sat, 6 Oct 2018 15:53:18 -0400 Subject: [PATCH 3/4] Add my.cnf with database optimizations for chainquery --- lbrycrd/my.cnf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lbrycrd/my.cnf diff --git a/lbrycrd/my.cnf b/lbrycrd/my.cnf new file mode 100644 index 0000000..cb0dbed --- /dev/null +++ b/lbrycrd/my.cnf @@ -0,0 +1,9 @@ +# Default Homebrew MySQL server config +[mysqld] +# Only allow connections from localhost +innodb_log_file_size=5G +key_buffer_size=1G +innodb_flush_log_at_trx_commit = 0 +innodb_autoinc_lock_mode=2 +innodb_buffer_pool_size=1G +innodb_log_buffer_size=1G From 3326153c8cb82acfa0d2925ed76c81ac80594bb9 Mon Sep 17 00:00:00 2001 From: Leopere Date: Sat, 6 Oct 2018 15:54:51 -0400 Subject: [PATCH 4/4] moved my.cnf --- {lbrycrd => chainquery}/my.cnf | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {lbrycrd => chainquery}/my.cnf (100%) diff --git a/lbrycrd/my.cnf b/chainquery/my.cnf similarity index 100% rename from lbrycrd/my.cnf rename to chainquery/my.cnf