Skip to content

Commit f3ffdcb

Browse files
committed
Added README
1 parent 4d6b6bd commit f3ffdcb

File tree

5 files changed

+241
-5
lines changed

5 files changed

+241
-5
lines changed

README.md

Lines changed: 237 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,239 @@
11
# CarrIOTA Field
22

3-
Unofficial pre-alpha release. Please refrain from using at this moment.
3+
Carriota Field is a Proxy for your IRI, that sends regular statistics
4+
to the Field server (http://field.carriota.com) and accepts jobs from the
5+
server's load balancer (optional).
6+
7+
It is extremely tiny layer/app that does not require much resources.
8+
The idea behind Field is explained here:
9+
10+
https://medium.com/deviota/carriota-field-node-intel-and-balancing-223002156b54
11+
12+
## Table of contents
13+
14+
* [Getting Started](#getting-started)
15+
* [Prerequisites](#prerequisites)
16+
* [Installing](#installing)
17+
* [Upgrading](#upgrading)
18+
* [Running as a service](#running-as-a-service)
19+
* [Docker](#docker)
20+
* [Building Locally](#building-locally)
21+
* [Configuration](#configuration)
22+
* [config.ini](#config.ini)
23+
* [Command line options](#command-line-options)
24+
* [Options description](#options-description)
25+
* [FAQ](#faq)
26+
* [Contributing](#contributing)
27+
* [Donations](#donations)
28+
* [Donate to the Nodes](#donate-to-the-nodes)
29+
* [Authors](#authors)
30+
* [License](#license)
31+
32+
## Getting Started
33+
34+
These instructions will get you a copy of the project up and running on your local machine.
35+
36+
### Prerequisites
37+
38+
It is expected that you have already installed Java, downloaded the IRI jar file
39+
and know how to start it. The local IRI instance must have api enabled and accepting local connections.
40+
41+
Field is running on Node.js You will have to install **node (at least version LTS 8.9.4)** and *npm* (node package manager) on your system.
42+
Alternatively to npm you can (and should) use yarn package manager.
43+
44+
#### Port Forwarding
45+
46+
If you are trying to run a Field node at home, you may need to open some ports (port forwarding) in your NAT Router,
47+
apart of the ports for your IRI:
48+
49+
* **TCP 21310**
50+
51+
Please refer to your Router's manual on how to do that.
52+
53+
Furthermore, please be aware that apart of firewall and port-forwarding in router, your Internet provider may also be an issue.
54+
Some providers (like Vodafone in Germany) do not have enough IPv4 addresses for homes and
55+
thus use something called "**IPv4 over DS Lite**". In those cases the **traffic will not come through** over the ports
56+
mentioned above. Unfortunately, there is no quick fix for this issue (maybe changing providers).
57+
There is some hope with the upcoming PCP-protocol, this will not happen this year (2018) for most providers, though.
58+
59+
#### WARNING FOR UBUNTU
60+
61+
Ubuntu 16.04 apt comes with an **outdated Node version (4.X)**. You need to install the latest version separately:
62+
63+
https://nodejs.org/en/download/package-manager/
64+
65+
### Installing
66+
67+
Globally install Field
68+
69+
```
70+
npm install -g field.cli
71+
```
72+
73+
And run it
74+
75+
```
76+
field --pow --address SOZAIPJMQUBOFCTDTJJDXCZEKNIYZGIGVDLFMH9FFBAYK9SWGTBCWVUTFHXDOUESZAXRJJCJESJPIEQCCKBUTVQPOW
77+
```
78+
79+
The ```--pow``` option allows the Field server to pass "attachToTangle" jobs to your IRI.
80+
81+
With the ```--address``` option you can specify an IOTA address for donations.
82+
83+
Below is the list of all possible options.
84+
85+
### Upgrading
86+
87+
To upgrade your Field to version X.X.X, simply run:
88+
```
89+
npm install -g [email protected]
90+
```
91+
92+
**Please check where npm installs your global packages**! It happens very often that the first installed binary
93+
is put into ```/usr/local/bin``` and the updated into ```/usr/bin```. Run ```nelson --version``` after the upgrade
94+
to make sure you are using the most recent one. Update your scripts and/or services to point to the right binary!
95+
96+
### Running as a service
97+
98+
You can use the [node process manager](http://pm2.keymetrics.io/) to run Field as a service.
99+
Just do the following:
100+
```
101+
# Install the process manager:
102+
npm install pm2 -g
103+
104+
# Make pm2 start at startup:
105+
pm2 startup
106+
107+
# Start the Nelson as service
108+
# If you created a nelson config somewhere on your system, provide the path to the config:
109+
pm2 start field -- --config /path/to/field-config.ini
110+
111+
# Otherwise you can just do: pm2 start nelson
112+
113+
# Save current processes runing with pm2 to startup on boot:
114+
pm2 save
115+
116+
# Get Field logs:
117+
pm2 monit
118+
# or
119+
pm2 log
120+
```
121+
122+
## Docker
123+
124+
Provided you have docker installed, Field can be started as follows:
125+
126+
```
127+
docker run <docker opts> romansemko/field.cli <field command line opts>
128+
```
129+
130+
131+
## Building Locally
132+
133+
If you are a developer you may want to build the project locally and play around with the sources.
134+
Otherwise, ignore this section.
135+
Make sure you have [yarn](https://yarnpkg.com) package manager installed.
136+
Checkout the project:
137+
138+
```
139+
git clone https://github.com/SemkoDev/field.cli.git
140+
cd field.cli
141+
```
142+
143+
Install dependencies:
144+
145+
```
146+
yarn install --pure-lockfile
147+
```
148+
149+
Run tests and make binaries:
150+
151+
```
152+
yarn make
153+
```
154+
155+
Try to run Nelson:
156+
157+
```
158+
node ./dist/field.js --pow
159+
```
160+
161+
## Configuration
162+
163+
You are free to either use command line options or an ```.ini``` file to configure Field. If you use a config
164+
file, it has precedence and all command line options are ignored.
165+
166+
### config.ini
167+
168+
To use a configuration file, run Field with ```--config``` option:
169+
170+
```
171+
field --config ./config.ini
172+
173+
# Alternatively, set an environment variable:
174+
FIELD_CONFIG= ./config.ini nelson
175+
```
176+
177+
You can provide one or more of the following options in your ini file. Example:
178+
179+
```
180+
[field]
181+
name = MyField
182+
IRIPort = 14265
183+
IRIHostname = localhost
184+
address = SOZAIPJMQUBOFCTDTJJDXCZEKNIYZGIGVDLFMH9FFBAYK9SWGTBCWVUTFHXDOUESZAXRJJCJESJPIEQCCKBUTVQPOW
185+
; Alternatively to address, you can provide a (NEW) seed
186+
; In this case, the Field cient will be generating new, unused addresses dynamically.
187+
; seed = XYZ
188+
port = 21310
189+
pow = true
190+
disableIRI = false
191+
```
192+
193+
### Command line options
194+
195+
Command line options are named the same as INI options.
196+
Some have additional short versions.
197+
198+
### Options description
199+
200+
| Option | Description | Default |
201+
|------------------------|-----------------------------------------|---------|
202+
| --name | Name your node. This identifier will appear on the CarrIOTA Field Dashboard |CarrIOTA Field|
203+
| --address, -a | Optional IOTA address for donations. ||
204+
| --seed, -b | Optional. If no donation address is provided, you can provide a seed. In that case the field client will generate new, unused addresses dynamically. WARNING! Please do not use your usual, main seed. Generate a new one for this occasion. It is easy and adds up to everyone's security.||
205+
| --config, -c | Path to Field configuration file. ||
206+
| --disableIRI, -d | Do not allow jobs to be passed from the Field load balancer. Just send the statistics about my node. |false|
207+
| --iriHostname, -h | Hostname where your IRI instance is running. |localhost|
208+
| --iriPort, -i | API port of your IRI instance. |14265|
209+
| --port, -p | Field port to be used |21310|
210+
| --silent, -s | Do not print log messages |false|
211+
| --pow, -w | Allow attachToTangle jobs to be passed from the Field server load balancer. It only has effect when disableIRI is false. |false|
212+
213+
## Contributing
214+
215+
### Donations
216+
217+
**Donations always welcome**:
218+
219+
```
220+
SOZAIPJMQUBOFCTDTJJDXCZEKNIYZGIGVDLFMH9FFBAYK9SWGTBCWVUTFHXDOUESZAXRJJCJESJPIEQCCKBUTVQPOW
221+
```
222+
223+
224+
### Donate to the Nodes
225+
226+
We are currently working to add automatic donations to participating nodes based on the work done.
227+
This feature is still in progress, however you can already tip the nodes. Just
228+
go to http://field.carriota.com select a node, copy its donation address and
229+
show it some love!
230+
231+
232+
## Authors
233+
234+
* **Roman Semko** - *SemkoDev* - (https://github.com/romansemko)
235+
236+
## License
237+
238+
This project is licensed under the ICS License - see the [LICENSE.md](LICENSE.md) file for details
239+

dist/field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ var Field = function (_Base) {
244244
json: json
245245
}, function (err, resp, body) {
246246
if (err || resp.statusCode !== 200) {
247-
_this4.log(('Field update error to ' + _this4.opts.fieldHostname + ':').red, resp && resp.statusCode, err && err.code);
247+
_this4.log(('Field update error to ' + _this4.opts.fieldHostname + ':').red, resp && resp.statusCode, err && err.code, body);
248248
}
249249
//this.log('Update response:', body);
250250
});

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var parseNumber = function parseNumber(v) {
2424
// TODO: write README
2525
program.version(version).option('-a, --address [value]', 'Optional IOTA address for donations', null).option('-b, --seed [value]', 'Optional IOTA seed for automatic donation address generation', null).option('-c, --config [value]', 'Config file path', null).option('-d, --disableIRI [value]', 'Do not allow public IRI connections through the Field', DEFAULT_OPTIONS.disableIRI).option('-f, --fieldHostname [value]', 'Hostname of the Field endpoint', process.env.FIELD_HOSTNAME || DEFAULT_OPTIONS.fieldHostname).option('-h, --IRIHostname [value]', 'IRI API hostname', process.env.IRI_HOSTNAME || DEFAULT_OPTIONS.IRIHostname).option('-i, --IRIPort [value]', 'IRI API port', parseNumber, process.env.IRI_PORT || DEFAULT_OPTIONS.IRIPort).option('-n, --name [value]', 'Name of your node instance', DEFAULT_OPTIONS.name).option('-p, --port [value]', 'Field port', parseNumber, DEFAULT_OPTIONS.port).option('-s, --silent [value]', 'Silent', DEFAULT_BASE_OPTIONS.silent).option('-w, --pow [value]', 'Allow attachToTange / PoW', DEFAULT_OPTIONS.pow).parse(process.argv);
2626

27-
var configPath = process.env.NELSON_CONFIG || program.config;
27+
var configPath = process.env.FIELD_CONFIG || program.config;
2828

2929
var field = new Field(configPath ? ini.parse(fs.readFileSync(configPath, 'utf-8')).field : program);
3030

src/field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class Field extends Base {
200200
json
201201
}, (err, resp, body) => {
202202
if (err || resp.statusCode !== 200) {
203-
this.log(`Field update error to ${this.opts.fieldHostname}:`.red, resp && resp.statusCode, err && err.code);
203+
this.log(`Field update error to ${this.opts.fieldHostname}:`.red, resp && resp.statusCode, err && err.code, body);
204204
}
205205
//this.log('Update response:', body);
206206
})

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ program
2727
.option('-w, --pow [value]', 'Allow attachToTange / PoW', DEFAULT_OPTIONS.pow)
2828
.parse(process.argv);
2929

30-
const configPath = process.env.NELSON_CONFIG || program.config;
30+
const configPath = process.env.FIELD_CONFIG || program.config;
3131

3232
const field = new Field(configPath ? ini.parse(fs.readFileSync(configPath, 'utf-8')).field : program);
3333

0 commit comments

Comments
 (0)