added aws file

This commit is contained in:
cubedro 2015-02-12 23:59:01 +02:00
parent c500f4e069
commit a79210c510
5 changed files with 106 additions and 6 deletions

3
bin/eth Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
trap "exit" INT
/home/ubuntu/bin/eth -b -x 15 -l 30303 -r poc-8.ethdev.com -p 30303 -m off -j

View File

@ -7,13 +7,12 @@ var HttpRequest = require('xmlhttprequest').XMLHttpRequest;
var MAX_BLOCKS_HISTORY = 12,
LOWEST_TIMESTAMP = 0;
function Node(options)
function Node()
{
this.options = options;
this.info = {
ip: getExternalIp(),
name: options.name,
type: options.type,
name: process.env.ETH_CLIENT,
type: process.env.ETH_TYPE,
os: os.platform(),
os_v: os.release()
};
@ -43,7 +42,7 @@ function Node(options)
this.updateInterval = false;
web3.setProvider(new web3.providers.HttpSyncProvider('http://' + (process.env.RPC_HOST || 'localhost') + ':' + (process.env.RPC_PORT || '8080')));
this.socket = require('socket.io-client')((process.env.SOCKET_SERVER || options.serverHost) + ':' + (process.env.SOCKET_PORT || options.serverPort));
this.socket = require('socket.io-client')(process.env.SOCKET_SERVER || 'wss://localhost/socket.io/');
this.init();

View File

@ -8,7 +8,6 @@
"dependencies": {
"debug": "~2.0.0",
"ethereum.js": "*",
"express.io": "^1.1.13",
"slugs": "^0.1.3",
"socket.io-client": "^1.3.3",
"underscore": "^1.7.0",

33
processes.json Normal file
View File

@ -0,0 +1,33 @@
[
{
"name" : "eth",
"script" : "./bin/eth",
"log_file" : "/logs/eth-log.log",
"out_file" : "/logs/eth-out.log",
"error_file" : "/logs/eth-err.log",
"merge_logs" : true,
"watch" : false,
"exec_interpreter" : "bash",
"exec_mode" : "fork_mode"
},
{
"name" : "node-app",
"script" : "./app.js",
"log_file" : "/logs/node-app-log.log",
"error_file" : "/logs/node-app-err.log",
"out_file" : "/logs/node-app-out.log",
"merge_logs" : true,
"watch" : false,
"exec_interpreter" : "node",
"exec_mode" : "cluster_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "localhost",
"RPC_PORT" : "8080",
"ETH_CLIENT" : "",
"ETH_CLIENT" : "8080",
"SOCKET_SERVER" : "wss://eth-netstats.herokuapp.com/socket.io/",
}
}
]

66
provision.sh Normal file
View File

@ -0,0 +1,66 @@
#!/bin/sh
# let's install packages
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev libjsoncpp-dev libargtable2-dev nodejs npm
# Setup Ethereum repos
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install libcryptopp-dev libjson-rpc-cpp-dev
# add node symlink
sudo ln -s /usr/bin/nodejs /usr/bin/node
# create directories structure
[ ! -d "ethereum" ] && mkdir ethereum # ethereum dir maybe mapped from host machine
mkdir opt
mkdir bin
mkdir logs
# download cpp-ethereum if needed
cd ethereum
[ ! -d "cpp-ethereum" ] && git clone --depth=1 --branch develop https://github.com/ethereum/cpp-ethereum
# download and build ethereum's dependencies
cd ~/opt
if [ ! -d "cryptopp562" ]; then
mkdir cryptopp562
cd cryptopp562
wget http://www.cryptopp.com/cryptopp562.zip
unzip cryptopp562.zip
CXX="g++ -fPIC" make
make dynamic
sudo make install
fi
# build ethereum
cd ~/opt
mkdir cpp-ethereum-build
cd cpp-ethereum-build
cmake ~/ethereum/cpp-ethereum -DCMAKE_BUILD_TYPE=Debug
make
# build alethzero GUI client
mkdir alethzero
cd alethzero
qmake ~/ethereum/cpp-ethereum/alethzero
make
# now let's create bin folder in user's home dir and create symlinks to executables
cd ~
ln -s ~/opt/cpp-ethereum-build/alethzero/alethzero ~/bin/alethzero
ln -s ~/opt/cpp-ethereum-build/eth/eth ~/bin/eth
# add node service
cd ~/bin
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-netstatsservice www
cd www
sudo npm install pm2 -g
sudo npm install
pm2 start processes.json
pm2 startup ubuntu
pm3 save