cleanup, refactoring

This commit is contained in:
cubedro 2015-02-13 00:30:12 +02:00
parent a79210c510
commit f201991044
9 changed files with 45 additions and 66 deletions

View File

@ -1,14 +0,0 @@
FROM centos:centos6
# Enable EPEL for Node.js
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install Node.js and npm
RUN yum install -y npm
# Bundle app source
COPY . /src
# Install app dependencies
RUN cd /src; npm install
EXPOSE 3000
CMD ["node", "/src/bin/www"]

View File

@ -1 +0,0 @@
web: node ./bin/www

View File

@ -1,20 +1,8 @@
eth-netstatsservice
Ethereum Network Intelligence API
============
Ethereum Network Stats Service
To run via Docker
create a docker image via
Deploy on AWS, install dependencies, build eth, clone eth-netstatsservice and run as services forever
```
docker build --tag="eth-netstatsservice" path/to/eth-netstatsservice-repo
```
run it via
```
docker run --publish=3000:3000 eth-netstatsservice
```
see the interface at http://localhost:3000
curl https://raw.githubusercontent.com/cubedro/eth-netstatsservice/master/bin/build.sh | sh
```

15
app.js
View File

@ -1,17 +1,4 @@
var express = require('express.io');
var path = require('path');
var fs = require('fs');
var nodeModel = require('./lib/node');
var config;
var app = express();
app.io();
if(fs.existsSync('./config.js')){
config = require('./config');
} else {
config = require('./config.default');
}
var node = new nodeModel(config);
@ -36,4 +23,4 @@ process.on('SIGTERM', gracefulShutdown);
process.on('SIGINT', gracefulShutdown);
module.exports = app;
module.exports = node;

View File

@ -1,5 +1,7 @@
#!/bin/sh
cd ~
# let's install packages
sudo apt-get update
sudo apt-get upgrade

View File

@ -1,3 +0,0 @@
#!/usr/bin/env node
var debug = require('debug')('eth-netstatsservice');
var app = require('../app');

View File

@ -1,8 +0,0 @@
var config = {
name: 'Node',
type: 'C++',
serverHost: 'http://localhost',
serverPort: '3000'
};
module.exports = config;

View File

@ -1,9 +1,11 @@
{
"name": "eth-netstatsservice",
"description": "Ethereum Network Intelligence API",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node ./bin/www"
"main": "./app.js",
"directories": {
"lib": "./lib"
},
"dependencies": {
"debug": "~2.0.0",
@ -12,5 +14,31 @@
"socket.io-client": "^1.3.3",
"underscore": "^1.7.0",
"xmlhttprequest": "*"
}
},
"scripts": {
"start": "node ./app.js"
},
"repository": {
"type": "git",
"url": "https://github.com/cubedro/eth-netstatsservice.git"
},
"homepage": "https://github.com/cubedro/eth-netstatsservice",
"bugs": {
"url": "https://github.com/cubedro/eth-netstatsservice/issues"
},
"keywords": [
"ethereum",
"network",
"intelligence",
"API"
],
"author": "ethdev.com",
"authors": [
{
"name": "Marian Oancea",
"email": "marian@ethdev.com",
"url": "https://github.com/cubedro"
}
],
"license": "LGPL-3.0"
}

View File

@ -2,9 +2,9 @@
{
"name" : "eth",
"script" : "./bin/eth",
"log_file" : "/logs/eth-log.log",
"out_file" : "/logs/eth-out.log",
"error_file" : "/logs/eth-err.log",
"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" : true,
"watch" : false,
"exec_interpreter" : "bash",
@ -13,9 +13,9 @@
{
"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",
"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" : true,
"watch" : false,
"exec_interpreter" : "node",
@ -26,7 +26,7 @@
"RPC_HOST" : "localhost",
"RPC_PORT" : "8080",
"ETH_CLIENT" : "",
"ETH_CLIENT" : "8080",
"ETH_TYPE" : "C++ 0.8.1",
"SOCKET_SERVER" : "wss://eth-netstats.herokuapp.com/socket.io/",
}
}