#!/bin/bash ops () { local image=quay.io/blockstack/blockstack-core local tag=master init-indexer () { local idxData=data/search-api echo "Initializing Blockstack Indexer with dummy data..." mkdir -p $idxData cp search/fixtures/blockchain_data.json $idxData/blockchain_data.json cp search/fixtures/profile_data.slice.json $idxData/profile_data.json } init-core () { local coreData=data/blockstack-core echo "Initializing Blockstack Core node. This task runs in the background and may take up to 20 minutes..." mkdir -p $coreData/server/ cp $(pwd)/deployment/blockstack-server.ini $coreData/server/blockstack-server.ini docker run -d --rm \ -v $(pwd)/$coreData/server/:/root/.blockstack-server/ \ -v $(pwd)/$coreData/api/:/root/.blockstack \ --name blockstack-core-init \ $image:$tag \ blockstack-core --debug fast_sync http://fast-sync.blockstack.org/snapshot.bsk > /dev/null } commands () { cat <<-EOF ops commands: init-indexer -> Set up the bootstrapping data for the indexer init-core -> Set up blockstack-core instance for this API EOF } case $1 in init-api) init-api ;; init-indexer) init-indexer ;; init-core) init-core ;; *) commands ;; esac } ops $1 $2