Merge pull request #49 from lbryio/merge_e2e
Merge chainquery and lbry databases
This commit is contained in:
commit
8d650e032c
4 changed files with 16 additions and 31 deletions
|
@ -13,12 +13,12 @@ lbrycrdurl="rpc://lbry:lbry@lbrycrd:29245"
|
||||||
#MySQL DSN is required for chainquery to store information.
|
#MySQL DSN is required for chainquery to store information.
|
||||||
#DEFAULT: "lbry:lbry@tcp(localhost:3306)/chainquery"
|
#DEFAULT: "lbry:lbry@tcp(localhost:3306)/chainquery"
|
||||||
#SUGGESTED: "lbry:lbry@unix(/var/run/mysqld/mysqld.sock)/chainquery"
|
#SUGGESTED: "lbry:lbry@unix(/var/run/mysqld/mysqld.sock)/chainquery"
|
||||||
mysqldsn="lbry:lbry@tcp(mysqlCQ:3306)/chainquery"
|
mysqldsn="lbry:lbry@tcp(mysql:3306)/chainquery"
|
||||||
|
|
||||||
#API MySQL DSN is required for chainquery to expose a SQL query service
|
#API MySQL DSN is required for chainquery to expose a SQL query service
|
||||||
#DEFAULT: "lbry:lbry@tcp(localhost:3306)/chainquery"
|
#DEFAULT: "lbry:lbry@tcp(localhost:3306)/chainquery"
|
||||||
#SUGGESTED: "lbry:lbry@unix(/var/run/mysqld/mysqld.sock)/chainquery"
|
#SUGGESTED: "lbry:lbry@unix(/var/run/mysqld/mysqld.sock)/chainquery"
|
||||||
apimysqldsn="lbry:lbry@tcp(mysqlCQ:3306)/chainquery"
|
apimysqldsn="lbry:lbry@tcp(mysql:3306)/chainquery"
|
||||||
|
|
||||||
#API Host and Port is required for the API Server to bind and listen on.
|
#API Host and Port is required for the API Server to bind and listen on.
|
||||||
#DEFAULT: "0.0.0.0:6300"
|
#DEFAULT: "0.0.0.0:6300"
|
||||||
|
|
|
@ -80,11 +80,14 @@ services:
|
||||||
- MYSQL_USER=lbry
|
- MYSQL_USER=lbry
|
||||||
- MYSQL_PASSWORD=lbry
|
- MYSQL_PASSWORD=lbry
|
||||||
- MYSQL_LOG_CONSOLE=true
|
- MYSQL_LOG_CONSOLE=true
|
||||||
|
volumes:
|
||||||
|
- "./init.sql:/docker-entrypoint-initdb.d/init.sql"
|
||||||
|
- "./chainquery/docker/my.cnf:/etc/mysql/conf.d/chainquery-optimizations.cnf"
|
||||||
###################
|
###################
|
||||||
## Internal APIs ##
|
## Internal APIs ##
|
||||||
###################
|
###################
|
||||||
internalapis:
|
internalapis:
|
||||||
image: lbry/internal-apis:master
|
image: lbry/internal-apis:master #expand_publish
|
||||||
restart: "no"
|
restart: "no"
|
||||||
ports:
|
ports:
|
||||||
- "15400:8080"
|
- "15400:8080"
|
||||||
|
@ -96,28 +99,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_DSN=lbry:lbry@tcp(mysql:3306)/lbry
|
- MYSQL_DSN=lbry:lbry@tcp(mysql:3306)/lbry
|
||||||
- LBRYCRD_CONNECT=rpc://lbry:lbry@lbrycrd:29245
|
- LBRYCRD_CONNECT=rpc://lbry:lbry@lbrycrd:29245
|
||||||
- MYSQL_USER=lbry
|
entrypoint: wait-for-it -t 0 chainquery:6300 -- wait-for-it -t 0 lbrycrd:29245 -- ./latest serve
|
||||||
- MYSQL_PASS=lbry
|
|
||||||
- MYSQL_DATABASE=lbry
|
|
||||||
entrypoint: wait-for-it -t 0 mysql:3306 -- wait-for-it -t 0 lbrycrd:29245 -- ./latest serve
|
|
||||||
######################
|
|
||||||
## MySQL Chainquery ##
|
|
||||||
######################
|
|
||||||
mysqlCQ:
|
|
||||||
image: mysql/mysql-server:5.7.27
|
|
||||||
restart: "no"
|
|
||||||
ports:
|
|
||||||
- "15600:3306"
|
|
||||||
expose:
|
|
||||||
- "3306"
|
|
||||||
environment:
|
|
||||||
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
|
||||||
- MYSQL_DATABASE=chainquery
|
|
||||||
- MYSQL_USER=lbry
|
|
||||||
- MYSQL_PASSWORD=lbry
|
|
||||||
- MYSQL_LOG_CONSOLE=true
|
|
||||||
volumes:
|
|
||||||
- "./chainquery/docker/my.cnf:/etc/mysql/conf.d/chainquery-optimizations.cnf"
|
|
||||||
################
|
################
|
||||||
## Chainquery ##
|
## Chainquery ##
|
||||||
################
|
################
|
||||||
|
@ -128,8 +110,8 @@ services:
|
||||||
- 6300:6300
|
- 6300:6300
|
||||||
depends_on:
|
depends_on:
|
||||||
- lbrycrd
|
- lbrycrd
|
||||||
- mysqlCQ
|
- mysql
|
||||||
## TODO: Uncomment this in a docker-compose.override.yml to allow for external configurations.
|
## TODO: Uncomment this in a docker-compose.override.yml to allow for external configurations.
|
||||||
volumes:
|
volumes:
|
||||||
- ./chainqueryconfig.toml:/etc/lbry/chainqueryconfig.toml
|
- ./chainqueryconfig.toml:/etc/lbry/chainqueryconfig.toml
|
||||||
entrypoint: wait-for-it -t 0 lbrycrd:29245 -- wait-for-it -t 0 mysqlCQ:3306 -- start
|
entrypoint: wait-for-it -t 0 lbrycrd:29245 -- wait-for-it -t 0 mysql:3306 -- start
|
|
@ -57,9 +57,9 @@ echo "successfully started..."
|
||||||
status=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT status FROM youtube_data WHERE id=1')
|
status=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT status FROM youtube_data WHERE id=1')
|
||||||
videoStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT status FROM synced_video WHERE id=1')
|
videoStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT status FROM synced_video WHERE id=1')
|
||||||
videoClaimID1=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT claim_id FROM synced_video WHERE id=1')
|
videoClaimID1=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT claim_id FROM synced_video WHERE id=1')
|
||||||
videoClaimID2=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT claim_id FROM synced_video WHERE id=1')
|
videoClaimID2=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT claim_id FROM synced_video WHERE id=2')
|
||||||
videoClaimAddress1=$(mysql -u lbry -plbry -ss -D chainquery -h "127.0.0.1" -P 15600 -e 'SELECT claim_address FROM claim WHERE id=2')
|
videoClaimAddress1=$(mysql -u lbry -plbry -ss -D chainquery -h "127.0.0.1" -P 15500 -e 'SELECT claim_address FROM claim WHERE id=2')
|
||||||
videoClaimAddress2=$(mysql -u lbry -plbry -ss -D chainquery -h "127.0.0.1" -P 15600 -e 'SELECT claim_address FROM claim WHERE id=2')
|
videoClaimAddress2=$(mysql -u lbry -plbry -ss -D chainquery -h "127.0.0.1" -P 15500 -e 'SELECT claim_address FROM claim WHERE id=3')
|
||||||
# Create Supports for published claim
|
# Create Supports for published claim
|
||||||
./supporty/supporty @BeamerTest "${videoClaimID1}" "${videoClaimAddress1}" lbrycrd_regtest 1.0
|
./supporty/supporty @BeamerTest "${videoClaimID1}" "${videoClaimAddress1}" lbrycrd_regtest 1.0
|
||||||
./supporty/supporty @BeamerTest "${videoClaimID2}" "${videoClaimAddress2}" lbrycrd_regtest 2.0
|
./supporty/supporty @BeamerTest "${videoClaimID2}" "${videoClaimAddress2}" lbrycrd_regtest 2.0
|
||||||
|
@ -75,7 +75,7 @@ curl -i -H 'Accept: application/json' -H 'Content-Type: application/json' 'http:
|
||||||
# Check that the channel and the video are marked as transferred and that all supports are spent
|
# Check that the channel and the video are marked as transferred and that all supports are spent
|
||||||
channelTransferStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT distinct transfer_state FROM youtube_data')
|
channelTransferStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT distinct transfer_state FROM youtube_data')
|
||||||
videoTransferStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT distinct transferred FROM synced_video')
|
videoTransferStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT distinct transferred FROM synced_video')
|
||||||
nrUnspentSupports=$(mysql -u lbry -plbry -ss -D chainquery -h "127.0.0.1" -P 15600 -e 'SELECT COUNT(*) FROM chainquery.support INNER JOIN output ON output.transaction_hash = support.transaction_hash_id AND output.vout = support.vout WHERE output.is_spent = 0')
|
nrUnspentSupports=$(mysql -u lbry -plbry -ss -D chainquery -h "127.0.0.1" -P 15500 -e 'SELECT COUNT(*) FROM chainquery.support INNER JOIN output ON output.transaction_hash = support.transaction_hash_id AND output.vout = support.vout WHERE output.is_spent = 0')
|
||||||
if [[ $status != "synced" || $videoStatus != "published" || $channelTransferStatus != "2" || $videoTransferStatus != "1" || $nrUnspentSupports != "1" ]]; then
|
if [[ $status != "synced" || $videoStatus != "published" || $channelTransferStatus != "2" || $videoTransferStatus != "1" || $nrUnspentSupports != "1" ]]; then
|
||||||
echo "~~!!!~~~FAILED~~~!!!~~"
|
echo "~~!!!~~~FAILED~~~!!!~~"
|
||||||
echo "Channel Status: $status"
|
echo "Channel Status: $status"
|
||||||
|
|
3
e2e/init.sql
Normal file
3
e2e/init.sql
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
CREATE DATABASE IF NOT EXISTS chainquery;
|
||||||
|
GRANT ALL PRIVILEGES ON chainquery.* TO 'lbry'@'%';
|
||||||
|
FLUSH PRIVILEGES;
|
Loading…
Reference in a new issue