Files
stacks-puppet-node/api/ops
2018-01-26 11:59:41 -08:00

68 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
ops () {
local image=quay.io/blockstack/blockstack-core
local tag=master
init-api () {
local apiData=data/blockstack-api
echo "Initializing Blockstack Core API server with dummy wallet..."
mkdir -p $apiData
docker run -it --rm \
-v $(pwd)/$apiData:/root/.blockstack \
$image:$tag \
blockstack setup -y --password dummywalletpassword
sudo cp deployment/client.ini $apiData/client.ini
}
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-api -> Set up the dummy wallet for the core api
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