Skip to content

Commit

Permalink
Merge pull request #525 from Hurence/feature/LOGISLAND-513-historian-…
Browse files Browse the repository at this point in the history
…gateway

Feature/logisland 513 historian gateway
  • Loading branch information
oalam authored Nov 28, 2019
2 parents 0e1929d + 858317c commit aae8286
Show file tree
Hide file tree
Showing 440 changed files with 17,477 additions and 20,596 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ before_install:
# - sudo mv docker-compose /usr/local/bin
# # Print out the current docker-compose version.
# - docker-compose --version
- rm -rf sudo /home/travis/.m2/repository/org/apache/lucene/lucene-highlighter/6.6.2/*

script:
# Build
Expand Down
1 change: 1 addition & 0 deletions logisland-assembly/src/assembly/shared-dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<include>com.hurence.logisland:logisland-plugin-support</include>
<include>com.hurence.logisland:logisland-scripting-base</include>
<include>com.hurence.logisland:logisland-scripting-mvel</include>
<include>com.hurence.logisland:logisland-timeseries</include>
</includes>
<binaries>
<directoryMode>0770</directoryMode>
Expand Down
67 changes: 67 additions & 0 deletions logisland-components/logisland-gateway-historian/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#Build historian gateway

run :
```shell script
mvn clean install
```

require some other logisland module, if it fails try this :

```shell script
mvn -pl :logisland-gateway-historian -am clean install -DskipTests
```

#Run server on local

run :
```shell script
java -jar target/logisland-gateway-historian-1.2.0-fat.jar -conf target/classes/config.json
```

#Run server with docker-compose

in logisland-quickstart project you can run a pipeline that injects data into solr.
You have access to solr UI, a grafana with a predefined historian dashboard.

in root folder of projct **logisland-quickstart** run :

```shell script
docker-compose -f docker-compose.yml -f docker-compose.historian.yml up -d
```

then follow the timeseries tutorial to inject timeseries : https://logisland.github.io/docs/guides/timeseries-guide

Go to grafana at http://localhost:3000.
* user: admin
* mdp: admin.

Go to the historian dashboard and see your data ! We added three variables so that you can specify
the sampling algorithm to use, the bucket size or filter on a tag. Currently tags are just the name of the metric but we could
imagine tagging several different metric names with a same tag. For exemple 'temp' for metrics 'temp_a' and 'temp_b'.

By default no sampling is used if there is not too many point to draw. Otherwise we calculate the bucket size depending on
the total number of points that is being queried with the average algorithm. At the moment only basic algorithms are available.

#Run server on cluster

TODO
```shell script
java -jar <jar_path> -cluster -conf <conf_path>
```

#RUN TEST
mark the folder ./src/integration-test/java as source test code in your IDE.
mark the folder ./src/integration-test/resources as resources test in your IDE.

Then run :
```shell script
mvn clean install -Pbuild-integration-tests
```

to build integration tests source class ! Then you can run the test in your IDE.


#TROUBLESHOOT

When code generator fails. It may be because of hidden char ? This is really irritating.
I fought with javadoc... Sometimes I could not succeed into making it working.
12 changes: 12 additions & 0 deletions logisland-components/logisland-gateway-historian/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM vertx/vertx3

ENV HISTORIAN_HOME /opt/historian/
EXPOSE 8080

COPY ./logisland-gateway-historian-1.2.0-fat.jar $HISTORIAN_HOME
COPY ./config.json $HISTORIAN_HOME/conf/
COPY ./log4j.properties $HISTORIAN_HOME/

WORKDIR $HISTORIAN_HOME

ENTRYPOINT ["java", "-Dlog4j.configuration=file:log4j.properties", "-jar", "./logisland-gateway-historian-1.2.0-fat.jar", "-conf" , "./conf/config.json"]
49 changes: 49 additions & 0 deletions logisland-components/logisland-gateway-historian/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Historian docker files
======================

Build your own
--------------

use appropriate version of jar !

Build historian-gateway

```shell script
mvn clean package
```

copy paste jar and conf file

```shell script
cd ./docker
cp ../target/logisland-gateway-historian-1.2.0-fat.jar .
cp ../target/classes/config.json .
```

Building the image, modify version of jar in ENTRYPOINT if needed

```shell script
docker build --rm -t hurence/historian .
docker tag hurence/historian:latest hurence/historian:1.2.0
```

Deploy the image to Docker hub
------------------------------

tag the image as latest

verify image build :

```shell script
docker images
docker tag <IMAGE_ID> latest
```

then login and push the latest image

```shell script
docker login
docker push hurence/historian
````


Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"web.verticles.instance.number": 2,
"historian.verticles.instance.number": 1,
"server" : {
"host": "0.0.0.0",
"port" : 8080,
"historian.address": "historian",
"default" : {
"page" : 1,
"size" : 10
}
},
"historian": {
"address" : "historian",
"solr" : {
"use_zookeeper": true,
"zookeeper_urls": ["zookeeper:2181"],
"collection": "historian",
"stream_url": "http://solr1:8983/solr/historian/stream",
"urls": ["http://solr1:8983/solr","http://solr2:8983/solr"]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This sets the global logging level and specifies the appenders
log4j.rootLogger=INFO, theConsoleAppender, rollingFile

# settings for the console appender
log4j.appender.theConsoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.theConsoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.theConsoleAppender.layout.ConversionPattern=%-4r [%t] %-5p %l - %m%n

log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingFile.File=application.log
log4j.appender.rollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.rollingFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n
log4j.appender.rollingFile.MaxFileSize=10MB
log4j.appender.rollingFile.MaxBackupIndex=5
log4j.appender.rollingFile.append=true

#log4j.rootCategory=ALL, rollingFile

#log4j.logger.org.apache.geronimo.system.logging.log4j.Log4jService=INFO
Loading

0 comments on commit aae8286

Please sign in to comment.