Skip to content

Commit

Permalink
Merge pull request #1 from encircle360/features/new-configuration-system
Browse files Browse the repository at this point in the history
Features/new configuration system
  • Loading branch information
PatrickHuetter authored Dec 6, 2017
2 parents 01ad3d6 + 0a36666 commit 52f6922
Show file tree
Hide file tree
Showing 7 changed files with 598 additions and 667 deletions.
37 changes: 37 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
image: docker:dind
services:
- docker:dind

variables:
DOCKER_DRIVER: overlay

stages:
- build
- package
- docs

maven-build:
image: maven:3.5-jdk-8
stage: build
script: "mvn clean package"
artifacts:
paths:
- target/*.jar

docker-build:
stage: package
only:
- master
script:
- docker build -t $CI_REGISTRY_IMAGE .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE

docker-build-dev:
stage: package
only:
- dev
script:
- docker build -t $CI_REGISTRY_IMAGE:dev .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE:dev
22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM maven:3.5-jdk-8 as builder
WORKDIR /iri
COPY . /iri
RUN mvn clean package

FROM openjdk:jre-slim
WORKDIR /iri
COPY --from=builder /iri/target/iri-1.4.1.2.jar iri.jar
COPY logback.xml /iri
FROM openjdk:8u111-jdk-alpine
VOLUME /tmp
VOLUME /iri

ADD logback.xml /iri
ADD /target/iri-*.jar iri.jar
EXPOSE 14265
EXPOSE 14777/udp
EXPOSE 15777
ENV _JAVA_OPTIONS="-Xms256m -Xmx8g"
ENV REMOTE=true
ENV REMOTE_LIMIT_API="addNeighbors, removeNeighbors, getNeighbors"
ENV PORT=14265
ENV UDP_RECEIVER_PORT=14777
ENV TCP_RECEIVER_PORT=15777

CMD ["/usr/bin/java", "-XX:+DisableAttachMechanism", "-Xmx8g", "-Xms256m", "-Dlogback.configurationFile=/iri/conf/logback.xml", "-Djava.net.preferIPv4Stack=true", "-jar", "iri.jar", "-p", "14265", "-u", "14777", "-t", "15777", "--remote", "--remote-limit-api", "\"addNeighbors, removeNeighbors, getNeighbors\"", "$@"]
ENTRYPOINT ["java", "-XX:+DisableAttachMechanism", "-Dlogback.configurationFile=/iri/conf/logback.xml", "-Djava.net.preferIPv4Stack=true", "-jar", "iri.jar"]
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,44 @@ This will create a `target` directory in which you will find the executable jar
Running IRI is pretty simple, and you don't even have to run it under admin rights. Below is a list of command line options. Here is an example script:

```
java -jar iri.jar -p 14265
java -DPORT=14265 -jar iri.jar
```

### Docker

Create an iota.ini file with all of your configuration variables set in it.
Create an application.conf file with all of your configuration variables set in it.
Any that you don't provide in here will be assumed to be default or taken from
command line arguments.
environment variables. You can find some of the possible environment variables in the next section.

`docker run -d --net=host --name iota-node -p 14265:14265 -p 14777:14777/udp -p 15777:15777 -v iota.ini:/iri/iota.ini iotaledger/iri:latest`
Example:

`docker run -d --net=host --name iota-node -e TESTNET=true -p 14265:14265 -p 14777:14777/udp -p 15777:15777 -v application.conf:/iri/application.conf iotaledger/iri:latest`

### Command Line Options

Option | Shortened version | Description | Example Input
--- | --- | --- | ---
`--port` | `-p` | This is a *mandatory* option that defines the port to be used to send API commands to your node | `-p 14800`
`--neighbors` | `-n` | Neighbors that you are connected with will be added via this option. | `-n "udp://148.148.148.148:14265 udp://[2001:db8:a0b:12f0::1]:14265"`
`--config` | `-c` | Config INI file that can be used instead of CLI options. See more below | `-c iri.ini`
`--udp-receiver-port` | `-u` | UDP receiver port | `-u 14800`
`--tcp-receiver-port` | `-t` | TCP receiver port | `-t 14800`
`--testnet` | | Makes it possible to run IRI with the IOTA testnet | `--testnet`
`--remote` | | Remotely access your node and send API commands | `--remote`
`--remote-auth` | | Require authentication password for accessing remotely. Requires a correct `username:hashedpassword` combination | `--remote-auth iotatoken:LL9EZFNCHZCMLJLVUBCKJSWKFEXNYRHHMYS9XQLUZRDEKUUDOCMBMRBWJEMEDDXSDPHIGQULENCRVEYMO`
`--remote-limit-api` | | Exclude certain API calls from being able to be accessed remotely | `--remote-limit-api "attachToTangle, addNeighbors"`
`--send-limit`| | Limit the outbound bandwidth consumption. Limit is set to mbit/s | `--send-limit 1.0`
`--max-peers` | | Limit the number of max accepted peers. Default is set to 0 (mutual tethering) | `--max-peers 8`

### INI File

You can also provide an ini file to store all of your command line options and easily update (especially neighbors) if needed. You can enable it via the `--config` flag. Here is an example INI file:
All configuration variables can be set by java property, as system environment variable or via configuration file.

Java system property | Description | Example Input
--- | --- | ---
`-DPORT` | This is a *mandatory* option that defines the port to be used to send API commands to your node | `-DPORT=14800`
`-DNEIGHBOURS` | Neighbors that you are connected with will be added via this option. | `-DNEIGHBOURS="udp://148.148.148.148:14265 udp://[2001:db8:a0b:12f0::1]:14265"`
`-Dconfig.file` | Config .conf file that can be used instead of CLI options. See more below | `-Dconfig.file=application.conf`
`-DUDP_RECEIVER_PORT` | UDP receiver port | `-DUDP_RECEIVER_PORT=14800`
`-DTCP_RECEIVER_PORT` | TCP receiver port | `-DTCP_RECEIVER_PORT=14800`
`-DTESTNET` | Makes it possible to run IRI with the IOTA testnet | `-DTESTNET=true`
`-DREMOTE` | Remotely access your node and send API commands | `-DREMOTE=true`
`-DREMOTE_AUTH` | Require authentication password for accessing remotely. Requires a correct `username:hashedpassword` combination | `-DREMOTE_AUTH="iotatoken:LL9EZFNCHZCMLJLVUBCKJSWKFEXNYRHHMYS9XQLUZRDEKUUDOCMBMRBWJEMEDDXSDPHIGQULENCRVEYMO"`
`-DREMOTE_LIMIT_API` | Exclude certain API calls from being able to be accessed remotely | `-DREMOTE_LIMIT_API="attachToTangle, addNeighbors"`
`-DSEND_LIMIT`| Limit the outbound bandwidth consumption. Limit is set to mbit/s | `-DSEND_LIMIT=1.0`
`-DMAX_PEERS` | Limit the number of max accepted peers. Default is set to 0 (mutual tethering) | `-DMAX_PEERS=8`

### CONF File

You can also provide a conf file to store all of your command line options and easily update (especially neighbors) if needed. You can enable it via the `-Dconfig.file=/path/to/config.conf` flag. Here is an example CONF file:
```
[IRI]
PORT = 14700
UDP_RECEIVER_PORT = 14700
NEIGHBORS = udp://my.favorite.com:15600
NEIGHBORS = "udp://my.favorite.com:15600"
IXI_DIR = ixi
HEADLESS = true
DEBUG = true
Expand Down
Loading

0 comments on commit 52f6922

Please sign in to comment.