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.
This commit is contained in:
Leopere 2018-11-04 19:35:35 +00:00
parent 75ea4c1577
commit 5ef885df04
8 changed files with 35 additions and 80 deletions

View file

@ -1 +1,3 @@
data/
data.z*
chainquery.z*

View file

@ -1,10 +1,13 @@
COMPOSE_PROJECT_NAME=chainquery
RPC_USER=${RPC_USER=lbryrpc}
RPC_PASSWORD=${RPC_PASSWORD:-changeme}
## Currently unused until start.sh gains magic powers.
RPC_USER=lbryrpc
RPC_PASSWORD=changeme
## This should be the internal container IP from which you'll be calling the RPC for Lbrycrdd from.
RPC_ALLOW_IP=${RPC_ALLOW_IP:-10.5.1.3}
MYSQL_SERVER=${MYSQL_SERVER:-10.5.1.10}
MYSQL_USER=${MYSQL_USER:-changeme}
MYSQL_PASSWORD=${MYSQL_PASSWORD:-changeme}
MYSQL_DATABASE=${MYSQL_DATABASE:-chainquery}
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-changeme}
RPC_ALLOW_IP=10.5.1.3
## Mysql Creds to be shared between Chainquery and Mysql container
MYSQL_SERVER=10.5.1.10
MYSQL_USER=changeme
MYSQL_PASSWORD=changeme
MYSQL_DATABASE=chainquery
MYSQL_ROOT_PASSWORD=changeme

3
chainquery/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
data/
data.z*
chainquery.z*

View file

@ -23,9 +23,9 @@ FROM ubuntu:18.04 as app
RUN adduser chainquery --gecos GECOS --shell /bin/bash --disabled-password --home /home/chainquery
COPY --from=0 /download/chainquery /usr/bin
COPY chainqueryconfig.toml /etc/chainquery
COPY chainqueryconfig.toml /etc/chainquery/
RUN ls -lAh /etc |grep chain && \
ls -lAh /etc/chainquery && \
ls -lAh /etc/chainquery/ && \
cat /etc/chainquery/chainqueryconfig.toml
COPY start.sh /usr/local/bin/start
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint

View file

@ -1,28 +0,0 @@
#!/usr/bin/env bash
source ./db-seed.sha
echo "Checking if seeding is needed"
if [[ -d !./data/db/chainquery ]]; then
echo "It appears as though you don't currently have the db created."
echo "Downloading the Chainquery DB checkpoint data."
wget -O data.zip https://s3bucketURL/here.zip
if [[ -f !./data.zip ]]; then
echo "It seems that downloading the checkpoint data failed."
else
echo "Checkpoint data received verifying download integrity."
if ! echo "$CHECKSUM data.zip" | sha256sum -c -; then
echo "Checksum failed, somehow the checkpoint data doesn't match what it's supposed to." >&2
exit 1
else
echo "clearing ./data directory in case it contains something strange."
echo "Uncompressing chainquery checkpoint data."
rm -Rf ./data
unzip ./data.zip
if [[ -d !./data/db/chainquery ]]; then
echo "Something went wrong with uncompressing checkpoint data."
exit 1
else
echo "Checkpoint data has been successfully obtained you can now run the Chainquery appliance."
fi
fi
fi
fi

View file

@ -18,45 +18,16 @@ services:
ipv4_address: 10.5.1.10
aliases:
- mysql
environment:
## These variables are stored in the .env file next to this docker-compose.yml file.
## I will include a default .env file and .gitignore the ".env" pattern so you should be able to just git pull in the future if you need to.
MYSQL_SERVER: ${MYSQL_SERVER:-10.5.1.10}
MYSQL_USER: ${MYSQL_USER:-changeme}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-changeme}
MYSQL_DATABASE: ${MYSQL_DATABASE:-chainquery}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-changeme}
env_file:
- .env
expose:
- 3306
ports:
- 3306:3306
volumes:
- ./data/db:/var/lib/mysql
- ./my.cnf:/etc/mysql/conf.d/chainquery-optimizations.cnf
#######################
## Adminer container ##
#######################
# adminer:
# image: adminer
# # restart: always
# links:
# - "mysql:database"
# depends_on:
# - mysql
# labels:
# # https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
# - "traefik.backend=adminer"
# - "traefik.docker.network=lbrynet"
# - "traefik.frontend.rule=Host:adminer.lbry-demo.nixc.us"
# - "traefik.expose=true"
# - "traefik.port=8080"
# # healthcheck:
# # test: ["CMD", "curl", "--fail", "http://localhost:8080/", "||", "exit", "1"]
# networks:
# traefik:
# ipv4_address: 10.5.1.19
# aliases:
# - adminer
################
## Chainquery ##
################
@ -68,6 +39,8 @@ services:
networks:
traefik:
ipv4_address: 10.5.1.3
env_file:
- ./.env
labels:
- "traefik.expose=false"
expose:

18
chainquery/quick-bootstrap.sh Normal file → Executable file
View file

@ -35,24 +35,20 @@ BONUS_DEPENDENCIES=(
docker-compose
)
function check_deps() {
for i in "${!DEPENDENCIES[@]}"; do
echo ${DEPENDENCIES[$i]}"_KEY"
## Indirect references http://tldp.org/LDP/abs/html/ivr.html
eval TESTDEP=\$"${DEPENDENCIES[$i]}"
test_for_deps $TESTDEP
done
}
## Add ways to get into and out of a bind here.
case i in
* )
echo "=================================================="
echo "You look like you need usage examples let me help."
echo "=================================================="
echo "Add documentation on script params HERE"
;;
case $1 in
getdata )
## Get DB Checkpoint data.
wget http://chainquery-data.s3.amazonaws.com/data.zip ./chainquery.zip
axel -a -n 6 http://chainquery-data.s3.amazonaws.com/data.zip -o ./chainquery.zip
;;
extract )
## Unpack the data again if need be.
@ -67,4 +63,10 @@ case i in
# rm -Rf ./data
# rm -f ./chainquery.zip
;;
* )
echo "=================================================="
echo "You look like you need usage examples let me help."
echo "=================================================="
echo "Add documentation on script params HERE"
;;
esac

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
## 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 -c "/etc/chainquery/chainqueryconfig.toml" serve
chainquery serve -c "/etc/chainquery/"