Renamed and cleaned up setup scripts

This commit is contained in:
Jon Layton 2018-04-11 11:25:08 -05:00
parent b0d0aa42bc
commit d1884ad8eb
6 changed files with 94 additions and 109 deletions

View File

@ -60,21 +60,6 @@ cd btcp-explorer
# Install Insight API / UI (Explorer) (Headless)
../node_modules/bitcore-node-btcp/bin/bitcore-node install BTCPrivate/insight-api-btcp BTCPrivate/insight-ui-btcp
# !!! OPTIONAL [TODO present cli options] Install store-demo
cd ~
git clone https://github.com/BTCPrivate/store-demo
cd btcp-explorer/node_modules
ln -s ~/store-demo
# !!! OPTIONAL [TODO present cli options] Install address-watch
cd ~
git clone https://github.com/BTCPrivate/address-watch
cd btcp-explorer/node_modules
ln -s ~/address-watch
# Create config file for Bitcore
# !!! OPTIONAL TODO add store-demo and address-watch to services as specified
# Create config file for Bitcore
cat << EOF > bitcore-node.json
{

View File

@ -24,8 +24,8 @@ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Install node v9, or v4 for <=4.0
nvm install v9 #v4
# Install node v9
nvm install v9
# Fetch BTCP + Build from source
./build_btcp.sh
@ -39,12 +39,13 @@ npm install npm-run-all -g
cd ~
mkdir btcp-bitcore-node
cd btcp-bitcore-node
# Install Bitcore (Headless)
nvm use v9 #v4
npm install ch4ot1c/bitcore-node # or #4.0-btcp for daemon-compatible(?)
nvm use v9
npm install ch4ot1c/bitcore-node # or branch 4.0-btcp (?)
# Create Bitcore Node
./node_modules/bitcore-node/bin/bitcore-node create btcp-node
@ -57,6 +58,7 @@ cd btcp-node
cd node_modules
npm install ch4ot1c/insight-api ch4ot1c/insight --save
# Service Installation Instructions from BitPay site (for newer versions of bitcore/bitcore-node, wip):
# !!! OPTIONAL [TODO present cli options] Install store-demo
#cd ~
#git clone https://github.com/BTCPrivate/store-demo
@ -72,39 +74,7 @@ npm install ch4ot1c/insight-api ch4ot1c/insight --save
# Create config file for Bitcore
# !!! OPTIONAL TODO add store-demo and address-watch to services as specified
# Create config file for Bitcore
: '
# daemon (4.0) (bitcoind, as opposed to bcoin)
cat << EOF > bitcore-node.json
{
"network": "livenet",
"port": 8001,
"services": [
"bitcoind",
"insight-api",
"insight-ui",
"web"
],
"servicesConfig": {
"bitcoind": {
"spawn": {
"datadir": "$HOME/.btcprivate",
"exec": "$HOME/BitcoinPrivate/src/btcpd"
}
},
"insight-ui": {
"apiPrefix": "api",
"routePrefix": ""
},
"insight-api": {
"routePrefix": "api"
}
}
}
EOF
'
# daemon (5.0) (bcoin)
# daemon (5.0) (uses bcoin)
# optional - add bitcore-wallet-service
cat << EOF > bitcore-node.json
{
@ -150,7 +120,7 @@ EOF
echo "To start the daemon and all services, run:"
echo "./start.sh"
echo "bitcore start"
echo "\n"
echo "To view the explorer in your browser - http://server_ip:8001"
echo "For https, we recommend you route through Cloudflare."

View File

@ -1,8 +1,9 @@
#!/bin/bash
# Bitcore v3.1 - BTCP Explorer + Store / AddressWatch Demo
# BTCP Bitcore API + Explorer + Store / AddressWatch Demo
install_ubuntu() {
# Get Ubuntu Dependencies
sudo apt-get update
@ -11,59 +12,68 @@ sudo apt-get -y install \
autoconf libtool ncurses-dev unzip git python \
zlib1g-dev wget bsdmainutils automake
# Install ZeroMQ libraries (Bitcore)
sudo apt-get -y install libzmq3-dev
# Install ZeroMQ libraries (Bitcore)
sudo apt-get -y install libzmq3-dev
}
make_swapfile() {
# WARNING: You must have a big Swapfile for the installation to succeed
# !!! EC2 Micro - Make sure you have a big enough Swapfile
#
#prev=$PWD
#cd /
#sudo dd if=/dev/zero of=swapfile bs=1M count=3000
#sudo mkswap swapfile
#sudo chmod 0600 /swapfile
#sudo swapon swapfile
#echo "/swapfile none swap sw 0 0" | sudo tee -a etc/fstab > /dev/null
#cd prev
}
clone_and_build_btcp() {
# Clone latest Bitcoin Private source, and checkout explorer-btcp
git clone -b explorer-btcp https://github.com/BTCPrivate/BitcoinPrivate
cd BitcoinPrivate
# Fetch Zcash ceremony params
./btcputil/fetch-params.sh
# Clone latest Bitcoin Private source, and checkout explorer-btcp
git clone -b explorer-btcp https://github.com/BTCPrivate/BitcoinPrivate
cd BitcoinPrivate
# !!! OPTIONAL: EC2 - Make sure port 8001 is in your security group
# !!! OPTIONAL: EC2 Micro - Make sure you have a big enough Swapfile
#prev=$PWD
#cd /
#sudo dd if=/dev/zero of=swapfile bs=1M count=3000
#sudo mkswap swapfile
#sudo chmod 0600 /swapfile
#sudo swapon swapfile
#echo "/swapfile none swap sw 0 0" | sudo tee -a etc/fstab > /dev/null
#cd prev
# Fetch BTCP/Zcash ceremony params
./btcputil/fetch-params.sh
# Build Bitcoin Private
./btcputil/build.sh -j$(nproc)
# Build Bitcoin Private
./btcputil/build.sh -j$(nproc)
# Make initial, empty btcprivate.conf if needed
if [ ! -e ~/.btcprivate/btcprivate.conf ]
then
touch ~/.btcprivate/btcprivate.conf
fi
# Make initial, empty btcprivate.conf if needed
if [ ! -e ~/.btcprivate/btcprivate.conf ]
then
touch ~/.btcprivate/btcprivate.conf
fi
}
install_nvm_npm() {
# Install npm
sudo apt-get -y install npm
# Install nvm (npm version manager)
wget -qO- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
# Install npm
sudo apt-get -y install npm
# Set up nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Install nvm (npm version manager)
wget -qO- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
# Set up nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Install node v4
nvm install v4
nvm use v4
nvm alias default v4
# Install node v4
nvm install v4
nvm use v4
nvm alias default v4
}
# For bitcore-wallet-service:
# MongoDB dependency for bitcore-wallet-service:
install_mongodb() {
@ -93,22 +103,12 @@ cd btcp-explorer
# (BTCPrivate/address-watch)
# (mv store-demo lemonade-stand)
# !!! OPTIONAL [TODO present cli options] Install store-demo
#cd ~
#git clone https://github.com/BTCPrivate/store-demo
#cd btcp-explorer/node_modules
#ln -s ~/store-demo
# !!! OPTIONAL [TODO present cli options] Install address-watch
#cd ~
#git clone https://github.com/BTCPrivate/address-watch
#cd btcp-explorer/node_modules
#ln -s ~/address-watch
# Create config file for Bitcore
# !!! OPTIONAL TODO add store-demo and address-watch to services as specified
# !!! EC2 - Make sure port 8001 is in your security group
cat << EOF > bitcore-node.json
{
"network": "livenet",
@ -141,14 +141,24 @@ EOF
}
# Begin
echo "Begin Setup."
echo \n
cd ~
#clone_and_build_btcp
echo "Begin Setup."
echo \n
echo "Can we make you a 3gb swapfile? It takes a lot of memory to build BTCP."
read -r -p "[y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
make_swapfile
clone_and_build_btcp
;;
*)
clone_and_build_btcp
;;
esac
#install_nvm_npm
install_nvm_npm
#install_mongodb
@ -162,3 +172,22 @@ echo "nvm use v4; ./node_modules/bitcore-node/bin/bitcore-node start"
echo \n
echo "To view the explorer in your browser - http://server_ip:8001"
echo "For https, we recommend you route through Cloudflare. bitcore-node also supports it via the config; provide certs."
# Service Installation Instructions from BitPay site (for newer versions of bitcore/bitcore-node, wip):
# !!! OPTIONAL [TODO present cli options] Install store-demo
#cd ~
#git clone https://github.com/BTCPrivate/store-demo
#cd btcp-explorer/node_modules
#ln -s ~/store-demo
# !!! OPTIONAL [TODO present cli options] Install address-watch
#cd ~
#git clone https://github.com/BTCPrivate/address-watch
#cd btcp-explorer/node_modules
#ln -s ~/address-watch

View File

@ -9,5 +9,6 @@ export NVM_DIR="$HOME/.nvm"
# For >= 5.0 (bitpay website instructions)
nvm use v9; bitcored
# For v3.1: cd btcp-explorer; nvm use v4; ./node_modules/bitcore-node/bin/bitcore-node start
# For earlier versions:
# cd btcp-explorer; nvm use v4; ./node_modules/bitcore-node/bin/bitcore-node start