Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Marziali committed Nov 2, 2018
2 parents 556e5f1 + a3f3c0e commit efe237e
Show file tree
Hide file tree
Showing 194 changed files with 10,482 additions and 1,940 deletions.
24 changes: 24 additions & 0 deletions historian/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,28 @@ If this does not work you may have to rebuild

./mvnw clean install

# User interface

## Import of csv tag

You can import tag definition using the web ui by providing a
csv file.

Here below, the exhaustive list of supported columns.


| CSV HEADER | node_id | sampling_rate | read_mode | tag_monitored | description | type | server_scan_rate | group | datasource_id | tag_name |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| REQUIRED | true | true | false | true | false | true | false | false | true | false |
| TYPE | string | integer | enum:[polling, subscribe] | boolean | string | enum:[int, long, float, double, string, array, bytes, boolean] | integer | string | string | string |
| DESCRIPTION | Corresponds to id in opc server. | The sampling rate in milliseconds | When polling is used, the information is stored at fixed rate. When subscribe is used, the data is stored only if a change is detected. | If true, the tag will be monitored and its data will be stored. | A user friendly tag description | The tag type. At the moment only double is supported | The server side scan rate (informative) | The logical group the tag belongs to. Used to group tags in folders. | The id of the datasource the tag is defined. The datasource must already have been created before. | The user friendly tag name |

An example:

<pre>
description;sampling_rate;read_mode;node_id;tag_monitored;datasource_id;type
First tag;1000;polling;Sinusoid.PsFloat1;true;Prosys;double
Second tag;1000;subscribe;Random.PsFloat1;true;Prosys;double
</pre>

33 changes: 19 additions & 14 deletions historian/backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
<name>data-historian-backend</name>
<description>Operational data Historian backend from the Logisland Suite</description>
<properties>
<scala.version>2.11.8</scala.version>
<scala.binary.version>2.11</scala.binary.version>
<org.springframework.boot.version>2.0.3.RELEASE</org.springframework.boot.version>
</properties>

<parent>
<groupId>com.hurence.logisland</groupId>
<artifactId>historian</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>

<dependencies>
Expand Down Expand Up @@ -184,8 +182,7 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>${scala.version}</version>
<scope>compile</scope>
<version>[2.11.12,)</version>
</dependency>


Expand All @@ -200,7 +197,19 @@
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>

<!--CSV PARSING-->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.8.8</version>
</dependency>

</dependencies>

Expand Down Expand Up @@ -234,17 +243,10 @@
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven-plugin-spotify.version}</version>
<!-- Include:
export DOCKER_HOST=tcp://docker:4243
in host executing mvn docker:build
-->

<configuration>
<!-- One or the other -->
<!-- First add server entry in settings.xml -->
<serverId>docker-hub</serverId>
<!-- Uses ~/.docker/config.json created once logged in using "docker login" command -->
<!-- <useConfigFile>true</useConfigFile> -->

<serverId>docker-hub</serverId>
<imageName>${docker.image.prefix}/${project.artifactId}:${project.version}</imageName>
<pushImage>${push.image}</pushImage>
<forceTags>true</forceTags>
Expand All @@ -253,6 +255,9 @@
<imageTag>latest</imageTag>
</imageTags>
<dockerDirectory>src/main/docker</dockerDirectory>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<resources>
<resource>
<targetPath>/</targetPath>
Expand Down
36 changes: 4 additions & 32 deletions historian/backend/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
#FROM azul/zulu-openjdk:8
FROM anapsix/alpine-java
FROM openjdk:8-jdk-alpine
MAINTAINER hurence <[email protected]>, http://www.hurence.com

VOLUME /tmp

# Update Ubuntu
#RUN \
# bash -c 'apt-get -qq update && apt-get -y upgrade && apt-get -y autoclean && apt-get -y autoremove' && \
# bash -c 'DEBIAN_FRONTEND=noninteractive apt-get install -y curl wget tar'
ARG JAR_FILE
COPY ${JAR_FILE} app.jar

RUN apk add --update unzip wget curl docker jq coreutils procps vim tar

ENV APP_JAR historian-backend-1.0.0.jar
ENV USER_NAME logisland
ENV APP_HOME /opt/$USER_NAME

#RUN \
# useradd -ms /bin/bash $USER_NAME && \
# mkdir -p $APP_HOME
RUN mkdir -p $APP_HOME

ADD ${APP_JAR} ${APP_HOME}/${APP_JAR}
#RUN \
# chown $USER_NAME $APP_HOME/${APP_JAR} && \
RUN bash -c 'touch ${APP_HOME}/${APP_JAR}'

RUN ls ${APP_HOME}/${APP_JAR}

ENV JAVA_TOOL_OPTIONS "-Xms1G -Xmx1G -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"

#USER $USER_NAME
WORKDIR $APP_HOME
ENTRYPOINT ["java", "-jar", "historian-backend-1.0.0.jar"]

# Run as:
# docker run -idt -p 8701:8701 -e appPort=8701 asimio/springboot-jersey-swagger-docker:latest
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
import org.springframework.security.core.authority.mapping.SimpleAuthorityMapper;
import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy;
Expand Down Expand Up @@ -74,16 +75,20 @@ protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
}

public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/api/v1/dataflows/**");
// web.ignoring().antMatchers("/api/v1/dataflows/**");
// web.ignoring().antMatchers("/api/v1/grafana/**");
}

@Override
protected void configure(final HttpSecurity http) throws Exception {
super.configure(http);

http
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.csrf().disable()
.anonymous().disable()
.httpBasic()
.and()
.authorizeRequests()
.antMatchers("/api/v1/**").authenticated();
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hurence.logisland.historian.repository;

import com.hurence.logisland.historian.rest.v1.model.dashboard.DashboardJson;
import org.springframework.data.solr.repository.Query;
import org.springframework.data.solr.repository.SolrCrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface SolrDashboardRepository extends SolrCrudRepository<DashboardJson, String> {

@Query(value = "*:*", filters = { "owner:\"?0\"" })
List<DashboardJson> findByOwner(String owner);

@Query(value = "*:*", filters = { "name:\"?0\" AND owner:\"?1\"" })
Optional<DashboardJson> findByNameAndOwner(String name, String owner);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public interface SolrTagRepository extends SolrCrudRepository<Tag, String> {
@Query(value = "*:*", filters = { "?0", "record_type:tag" })
List<Tag> findByText(String text, Pageable page);

List<Tag> findByNodeIdLike(String nodeId, Pageable pageable);

@Query(value = "record_type:tag", filters = { "record_type:tag", "domain:?0"})
List<Tag> findByDomain(String domain);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import javax.validation.constraints.*;
import java.util.List;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-08-29T22:27:12.655+02:00")

@Api(value = "admin", description = "the admin API")
public interface AdminApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import javax.validation.constraints.*;
import java.util.List;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-08-29T22:27:12.655+02:00")

@Api(value = "alerts", description = "the alerts API")
public interface AlertsApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-08-29T22:27:12.655+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-10-22T10:33:22.582+02:00")

public class ApiOriginFilter implements javax.servlet.Filter {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import javax.xml.bind.annotation.XmlTransient;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-08-29T22:27:12.655+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-10-22T10:33:22.582+02:00")

@javax.xml.bind.annotation.XmlRootElement
public class ApiResponseMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import javax.validation.constraints.*;
import java.util.List;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-08-29T22:27:12.655+02:00")

@Api(value = "configs", description = "the configs API")
public interface ConfigsApi {

Expand Down
Loading

0 comments on commit efe237e

Please sign in to comment.