From 3a3760b63a4645ac12bebdf1ef0584f0f53bd4cc Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Fri, 6 Apr 2018 17:23:12 +0000 Subject: [PATCH 1/7] Add btcp_store_demo.sh --- btcp_store_demo.sh | 141 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100755 btcp_store_demo.sh diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh new file mode 100755 index 0000000..b375c0a --- /dev/null +++ b/btcp_store_demo.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +# Bitcore v3.1 - BTCP Explorer + Store / AddressWatch Demo + +install_ubuntu() { + # Get Ubuntu Dependencies + sudo apt-get update + + sudo apt-get -y install \ + build-essential pkg-config libc6-dev m4 g++-multilib \ + autoconf libtool ncurses-dev unzip git python \ + zlib1g-dev wget bsdmainutils automake + + # Install ZeroMQ libraries (Bitcore) + sudo apt-get -y install libzmq3-dev +} + + +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 + + # !!! 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 + + # 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 +} + +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 + + # 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 +} + +# -- Bitcore -- +install_bitcore() { + # Install Bitcore (Headless) + npm install BTCPrivate/bitcore-node-btcp + + # Create Bitcore Node + ./node_modules/bitcore-node-btcp/bin/bitcore-node create btcp-explorer + 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 BTCPrivate/store-demo + # (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 + cat << EOF > bitcore-node.json + { + "network": "livenet", + "port": 8001, + "services": [ + "bitcoind", + "insight-api-btcp", + "insight-ui-btcp", + "store-demo", + "web" + ], + "servicesConfig": { + "bitcoind": { + "spawn": { + "datadir": "$HOME/.btcprivate", + "exec": "$HOME/BitcoinPrivate/src/btcpd" + } + }, + "insight-ui-btcp": { + "apiPrefix": "api", + "routePrefix": "" + }, + "insight-api-btcp": { + "routePrefix": "api" + } + } + } + EOF +} + +echo "Begin" +cd ~ + +#clone_and_build_btcp + +#install_nvm_npm + +install_bitcore +echo "Complete." + + +echo "To start the bitcore-node, run (from btcp-explorer):" +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." + From b6eb0a1c7d942a4b900d130f4e5527004d612564 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Fri, 6 Apr 2018 17:35:53 +0000 Subject: [PATCH 2/7] v5 setup+run instructions clarified --- btcp_v5_node_setup.sh | 9 +++------ start.sh | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/btcp_v5_node_setup.sh b/btcp_v5_node_setup.sh index 823b188..7a222d0 100755 --- a/btcp_v5_node_setup.sh +++ b/btcp_v5_node_setup.sh @@ -42,12 +42,13 @@ npm install -g BTCPrivate/bitcore # -- Bitcore -- bitcore create btcp -#bitcore install ... +#bitcore install ch4ot1c/insight-api ch4ot1c/insight +# (BTCPrivate/bitcore-wallet-service, BTCPrivate/store-demo, BTCPrivate/address-watch) cd btcp -# TODO set generated package.json's refs to ch4ot1c/ npm install +# bitcored (bitpay website approach): # !!! OPTIONAL [TODO present cli options] Install store-demo #cd ~ #git clone https://github.com/BTCPrivate/store-demo @@ -59,13 +60,9 @@ npm install #git clone https://github.com/BTCPrivate/address-watch #cd btcp-explorer/node_modules #ln -s ~/address-watch - # !!! OPTIONAL [TODO present cli options] Install bitcore-wallet-service -#bitcore install ch4ot1c/insight-api ch4ot1c/insight -# (BTCPrivate/bitcore-wallet-service, BTCPrivate/store-demo, BTCPrivate/address-watch) - # Create config file for Bitcore cat << EOF > bitcore-node.json { diff --git a/start.sh b/start.sh index 363a5f1..dae8289 100755 --- a/start.sh +++ b/start.sh @@ -6,8 +6,8 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Start Bitcore Services (and Daemon) -nvm use v9 #v4 +# 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 -./node_modules/bitcore-node/bin/bitcore-node start -# (run this from where you ran `bitcore create x` (btcp-bitcore-node)) -# (or, if set up like the >= 5.0 bitpay website instructions, just `bitcored`) From e3cb219cbf221630c7a42a69f0117f1032ff0e19 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Fri, 6 Apr 2018 18:21:44 +0000 Subject: [PATCH 3/7] Untab for better shell style --- btcp_store_demo.sh | 110 +++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index b375c0a..5db2199 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -3,13 +3,13 @@ # Bitcore v3.1 - BTCP Explorer + Store / AddressWatch Demo install_ubuntu() { - # Get Ubuntu Dependencies - sudo apt-get update +# Get Ubuntu Dependencies +sudo apt-get update - sudo apt-get -y install \ - build-essential pkg-config libc6-dev m4 g++-multilib \ - autoconf libtool ncurses-dev unzip git python \ - zlib1g-dev wget bsdmainutils automake +sudo apt-get -y install \ + build-essential pkg-config libc6-dev m4 g++-multilib \ + autoconf libtool ncurses-dev unzip git python \ + zlib1g-dev wget bsdmainutils automake # Install ZeroMQ libraries (Bitcore) sudo apt-get -y install libzmq3-dev @@ -63,52 +63,53 @@ install_nvm_npm() { nvm alias default v4 } -# -- Bitcore -- install_bitcore() { - # Install Bitcore (Headless) - npm install BTCPrivate/bitcore-node-btcp - # Create Bitcore Node - ./node_modules/bitcore-node-btcp/bin/bitcore-node create btcp-explorer - cd btcp-explorer +# Install Bitcore (Headless) +npm install BTCPrivate/bitcore-node-btcp - # Install Insight API / UI (Explorer) (Headless) - ../node_modules/bitcore-node-btcp/bin/bitcore-node install BTCPrivate/insight-api-btcp BTCPrivate/insight-ui-btcp BTCPrivate/store-demo - # (BTCPrivate/address-watch) - # (mv store-demo lemonade-stand) +# Create Bitcore Node +./node_modules/bitcore-node-btcp/bin/bitcore-node create btcp-explorer +cd btcp-explorer - # !!! 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 - +# Install Insight API / UI (Explorer) (Headless) +../node_modules/bitcore-node-btcp/bin/bitcore-node install BTCPrivate/insight-api-btcp BTCPrivate/insight-ui-btcp BTCPrivate/store-demo +# (BTCPrivate/address-watch) +# (mv store-demo lemonade-stand) - # !!! 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 +# !!! 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 - # Create config file for Bitcore - # !!! OPTIONAL TODO add store-demo and address-watch to services as specified - cat << EOF > bitcore-node.json - { - "network": "livenet", - "port": 8001, - "services": [ - "bitcoind", - "insight-api-btcp", - "insight-ui-btcp", - "store-demo", - "web" - ], - "servicesConfig": { - "bitcoind": { - "spawn": { - "datadir": "$HOME/.btcprivate", - "exec": "$HOME/BitcoinPrivate/src/btcpd" - } + +# !!! 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 + +cat << EOF > bitcore-node.json +{ + "network": "livenet", + "port": 8001, + "services": [ + "bitcoind", + "insight-api-btcp", + "insight-ui-btcp", + "store-demo", + "web" + ], + "servicesConfig": { + "bitcoind": { + "spawn": { + "datadir": "$HOME/.btcprivate", + "exec": "$HOME/BitcoinPrivate/src/btcpd" + } }, "insight-ui-btcp": { "apiPrefix": "api", @@ -119,10 +120,14 @@ install_bitcore() { } } } - EOF +EOF + } -echo "Begin" +# Begin +echo "Begin Setup." +echo \n + cd ~ #clone_and_build_btcp @@ -130,12 +135,11 @@ cd ~ #install_nvm_npm install_bitcore + echo "Complete." - - +echo \n echo "To start the bitcore-node, run (from btcp-explorer):" echo "nvm use v4; ./node_modules/bitcore-node/bin/bitcore-node start" -echo "\n" +echo \n echo "To view the explorer in your browser - http://server_ip:8001" -echo "For https, we recommend you route through Cloudflare." - +echo "For https, we recommend you route through Cloudflare. bitcore-node also supports it via the config; provide certs." From b0d0aa42bc7d868f0a58ee22386f1960e46e0ded Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Tue, 10 Apr 2018 14:37:41 -0500 Subject: [PATCH 4/7] Added mongodb installation steps for ubuntu --- btcp_store_demo.sh | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 5db2199..4100741 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -63,6 +63,22 @@ install_nvm_npm() { nvm alias default v4 } +# For bitcore-wallet-service: + +install_mongodb() { + +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 +# Ubuntu >= 16; for prior versions, see mongodb website +echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list +sudo apt-get update +sudo apt-get install -y mongodb-org + +# Make initial empty db dir +sudo mkdir -p /data/db + +} + + install_bitcore() { # Install Bitcore (Headless) @@ -109,17 +125,17 @@ cat << EOF > bitcore-node.json "spawn": { "datadir": "$HOME/.btcprivate", "exec": "$HOME/BitcoinPrivate/src/btcpd" - } - }, - "insight-ui-btcp": { - "apiPrefix": "api", - "routePrefix": "" - }, - "insight-api-btcp": { - "routePrefix": "api" - } - } + } + }, + "insight-ui-btcp": { + "apiPrefix": "api", + "routePrefix": "" + }, + "insight-api-btcp": { + "routePrefix": "api" + } } +} EOF } @@ -134,10 +150,13 @@ cd ~ #install_nvm_npm +#install_mongodb + install_bitcore echo "Complete." echo \n +echo "To start mongodb for bitcore-wallet-service, run 'mongod &'" echo "To start the bitcore-node, run (from btcp-explorer):" echo "nvm use v4; ./node_modules/bitcore-node/bin/bitcore-node start" echo \n From d1884ad8eb85b1128bb878b97018d532e6f4b890 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Wed, 11 Apr 2018 11:25:08 -0500 Subject: [PATCH 5/7] Renamed and cleaned up setup scripts --- btcp_old_node_setup.sh => btcp_basic_node.sh | 15 -- build_btcp.sh => btcp_daemon_only.sh | 0 ..._node_setup.sh => btcp_explorer_upgrade.sh | 46 +----- btcp_v5_node_setup.sh => btcp_node_v5.sh | 0 btcp_store_demo.sh | 139 +++++++++++------- start.sh => start_v5.sh | 3 +- 6 files changed, 94 insertions(+), 109 deletions(-) rename btcp_old_node_setup.sh => btcp_basic_node.sh (84%) rename build_btcp.sh => btcp_daemon_only.sh (100%) rename btcp_node_setup.sh => btcp_explorer_upgrade.sh (78%) rename btcp_v5_node_setup.sh => btcp_node_v5.sh (100%) rename start.sh => start_v5.sh (75%) diff --git a/btcp_old_node_setup.sh b/btcp_basic_node.sh similarity index 84% rename from btcp_old_node_setup.sh rename to btcp_basic_node.sh index ce8031e..812d878 100755 --- a/btcp_old_node_setup.sh +++ b/btcp_basic_node.sh @@ -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 { diff --git a/build_btcp.sh b/btcp_daemon_only.sh similarity index 100% rename from build_btcp.sh rename to btcp_daemon_only.sh diff --git a/btcp_node_setup.sh b/btcp_explorer_upgrade.sh similarity index 78% rename from btcp_node_setup.sh rename to btcp_explorer_upgrade.sh index e30b897..fce207b 100755 --- a/btcp_node_setup.sh +++ b/btcp_explorer_upgrade.sh @@ -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." diff --git a/btcp_v5_node_setup.sh b/btcp_node_v5.sh similarity index 100% rename from btcp_v5_node_setup.sh rename to btcp_node_v5.sh diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 4100741..8e40a99 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -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 + + diff --git a/start.sh b/start_v5.sh similarity index 75% rename from start.sh rename to start_v5.sh index dae8289..cf1af9c 100755 --- a/start.sh +++ b/start_v5.sh @@ -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 From 5d011525e58c1ef4655c1435728fb26ac7f31489 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Wed, 11 Apr 2018 11:28:36 -0500 Subject: [PATCH 6/7] uncomment swapfile gen for store demo --- btcp_store_demo.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 8e40a99..2c1ac0d 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -2,6 +2,8 @@ # BTCP Bitcore API + Explorer + Store / AddressWatch Demo +# !!! EC2 - Make sure port 8001 is in your security group + install_ubuntu() { # Get Ubuntu Dependencies @@ -22,14 +24,14 @@ 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 +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 } @@ -100,15 +102,10 @@ 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 BTCPrivate/store-demo -# (BTCPrivate/address-watch) -# (mv store-demo lemonade-stand) +# (BTCPrivate/address-watch) (BTCPrivate/bitcore-wallet-service (untested)) # 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", @@ -166,6 +163,7 @@ install_bitcore echo "Complete." echo \n + echo "To start mongodb for bitcore-wallet-service, run 'mongod &'" echo "To start the bitcore-node, run (from btcp-explorer):" echo "nvm use v4; ./node_modules/bitcore-node/bin/bitcore-node start" From 53c64935a2d0a441b0f5e1ad329dbddd2104b8a9 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 11 Apr 2018 18:40:33 +0000 Subject: [PATCH 7/7] dir fixes --- btcp_store_demo.sh | 58 +++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 2c1ac0d..b5552b3 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -16,22 +16,22 @@ sudo apt-get -y install \ # 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 +# You must have enough memory for the installation to succeed. + +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 +cd $PREV } @@ -39,13 +39,12 @@ 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 BTCP/Zcash ceremony params -./btcputil/fetch-params.sh +./BitcoinPrivate/btcputil/fetch-params.sh # Build Bitcoin Private -./btcputil/build.sh -j$(nproc) +./BitcoinPrivate/btcputil/build.sh -j$(nproc) # Make initial, empty btcprivate.conf if needed if [ ! -e ~/.btcprivate/btcprivate.conf ] @@ -137,12 +136,17 @@ EOF } -# Begin +# -- Begin Fetching + Building -- cd ~ echo "Begin Setup." -echo \n -echo "Can we make you a 3gb swapfile? It takes a lot of memory to build BTCP." +echo "" + +install_ubuntu + +echo "" +echo "Can we make you a 3gb swapfile? EC2 Micro needs it because it takes a lot of memory to build BTCP." +echo "" read -r -p "[y/N] " response case "$response" in [yY][eE][sS]|[yY]) @@ -162,30 +166,16 @@ install_nvm_npm install_bitcore echo "Complete." -echo \n +echo "" + +# Verify that nvm is exported +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 echo "To start mongodb for bitcore-wallet-service, run 'mongod &'" -echo "To start the bitcore-node, run (from btcp-explorer):" -echo "nvm use v4; ./node_modules/bitcore-node/bin/bitcore-node start" -echo \n +echo "To start the bitcore-node, run:" +echo "cd ~/btcp-explorer; nvm use v4; ./node_modules/bitcore-node-btcp/bin/bitcore-node start" +echo "" 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 - -