Adding base database seed script

This commit is contained in:
Leopere 2018-10-11 22:04:22 -04:00
parent 81a0d02475
commit e6f7e8c026
No known key found for this signature in database
GPG key ID: 64476C903E477CCB
3 changed files with 30 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.gitlab-ci.yml

28
chainquery/db-seed.sh Normal file
View file

@ -0,0 +1,28 @@
#!/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

1
chainquery/db-seed.sha Normal file
View file

@ -0,0 +1 @@
CHECKSUM=6c456f3c3687fab98b1bb3869578ccae1e5ccfd351f8907b3870d204a21ea82e