Skip to content

Commit

Permalink
Merge pull request #10 from rwth-acis/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
AlexanderNeumann authored Nov 27, 2019
2 parents 2cb73bb + 53bcb5e commit 9a8bd9c
Show file tree
Hide file tree
Showing 21 changed files with 1,328 additions and 1,463 deletions.
11 changes: 4 additions & 7 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/db2jcc_Licence-0.jar"/>
<classpathentry kind="lib" path="lib/db2jcc-0.jar"/>
<classpathentry kind="lib" path="lib/commons-dbcp2-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/commons-pool2-2.4.2.jar"/>
<classpathentry kind="lib" path="lib/mysql-connector-java-6.0.6.jar"/>
<classpathentry kind="lib" path="lib/json-simple-1.1.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/>
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
<classpathentry kind="lib" path="lib/las2peer-bundle-0.7-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/las2peer-bundle-0.8.2.jar"/>
<classpathentry kind="lib" path="lib/commons-dbcp2-2.5.0.jar"/>
<classpathentry kind="lib" path="lib/mysql-connector-java-8.0.13.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.12.jar"/>
<classpathentry kind="output" path="output"/>
</classpath>
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
language: java
jdk:
- oraclejdk8
- openjdk8
install:
- sudo apt-get install -y ant ant-optional
services:
- mysql
script: "ant all"
script: 'ant all'
sudo: required
before_script:
- bash .travis.install-mysql-5.7.sh
- mysql -u root -e 'CREATE DATABASE LAS2PEERMON;'
- mysql -u root LAS2PEERMON < etc/create_database_MySQL.sql
- mysql -u root LAS2PEERMON < etc/create_database.sql
after_success:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash)
81 changes: 34 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,30 @@
MobSOS Data-Processing
# MobSOS Data Processing

===========================================

[![Build Status](https://travis-ci.org/rwth-acis/mobsos-data-processing.svg?branch=master)](https://travis-ci.org/rwth-acis/mobsos-data-processing) [![codecov](https://codecov.io/gh/rwth-acis/mobsos-data-processing/branch/master/graph/badge.svg)](https://codecov.io/gh/rwth-acis/mobsos-data-processing) [![Join the chat at https://gitter.im/rwth-acis/mobsos](https://badges.gitter.im/rwth-acis/mobsos.svg)](https://gitter.im/rwth-acis/mobsos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

This service is part of the MobSOS monitoring concept and processes incoming monitoring data.
This service is part of the MobSOS monitoring concept and processes incoming monitoring data.

Database
--------
Set up the database. You can find different sql files in the [etc](etc) folder:
## Local Deployment

| ID | Type |
| ------------- | ------------- |
| 1 | [DB2](etc/create_database_DB2.sql) |
| 2 | [MySQL](etc/create_database_MySQL.sql) |
### Database

After that configure the [property](etc/i5.las2peer.services.mobsos.dataProcessing.MonitoringDataProcessingService.properties) file of the service and enter your database credentials.
Set up the database. You can find the sql file in the [etc](etc) folder.

```INI
databaseTypeInt = 2
databaseUser = exampleuser
databasePassword = examplepass
databaseName = exampledb
databaseHost = localhost
databasePort = 3306
```
After that, configure the [property](etc/i5.las2peer.services.mobsos.dataProcessing.MobSOSDataProcessingService.properties) file of the service and enter your database credentials.

### Build

Build
--------
Execute the following command on your shell:

```shell
ant all
ant all
```

Start
--------
### Start

To start the data-processing service, use one of the available start scripts:
To start the service, use one of the available start scripts:

Windows:

Expand All @@ -49,11 +37,9 @@ Unix/Mac:
bin/start_network.sh
```

--------
Have a look at the [manual](../../wiki/Manual) if you want to know how to monitor a node/service.

How to run using Docker
-------------------
## How to run using Docker

First build the image:
```bash
Expand All @@ -78,30 +64,31 @@ In order to customize your setup you can set further environment variables.
Set [las2peer node launcher options](https://github.com/rwth-acis/las2peer-Template-Project/wiki/L2pNodeLauncher-Commands#at-start-up) with these variables.
The las2peer port is fixed at *9011*.

| Variable | Default | Description |
|----------|---------|-------------|
| BOOTSTRAP | unset | Set the --bootstrap option to bootrap with existing nodes. The container will wait for any bootstrap node to be available before continuing. |
| SERVICE_PASSPHRASE | Passphrase | Set the second argument in *startService('<service@version>', '<SERVICE_PASSPHRASE>')*. |
| Variable | Default | Description |
| ------------------ | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| BOOTSTRAP | unset | Set the --bootstrap option to bootrap with existing nodes. The container will wait for any bootstrap node to be available before continuing. |
| SERVICE_PASSPHRASE | Passphrase | Set the second argument in *startService('<service@version>', '<SERVICE_PASSPHRASE>')*. |
| SERVICE_EXTRA_ARGS | unset | Set additional launcher arguments. Example: ```--observer``` to enable monitoring. |

### Service Variables

See the [property file](etc/i5.las2peer.services.mobsos.dataProcessing.MonitoringDataProcessingService.properties) for an overview of the settings.
See the [property file](etc/i5.las2peer.services.mobsos.dataProcessing.MobSOSDataProcessingService.properties) for an overview of the settings.
The database type is fixed at mysql for now.

| Variable | Default |
|----------|---------|
| MYSQL_USER | *mandatory* |
| Variable | Default |
| -------------- | ----------- |
| MYSQL_USER | *mandatory* |
| MYSQL_PASSWORD | *mandatory* |
| MYSQL_HOST | mysql |
| MYSQL_PORT | 3306 |
| HASH_REMARKS | FALSE |
| MYSQL_HOST | mysql |
| MYSQL_PORT | 3306 |
| HASH_REMARKS | FALSE |


### Other Variables

| Variable | Default | Description |
|----------|---------|-------------|
| DEBUG | unset | Set to any value to get verbose output in the container entrypoint script. |
| Variable | Default | Description |
| -------- | ------- | -------------------------------------------------------------------------- |
| DEBUG | unset | Set to any value to get verbose output in the container entrypoint script. |

### Custom Node Startup

Expand All @@ -119,10 +106,10 @@ java -cp lib/* i5.las2peer.tools.L2pNodeLauncher -s service -p ${LAS2PEER_PORT}

The following places should be persisted in volumes in productive scenarios:

| Path | Description |
|------|-------------|
| /src/node-storage | Pastry P2P storage. |
| /src/etc/startup | Service agent key pair and passphrase. |
| /src/log | Log files. |
| Path | Description |
| ----------------- | -------------------------------------- |
| /src/node-storage | Pastry P2P storage. |
| /src/etc/startup | Service agent key pair and passphrase. |
| /src/log | Log files. |

*Do not forget to persist you database data*
*Do not forget to persist you database data*
34 changes: 17 additions & 17 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<project name="MonitoringDataProcessingService" default="jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<project name="MobSOSDataProcessing" default="jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">

<property file="etc/ant_configuration/user.properties"/>
<property file="etc/ant_configuration/service.properties"/>

<property name="startup" location="etc/startup" />

<property name="src.main" location="src/main" />
<property name="src.junit" location="src/test" />

<property name="tmp" location="tmp" />
<property name="log" location="log" />
<property name="service" location="service" />

<property name="tmp.classes" location="${tmp}/classes" />
<property name="tmp.junit" location="${tmp}/test" />
<property name="tmp.bundle" location="${tmp}/bundle" />

<property name="export" location="export" />
<property name="export.doc" location="${export}/doc" />
<property name="junit.report" location="${export}/test_reports" />
Expand All @@ -32,7 +32,7 @@
<exclude name="i5.las2peer.services.*.jar"/>
</fileset>
</path>

<property name="lib.junit" location="${lib}/junit-4.12.jar" />

<!-- Ivy Installation (Tool to fetch Libraries) -->
Expand Down Expand Up @@ -69,20 +69,20 @@
<mkdir dir="${service}" />
<mkdir dir="${tmp.bundle}" />
</target>

<target name="init_general">
<tstamp/>
<mkdir dir="${tmp}" />
<mkdir dir="${export}" />
<mkdir dir="${startup}" />
<mkdir dir="${log}" />
</target>

<target name="init_compile" depends="init_general, get_deps">
<mkdir dir="${tmp.classes}" />
<mkdir dir="${tmp.junit}" />
</target>

<target name="init_doc" depends="init_general">
<mkdir dir="${export.doc}" />
</target>
Expand All @@ -102,7 +102,7 @@
</fileset>
</copy>
</target>

<target name="compile_junit" depends="init_compile">
<javac srcdir="${src.junit}"
destdir="${tmp.junit}"
Expand All @@ -120,7 +120,7 @@
</target>

<target name="compile_all" depends="compile_main, compile_junit" />

<!-- Generate start scripts -->
<target name="startscripts" description="generate start scripts for Windows and Unix">
<mkdir dir="${basedir}/bin" />
Expand Down Expand Up @@ -148,7 +148,7 @@
pause
</echo>
</target>

<!-- Generate Jars -->
<target name="jar" depends="compile_main" description="--> build service jar including all deps">
<jar jarfile="${service}/${service.name}-${service.version}.jar">
Expand Down Expand Up @@ -182,15 +182,15 @@

<!-- JUnit Testing -->
<target name="junit" depends="junit_tests, junit_clean" description="--> execute all junit tests" />

<target name="init_junit" depends="init_general">
<mkdir dir="${junit.report}" />
</target>

<target name="junit_clean">
<delete dir="${tmp.junit}" />
</target>

<target name="junit_tests" depends="init_junit, compile_all">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpathref="libraries"/>
<jacoco:coverage destfile="${export}/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant">
Expand All @@ -215,7 +215,7 @@
<executiondata>
<file file="${export}/jacoco.exec" />
</executiondata>

<structure name="jacoco">
<classfiles>
<fileset dir="${tmp.classes}" />
Expand Down
8 changes: 5 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ ! -z "${DEBUG}" ]]; then
fi

# set some helpful variables
export SERVICE_PROPERTY_FILE='etc/i5.las2peer.services.mobsos.dataProcessing.MonitoringDataProcessingService.properties'
export SERVICE_PROPERTY_FILE='etc/i5.las2peer.services.mobsos.dataProcessing.MobSOSDataProcessingService.properties'
export SERVICE_VERSION=$(awk -F "=" '/service.version/ {print $2}' etc/ant_configuration/service.properties)
export SERVICE_NAME=$(awk -F "=" '/service.name/ {print $2}' etc/ant_configuration/service.properties)
export SERVICE_CLASS=$(awk -F "=" '/service.class/ {print $2}' etc/ant_configuration/service.properties)
Expand All @@ -29,6 +29,7 @@ export MYSQL_DATABASE='LAS2PEERMON'
[[ -z "${MYSQL_HOST}" ]] && export MYSQL_HOST='mysql'
[[ -z "${MYSQL_PORT}" ]] && export MYSQL_PORT='3306'
[[ -z "${HASH_REMARKS}" ]] && export HASH_REMARKS='FALSE'
[[ -z "${SEND_TO_LRS}" ]] && export SEND_TO_LRS='FALSE'

# configure service properties

Expand All @@ -42,6 +43,7 @@ set_in_service_config databaseName ${MYSQL_DATABASE}
set_in_service_config databaseHost ${MYSQL_HOST}
set_in_service_config databasePort ${MYSQL_PORT}
set_in_service_config hashRemarks ${HASH_REMARKS}
set_in_service_config sendToLRS ${SEND_TO_LRS}

# ensure the database is ready
while ! mysqladmin ping -h${MYSQL_HOST} -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PASSWORD} --silent; do
Expand Down Expand Up @@ -73,15 +75,15 @@ fi

# prevent glob expansion in lib/*
set -f
LAUNCH_COMMAND='java -cp lib/* i5.las2peer.tools.L2pNodeLauncher -s service -p '"${LAS2PEER_PORT}"
LAUNCH_COMMAND='java -cp lib/* i5.las2peer.tools.L2pNodeLauncher -s service -p '"${LAS2PEER_PORT} ${SERVICE_EXTRA_ARGS}"
if [[ ! -z "${BOOTSTRAP}" ]]; then
LAUNCH_COMMAND="${LAUNCH_COMMAND} -b ${BOOTSTRAP}"
fi

# start the service within a las2peer node
if [[ -z "${@}" ]]
then
exec ${LAUNCH_COMMAND} startService\("'""${SERVICE}""'", "'""${SERVICE_PASSPHRASE}""'"\) startWebConnector
exec ${LAUNCH_COMMAND} --observer uploadStartupDirectory startService\("'""${SERVICE}""'", "'""${SERVICE_PASSPHRASE}""'"\) startWebConnector
else
exec ${LAUNCH_COMMAND} ${@}
fi
5 changes: 2 additions & 3 deletions etc/ant_configuration/service.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
service.version=0.7.1
service.version=0.8.2
service.name=i5.las2peer.services.mobsos.dataProcessing
service.path=i5/las2peer/services/mobsos/dataProcessing
service.class=MonitoringDataProcessingService
service.class=MobSOSDataProcessingService
service.passphrase=processing
service.dependencies=
Loading

0 comments on commit 9a8bd9c

Please sign in to comment.