eth.sh, build.sh and processes.json refactoring

This commit is contained in:
cubedro 2015-04-03 18:14:39 +03:00
parent 2d97ac2e8a
commit c7e027d393
4 changed files with 48 additions and 37 deletions

View File

@ -1,33 +1,40 @@
#!/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 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
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update -y
# install ethereum
sudo apt-get install -y geth
# install ethereum & install dependencies
sudo apt-get install -y software-properties-common build-essential git unzip wget nodejs npm ntp cloud-utils geth
# add node symlink
sudo ln -s /usr/bin/nodejs /usr/bin/node
# remove previous eth symlink
[[ ! -f ~/bin/geth ]] && rm ~/bin/geth
# add eth symlink
ln -s /usr/bin/geth ~/bin/geth
# install cloud-utils to fetch instance meta-data
sudo apt-get -y install cloud-utils
# add node symlink if it doesn't exist
[[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node
# add node service
cd ~/bin
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www
cd www
git pull
npm install
npm install pm2 -g
cp -b ./processes-go.json ./../processes.json
[[ ! -f ~/bin/processes.json ]] && cp -b ./processes.json ./..
# set up time update cronjob
cat > /etc/cron.hourly/ntpdate << EOF

View File

@ -2,35 +2,39 @@
cd ~
mkdir bin
mkdir logs
[ ! -d "bin" ] && mkdir bin
[ ! -d "logs" ] && mkdir logs
# let's install packages
sudo apt-get -y update
sudo apt-get -y upgrade
# update packages
sudo apt-get update -y
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-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
ln -s /usr/bin/eth ~/bin/eth
ln -s /usr/bin/eth ~/bin/eth
# add node symlink
sudo ln -s /usr/bin/nodejs /usr/bin/node
# add node symlink if it doesn't exist
[[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node
# add node service
cd ~/bin
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www
cd www
git pull
npm install
npm install pm2 -g
cp -b ./processes.json ./..
[[ ! -f ~/bin/processes.json ]] && cp -b ./processes.json ./..
# set up time update cronjob
cat > /etc/cron.hourly/ntpdate << EOF

View File

@ -2,7 +2,7 @@
trap "exit" INT
if [[ -f /usr/bin/geth ]];
then
geth -rpc -maxpeers "50" -loglevel "1"
geth -rpc -rpcport "8080" -maxpeers "50" -loglevel "1"
else
eth -b -x 50 -r 52.16.188.185 -p 30303 -m off -n off -v 0 -j
fi

View File

@ -1,27 +1,27 @@
[
{
"name" : "eth",
"cwd" : "/home/ubuntu/bin/www/",
"script" : "bin/eth.sh",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"log_file" : "/home/ubuntu/logs/eth-log.log",
"out_file" : "/home/ubuntu/logs/eth-out.log",
"error_file" : "/home/ubuntu/logs/eth-err.log",
"merge_logs" : false,
"cwd" : "~/bin/www/",
"script" : "bin/eth.sh",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"log_file" : "~/logs/eth-log.log",
"out_file" : "~/logs/eth-out.log",
"error_file" : "~/logs/eth-err.log",
"merge_logs" : false,
"watch" : false,
"exec_interpreter" : "bash",
"exec_interpreter" : "bash",
"exec_mode" : "fork_mode"
},
{
"name" : "node-app",
"cwd" : "/home/ubuntu/bin/www/",
"script" : "app.js",
"log_file" : "/home/ubuntu/logs/node-app-log.log",
"out_file" : "/home/ubuntu/logs/node-app-out.log",
"error_file" : "/home/ubuntu/logs/node-app-err.log",
"merge_logs" : false,
"cwd" : "~/bin/www/",
"script" : "app.js",
"log_file" : "~/logs/node-app-log.log",
"out_file" : "~/logs/node-app-out.log",
"error_file" : "~/logs/node-app-err.log",
"merge_logs" : false,
"watch" : false,
"exec_interpreter" : "node",
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{