cleanup, refactoring
This commit is contained in:
parent
a79210c510
commit
f201991044
14
Dockerfile
14
Dockerfile
@ -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"]
|
|
20
README.md
20
README.md
@ -1,20 +1,8 @@
|
|||||||
eth-netstatsservice
|
Ethereum Network Intelligence API
|
||||||
============
|
============
|
||||||
|
|
||||||
Ethereum Network Stats Service
|
Deploy on AWS, install dependencies, build eth, clone eth-netstatsservice and run as services forever
|
||||||
|
|
||||||
To run via Docker
|
|
||||||
|
|
||||||
create a docker image via
|
|
||||||
|
|
||||||
```
|
```
|
||||||
docker build --tag="eth-netstatsservice" path/to/eth-netstatsservice-repo
|
curl https://raw.githubusercontent.com/cubedro/eth-netstatsservice/master/bin/build.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
run it via
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run --publish=3000:3000 eth-netstatsservice
|
|
||||||
```
|
|
||||||
|
|
||||||
see the interface at http://localhost:3000
|
|
15
app.js
15
app.js
@ -1,17 +1,4 @@
|
|||||||
var express = require('express.io');
|
|
||||||
var path = require('path');
|
|
||||||
var fs = require('fs');
|
|
||||||
var nodeModel = require('./lib/node');
|
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);
|
var node = new nodeModel(config);
|
||||||
|
|
||||||
@ -36,4 +23,4 @@ process.on('SIGTERM', gracefulShutdown);
|
|||||||
process.on('SIGINT', gracefulShutdown);
|
process.on('SIGINT', gracefulShutdown);
|
||||||
|
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = node;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
|
||||||
# let's install packages
|
# let's install packages
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get upgrade
|
sudo apt-get upgrade
|
3
bin/www
3
bin/www
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
var debug = require('debug')('eth-netstatsservice');
|
|
||||||
var app = require('../app');
|
|
@ -1,8 +0,0 @@
|
|||||||
var config = {
|
|
||||||
name: 'Node',
|
|
||||||
type: 'C++',
|
|
||||||
serverHost: 'http://localhost',
|
|
||||||
serverPort: '3000'
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
34
package.json
34
package.json
@ -1,9 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "eth-netstatsservice",
|
"name": "eth-netstatsservice",
|
||||||
|
"description": "Ethereum Network Intelligence API",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"main": "./app.js",
|
||||||
"start": "node ./bin/www"
|
"directories": {
|
||||||
|
"lib": "./lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "~2.0.0",
|
"debug": "~2.0.0",
|
||||||
@ -12,5 +14,31 @@
|
|||||||
"socket.io-client": "^1.3.3",
|
"socket.io-client": "^1.3.3",
|
||||||
"underscore": "^1.7.0",
|
"underscore": "^1.7.0",
|
||||||
"xmlhttprequest": "*"
|
"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"
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
{
|
{
|
||||||
"name" : "eth",
|
"name" : "eth",
|
||||||
"script" : "./bin/eth",
|
"script" : "./bin/eth",
|
||||||
"log_file" : "/logs/eth-log.log",
|
"log_file" : "/home/ubuntu/logs/eth-log.log",
|
||||||
"out_file" : "/logs/eth-out.log",
|
"out_file" : "/home/ubuntu/logs/eth-out.log",
|
||||||
"error_file" : "/logs/eth-err.log",
|
"error_file" : "/home/ubuntu/logs/eth-err.log",
|
||||||
"merge_logs" : true,
|
"merge_logs" : true,
|
||||||
"watch" : false,
|
"watch" : false,
|
||||||
"exec_interpreter" : "bash",
|
"exec_interpreter" : "bash",
|
||||||
@ -13,9 +13,9 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-app",
|
"name" : "node-app",
|
||||||
"script" : "./app.js",
|
"script" : "./app.js",
|
||||||
"log_file" : "/logs/node-app-log.log",
|
"log_file" : "/home/ubuntu/logs/node-app-log.log",
|
||||||
"error_file" : "/logs/node-app-err.log",
|
"out_file" : "/home/ubuntu/logs/node-app-out.log",
|
||||||
"out_file" : "/logs/node-app-out.log",
|
"error_file" : "/home/ubuntu/logs/node-app-err.log",
|
||||||
"merge_logs" : true,
|
"merge_logs" : true,
|
||||||
"watch" : false,
|
"watch" : false,
|
||||||
"exec_interpreter" : "node",
|
"exec_interpreter" : "node",
|
||||||
@ -26,7 +26,7 @@
|
|||||||
"RPC_HOST" : "localhost",
|
"RPC_HOST" : "localhost",
|
||||||
"RPC_PORT" : "8080",
|
"RPC_PORT" : "8080",
|
||||||
"ETH_CLIENT" : "",
|
"ETH_CLIENT" : "",
|
||||||
"ETH_CLIENT" : "8080",
|
"ETH_TYPE" : "C++ 0.8.1",
|
||||||
"SOCKET_SERVER" : "wss://eth-netstats.herokuapp.com/socket.io/",
|
"SOCKET_SERVER" : "wss://eth-netstats.herokuapp.com/socket.io/",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user