Merge pull request #40 from cubedro/develop

eth.sh, build.sh and processes.json refactoring
This commit is contained in:
Marian OANCΞA 2015-04-03 19:36:18 +03:00
commit 4f5028f9d8
6 changed files with 56 additions and 39 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

@ -2,6 +2,7 @@ var web3 = require('ethereum.js');
var _ = require('lodash');
var os = require('os');
var shelljs = require('shelljs');
var debounce = require('debounce');
var Primus = require('primus'),
Emitter = require('primus-emit'),
@ -380,13 +381,17 @@ Node.prototype.setWatches = function()
this.pendingFilter = web3.eth.filter('pending');
this.pendingFilter.watch( function(log) {
if(PENDING_WORKS) {
self.update();
debounce(function() {
self.update();
}, 50);
}
});
this.chainFilter = web3.eth.filter('latest');
this.chainFilter.watch(function(log) {
self.update();
debounce(function() {
self.update();
}, 50);
});
this.updateInterval = setInterval(function(){

View File

@ -8,6 +8,7 @@
"lib": "./lib"
},
"dependencies": {
"debounce": "^1.0.0",
"debug": "~2.1.3",
"ethereum.js": "0.2.4",
"lodash": "^3.6.0",

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":
{