eth.sh, build.sh and processes.json refactoring
This commit is contained in:
parent
2d97ac2e8a
commit
c7e027d393
@ -1,33 +1,40 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# update repository & install dependencies
|
cd ~
|
||||||
|
|
||||||
|
[ ! -d "bin" ] && mkdir bin
|
||||||
|
[ ! -d "logs" ] && mkdir logs
|
||||||
|
|
||||||
|
# update packages
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get upgrade -y
|
sudo apt-get upgrade -y
|
||||||
sudo apt-get install -y git mercurial build-essential software-properties-common wget pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev nodejs npm ntp
|
|
||||||
|
|
||||||
# add ethereum repos
|
# add ethereum repos
|
||||||
sudo add-apt-repository -y ppa:ethereum/ethereum
|
sudo add-apt-repository -y ppa:ethereum/ethereum
|
||||||
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
|
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
|
|
||||||
# install ethereum
|
# install ethereum & install dependencies
|
||||||
sudo apt-get install -y geth
|
sudo apt-get install -y software-properties-common build-essential git unzip wget nodejs npm ntp cloud-utils geth
|
||||||
|
|
||||||
# add node symlink
|
# remove previous eth symlink
|
||||||
sudo ln -s /usr/bin/nodejs /usr/bin/node
|
[[ ! -f ~/bin/geth ]] && rm ~/bin/geth
|
||||||
|
# add eth symlink
|
||||||
|
ln -s /usr/bin/geth ~/bin/geth
|
||||||
|
|
||||||
# install cloud-utils to fetch instance meta-data
|
# add node symlink if it doesn't exist
|
||||||
sudo apt-get -y install cloud-utils
|
[[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node
|
||||||
|
|
||||||
# add node service
|
# add node service
|
||||||
cd ~/bin
|
cd ~/bin
|
||||||
|
|
||||||
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www
|
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www
|
||||||
cd www
|
cd www
|
||||||
|
git pull
|
||||||
npm install
|
npm install
|
||||||
npm install pm2 -g
|
npm install pm2 -g
|
||||||
|
|
||||||
cp -b ./processes-go.json ./../processes.json
|
[[ ! -f ~/bin/processes.json ]] && cp -b ./processes.json ./..
|
||||||
|
|
||||||
# set up time update cronjob
|
# set up time update cronjob
|
||||||
cat > /etc/cron.hourly/ntpdate << EOF
|
cat > /etc/cron.hourly/ntpdate << EOF
|
||||||
|
26
bin/build.sh
26
bin/build.sh
@ -2,35 +2,39 @@
|
|||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
|
|
||||||
mkdir bin
|
[ ! -d "bin" ] && mkdir bin
|
||||||
mkdir logs
|
[ ! -d "logs" ] && mkdir logs
|
||||||
|
|
||||||
# let's install packages
|
# update packages
|
||||||
sudo apt-get -y update
|
sudo apt-get update -y
|
||||||
sudo apt-get -y upgrade
|
sudo apt-get upgrade -y
|
||||||
|
|
||||||
# Setup Ethereum repos
|
# add ethereum repos
|
||||||
sudo add-apt-repository -y ppa:ethereum/ethereum
|
sudo add-apt-repository -y ppa:ethereum/ethereum
|
||||||
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
|
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
|
||||||
sudo apt-get -y update
|
sudo apt-get update -y
|
||||||
|
|
||||||
sudo apt-get -y install software-properties-common build-essential git unzip wget nodejs npm ntp cloud-utils eth
|
# install ethereum & install dependencies
|
||||||
|
sudo apt-get install -y software-properties-common build-essential git unzip wget nodejs npm ntp cloud-utils eth
|
||||||
|
|
||||||
|
# remove previous eth symlink
|
||||||
|
[[ ! -f ~/bin/eth ]] && rm ~/bin/eth
|
||||||
# add eth symlink
|
# add eth symlink
|
||||||
ln -s /usr/bin/eth ~/bin/eth
|
ln -s /usr/bin/eth ~/bin/eth
|
||||||
|
|
||||||
# add node symlink
|
# add node symlink if it doesn't exist
|
||||||
sudo ln -s /usr/bin/nodejs /usr/bin/node
|
[[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node
|
||||||
|
|
||||||
# add node service
|
# add node service
|
||||||
cd ~/bin
|
cd ~/bin
|
||||||
|
|
||||||
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www
|
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www
|
||||||
cd www
|
cd www
|
||||||
|
git pull
|
||||||
npm install
|
npm install
|
||||||
npm install pm2 -g
|
npm install pm2 -g
|
||||||
|
|
||||||
cp -b ./processes.json ./..
|
[[ ! -f ~/bin/processes.json ]] && cp -b ./processes.json ./..
|
||||||
|
|
||||||
# set up time update cronjob
|
# set up time update cronjob
|
||||||
cat > /etc/cron.hourly/ntpdate << EOF
|
cat > /etc/cron.hourly/ntpdate << EOF
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
trap "exit" INT
|
trap "exit" INT
|
||||||
if [[ -f /usr/bin/geth ]];
|
if [[ -f /usr/bin/geth ]];
|
||||||
then
|
then
|
||||||
geth -rpc -maxpeers "50" -loglevel "1"
|
geth -rpc -rpcport "8080" -maxpeers "50" -loglevel "1"
|
||||||
else
|
else
|
||||||
eth -b -x 50 -r 52.16.188.185 -p 30303 -m off -n off -v 0 -j
|
eth -b -x 50 -r 52.16.188.185 -p 30303 -m off -n off -v 0 -j
|
||||||
fi
|
fi
|
@ -1,12 +1,12 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name" : "eth",
|
"name" : "eth",
|
||||||
"cwd" : "/home/ubuntu/bin/www/",
|
"cwd" : "~/bin/www/",
|
||||||
"script" : "bin/eth.sh",
|
"script" : "bin/eth.sh",
|
||||||
"log_date_format" : "YYYY-MM-DD HH:mm Z",
|
"log_date_format" : "YYYY-MM-DD HH:mm Z",
|
||||||
"log_file" : "/home/ubuntu/logs/eth-log.log",
|
"log_file" : "~/logs/eth-log.log",
|
||||||
"out_file" : "/home/ubuntu/logs/eth-out.log",
|
"out_file" : "~/logs/eth-out.log",
|
||||||
"error_file" : "/home/ubuntu/logs/eth-err.log",
|
"error_file" : "~/logs/eth-err.log",
|
||||||
"merge_logs" : false,
|
"merge_logs" : false,
|
||||||
"watch" : false,
|
"watch" : false,
|
||||||
"exec_interpreter" : "bash",
|
"exec_interpreter" : "bash",
|
||||||
@ -14,11 +14,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name" : "node-app",
|
"name" : "node-app",
|
||||||
"cwd" : "/home/ubuntu/bin/www/",
|
"cwd" : "~/bin/www/",
|
||||||
"script" : "app.js",
|
"script" : "app.js",
|
||||||
"log_file" : "/home/ubuntu/logs/node-app-log.log",
|
"log_file" : "~/logs/node-app-log.log",
|
||||||
"out_file" : "/home/ubuntu/logs/node-app-out.log",
|
"out_file" : "~/logs/node-app-out.log",
|
||||||
"error_file" : "/home/ubuntu/logs/node-app-err.log",
|
"error_file" : "~/logs/node-app-err.log",
|
||||||
"merge_logs" : false,
|
"merge_logs" : false,
|
||||||
"watch" : false,
|
"watch" : false,
|
||||||
"exec_interpreter" : "node",
|
"exec_interpreter" : "node",
|
||||||
|
Loading…
Reference in New Issue
Block a user