From e6f7e8c02619a0ae69ed780ddc1ad9b26f43cec2 Mon Sep 17 00:00:00 2001 From: Leopere Date: Thu, 11 Oct 2018 22:04:22 -0400 Subject: [PATCH] Adding base database seed script --- .gitignore | 1 + chainquery/db-seed.sh | 28 ++++++++++++++++++++++++++++ chainquery/db-seed.sha | 1 + 3 files changed, 30 insertions(+) create mode 100644 .gitignore create mode 100644 chainquery/db-seed.sh create mode 100644 chainquery/db-seed.sha diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..926cc8a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.gitlab-ci.yml diff --git a/chainquery/db-seed.sh b/chainquery/db-seed.sh new file mode 100644 index 0000000..491be47 --- /dev/null +++ b/chainquery/db-seed.sh @@ -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 diff --git a/chainquery/db-seed.sha b/chainquery/db-seed.sha new file mode 100644 index 0000000..19ec068 --- /dev/null +++ b/chainquery/db-seed.sha @@ -0,0 +1 @@ +CHECKSUM=6c456f3c3687fab98b1bb3869578ccae1e5ccfd351f8907b3870d204a21ea82e