commit
7f98c0ce26
21
app.json
Normal file
21
app.json
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"name" : "node-app",
|
||||
"cwd" : "/home/ubuntu/bin/www/",
|
||||
"script" : "app.js",
|
||||
"log_date_format" : "YYYY-MM-DD HH:mm Z",
|
||||
"merge_logs" : false,
|
||||
"watch" : false,
|
||||
"exec_interpreter" : "node",
|
||||
"exec_mode" : "fork_mode",
|
||||
"env":
|
||||
{
|
||||
"NODE_ENV" : "production",
|
||||
"RPC_HOST" : "localhost",
|
||||
"RPC_PORT" : "8080",
|
||||
"INSTANCE_NAME" : "",
|
||||
"WS_SERVER" : "wss://eth-netstats.herokuapp.com",
|
||||
"WS_SECRET" : "eth-net-stats-has-a-secret",
|
||||
}
|
||||
}
|
||||
]
|
34
bin/build.sh
Normal file → Executable file
34
bin/build.sh
Normal file → Executable file
@ -1,6 +1,32 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
echo "You're about to install ethereum. Please choose one of the following:"
|
||||
# setup colors
|
||||
red=`tput setaf 1`
|
||||
green=`tput setaf 2`
|
||||
cyan=`tput setaf 6`
|
||||
bold=`tput bold`
|
||||
reset=`tput sgr0`
|
||||
|
||||
heading()
|
||||
{
|
||||
echo
|
||||
echo "${cyan}==>${reset}${bold} $1${reset}"
|
||||
}
|
||||
|
||||
success()
|
||||
{
|
||||
echo
|
||||
echo "${green}==>${bold} $1${reset}"
|
||||
}
|
||||
|
||||
error()
|
||||
{
|
||||
echo
|
||||
echo "${red}==>${bold} Error: $1${reset}"
|
||||
}
|
||||
|
||||
heading "You're about to install ethereum."
|
||||
echo "Please choose one of the following:"
|
||||
echo "1. eth"
|
||||
echo "2. geth"
|
||||
while true; do
|
||||
@ -12,7 +38,7 @@ while true; do
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Installing" $ethtype
|
||||
heading "Installing" $ethtype
|
||||
|
||||
cd ~
|
||||
|
||||
@ -52,7 +78,7 @@ cd ~/bin
|
||||
cd www
|
||||
git pull
|
||||
|
||||
[[ ! -f ~/bin/processes.json ]] && cp -b ./processes.json ./..
|
||||
[[ ! -f ~/bin/processes.json ]] && cp -b ./processes-ec2.json ./../processes.json
|
||||
|
||||
npm install
|
||||
sudo npm install pm2 -g
|
||||
|
0
bin/eth.sh
Normal file → Executable file
0
bin/eth.sh
Normal file → Executable file
71
bin/update.sh
Executable file
71
bin/update.sh
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
# setup colors
|
||||
red=`tput setaf 1`
|
||||
green=`tput setaf 2`
|
||||
cyan=`tput setaf 6`
|
||||
bold=`tput bold`
|
||||
reset=`tput sgr0`
|
||||
|
||||
heading()
|
||||
{
|
||||
echo
|
||||
echo "${cyan}==>${reset}${bold} $1${reset}"
|
||||
}
|
||||
|
||||
success()
|
||||
{
|
||||
echo
|
||||
echo "${green}==>${bold} $1${reset}"
|
||||
}
|
||||
|
||||
error()
|
||||
{
|
||||
echo
|
||||
echo "${red}==>${bold} Error: $1${reset}"
|
||||
}
|
||||
|
||||
heading "Updating ethereum"
|
||||
|
||||
# figure out what we have to update
|
||||
if [[ -f /usr/bin/geth ]];
|
||||
then
|
||||
ethtype="geth"
|
||||
success "Found geth"
|
||||
else
|
||||
if [[ -f /usr/bin/geth ]];
|
||||
then
|
||||
ethtype="eth"
|
||||
success "Found eth"
|
||||
else
|
||||
error "Couldn't find ethereum"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
heading "Stopping processes"
|
||||
pm2 kill
|
||||
|
||||
heading "Removing ethereum"
|
||||
sudo apt-get remove $eth -y
|
||||
|
||||
heading "Updating repos"
|
||||
sudo apt-get clean
|
||||
sudo add-apt-repository -y ppa:ethereum/ethereum
|
||||
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
|
||||
sudo apt-get update -y
|
||||
sudo apt-get upgrade -y
|
||||
|
||||
heading "Installing ethereum"
|
||||
sudo apt-get install -y $eth
|
||||
|
||||
heading "Updating eth-netstats client"
|
||||
cd ~/bin/www
|
||||
git pull
|
||||
sudo npm update
|
||||
cd ..
|
||||
|
||||
success "Ethereum was updated successfully"
|
||||
|
||||
heading "Restarting processes"
|
||||
pm2 start processes.json
|
@ -112,7 +112,7 @@ function Node()
|
||||
console.warn('We are scheduling a reconnect operation', opts);
|
||||
})
|
||||
.on('node-pong', function(data) {
|
||||
var latency = (new Date()).getTime() - self._latency;
|
||||
var latency = Math.ceil(((new Date()).getTime() - self._latency)/2);
|
||||
socket.emit('latency', { id: self.id, latency: latency });
|
||||
})
|
||||
.on('data', function incoming(data) {
|
||||
@ -346,7 +346,7 @@ Node.prototype.getStats = function()
|
||||
}
|
||||
|
||||
this.stats.mining = web3.eth.mining;
|
||||
this.stats.gasPrice = web3.eth.gasPrice.toString(10);
|
||||
this.stats.gasPrice = web3.toBigNumber(web3.eth.gasPrice).toString(10);
|
||||
this.stats.listening = web3.net.listening;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user