Skip to content

Commit f83a284

Browse files
authored
Merge pull request #52 from RADAR-base/release-0.2.0
Release 0.2.0
2 parents e6fbd93 + 62c1655 commit f83a284

File tree

86 files changed

+2233
-1340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2233
-1340
lines changed

.dockerignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
.idea
2-
.gradle*
3-
build
1+
/.idea/
2+
/.gradle*
3+
/.git*
4+
/out/
5+
/config/
6+
/build/
7+
/libs/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ backend.log
2424
smtp.env
2525

2626
/out/
27+
/libs/

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ services:
88

99
env:
1010
DOCKER_COMPOSE_VERSION: 1.16.1
11-
TERM: dumb
1211

1312
cache:
1413
directories:
@@ -26,8 +25,10 @@ before_install:
2625
- chmod +x "$HOME/bin/docker-compose";
2726
script:
2827
- ./gradlew check
28+
- cd src/integrationTest/docker
2929
- sudo docker-compose up -d zookeeper-1 kafka-1 schema-registry-1 && sleep 30 && sudo docker-compose run --rm integration-test
3030
- sudo docker-compose down
31+
- cd ../../..
3132
after_script:
3233
- ./gradlew sendCoverageToCodacy
3334

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# These owners will be the default owners for everything in the repo.
22
# Unless a later match takes precedence, they will be requested for review when someone
33
# opens a pull request.
4-
* @blootsvoets @nivemaham @fnobilia
4+
* @blootsvoets @nivemaham @yatharthranjan

Dockerfile

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,50 @@
1-
FROM confluentinc/cp-base:3.3.0
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
212

3-
ENV TERM=dumb
13+
FROM openjdk:8-alpine AS builder
414

515
RUN mkdir /code
616
WORKDIR /code
717

8-
COPY gradle /code/gradle
9-
COPY gradle.properties build.gradle settings.gradle gradlew /code/
10-
RUN ./gradlew downloadDependencies
11-
COPY src /code/src
18+
ENV GRADLE_OPTS -Dorg.gradle.daemon=false -Dorg.gradle.project.profile=prod
1219

13-
ENTRYPOINT ["./gradlew"]
20+
COPY ./gradle/wrapper /code/gradle/wrapper
21+
COPY ./gradlew /code/
22+
RUN ./gradlew --version
23+
24+
COPY ./gradle/profile.prod.gradle /code/gradle/
25+
COPY ./build.gradle ./gradle.properties ./settings.gradle /code/
26+
27+
RUN ./gradlew downloadRuntimeDependencies
28+
29+
COPY ./src/ /code/src
30+
31+
RUN ./gradlew distTar && \
32+
tar xf build/distributions/*.tar && \
33+
rm build/distributions/*.tar
34+
35+
FROM confluentinc/cp-base:3.3.1
36+
37+
MAINTAINER Nivethika M <nivethika@thehyve.nl> , Joris Borgdorff <joris@thehyve.nl>
38+
39+
LABEL description="RADAR-CNS Backend streams and monitor"
40+
41+
ENV KAFKA_REST_PROXY http://rest-proxy:8082
42+
ENV KAFKA_SCHEMA_REGISTRY http://schema-registry:8081
43+
44+
COPY --from=builder /code/radar-backend-*/bin/* /usr/bin/
45+
COPY --from=builder /code/radar-backend-*/lib/* /usr/lib/
46+
47+
# Load topics validator
48+
COPY ./src/main/docker/radar-backend-init /usr/bin
49+
50+
CMD ["radar-backend-init"]

README.md

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ RADAR-Backend provides an abstract layer to monitor and analyze streams of weara
1212
The following are the prerequisites to run RADAR-Backend on your machine:
1313

1414
- Java 8
15-
- [Confluent Platform 3.1.2](http://docs.confluent.io/3.1.2/installation.html) ( Running instances of Zookeeper, Kafka-broker(s), Schema-Registry and Kafka-REST-Proxy services ).
15+
- [Confluent Platform 3.3.1](http://docs.confluent.io/3.3.1/installation.html) ( Running instances of Zookeeper, Kafka-broker(s), Schema-Registry and Kafka-REST-Proxy services ).
1616
- SMTP server to send notifications from the monitors.
1717

1818
## Installation
1919

2020
1. Install the dependencies mentioned above.
21-
2. Clone RADAR-Backend repository.
21+
2. Clone radar-backend repository.
2222

2323
```shell
24-
git clone https://github.com/RADAR-CNS/RADAR-Backend.git
24+
git clone https://github.com/RADAR-CNS/radar-backend.git
2525
```
2626
3. Build the project from project directory
2727

@@ -33,10 +33,14 @@ The following are the prerequisites to run RADAR-Backend on your machine:
3333
./gradlew clean
3434
3535
# Build
36-
./gradlew build
36+
./gradlew distTar
37+
38+
# Unpack the binaries
39+
sudo mkdir -p /usr/local && \
40+
sudo tar --strip-components 1 -C /usr/local xzf build/distributions/*.tar.gz
3741
```
38-
The build process creates separate jar files for each component. Built jars are located under `build/libs` folder.
39-
42+
43+
Now the backend is available as the `/usr/local/bin/radar-backend` script.
4044

4145
## Usage
4246

@@ -63,13 +67,12 @@ The RADAR command-line has three subcommands: `stream`, `monitor` and `mock`. Th
6367
- android_empatica_e4_temperature_output
6468
- android_phone_usage_event
6569
- android_phone_usage_event_output
66-
3. Run `radarbackend.jar` with configured `radar.yml` and `stream` argument
70+
3. Run `radar-backend` with configured `radar.yml` and `stream` argument
6771

6872
```shell
69-
java -jar radarbackend-1.0.jar -c path/to/radar.yml stream
73+
radar-backend -c path/to/radar.yml stream
7074
```
71-
72-
75+
7376
The phone usage event stream uses an internal cache of 1 million elements, which may take about 50 MB of memory. Adjust `org.radarcns.stream.phone.PhoneUsageStream.MAX_CACHE_SIZE` to change it.
7477

7578
### RADAR-backend monitors
@@ -111,11 +114,45 @@ To get email notifications for Empatica E4 battery status, an email server witho
111114
topics:
112115
- android_empatica_e4_temperature
113116
```
117+
118+
3. For Source Statistics monitors, configure what source topics to monitor to output some basic output statistics (like last time seen)
119+
120+
```yaml
121+
statistics_monitors:
122+
# Human readable monitor name
123+
- name: Empatica E4
124+
# topics to aggregate. This can take any number of topics that may
125+
# lead to slightly different statistics
126+
topics:
127+
- android_empatica_e4_blood_volume_pulse_1min
128+
# Topic to write results to. This should follow the convention
129+
# source_statistics_[provider]_[model] with produer and model as
130+
# defined in RADAR-Schemas
131+
output_topic: source_statistics_empatica_e4
132+
# Maximum batch size to aggregate before sending results.
133+
# Defaults to 1000.
134+
max_batch_size: 500
135+
# Flush timeout in milliseconds. If the batch size is not larger than
136+
# max_batch_size for this amount of time, the current batch is
137+
# forcefully flushed to the output topic.
138+
# Defaults to 60000 = 1 minute.
139+
flush_timeout: 15000
140+
- name: Biovotion VSM1
141+
topics:
142+
- android_biovotion_vsm1_acceleration_1min
143+
output_topic: source_statistics_biovotion_vsm1
144+
- name: RADAR pRMT
145+
topics:
146+
- android_phone_acceleration_1min
147+
- android_phone_bluetooth_devices
148+
- android_phone_sms
149+
output_topic: source_statistics_radar_prmt
150+
```
114151

115-
3. Run `radarbackend.jar` with configured `radar.yml` and `monitor` argument
152+
3. Run `radar-backend` with configured `radar.yml` and `monitor` argument
116153

117154
```shell
118-
java -jar radarbackend-1.0.jar -c path/to/radar.yml monitor
155+
radar-backend -c path/to/radar.yml monitor
119156
```
120157

121158
### Send mock data to the backend
@@ -150,21 +187,33 @@ To get email notifications for Empatica E4 battery status, an email server witho
150187
3. To generate data on some `backend_mock_empatica_e4_<>` topic with a number of devices, run (substitute `<num-devices>` with the needed number of devices):
151188

152189
```shell
153-
java -jar radarbackend-1.0.jar -c path/to/radar.yml mock --devices <num-devices>
190+
radar-backend -c path/to/radar.yml mock --devices <num-devices>
154191
```
155192

156193
Press `Ctrl-C` to stop.
157194

158195
4. To generate the file data configured in point 2, run
159196

160197
```shell
161-
java -jar radarbackend-1.0.jar -c path/to/radar.yml mock --file mock_data.yml
198+
radar-backend -c path/to/radar.yml mock --file mock_data.yml
162199
```
163200

164201
The data sending will automatically be stopped.
165202

203+
### Docker image
204+
205+
The backend is [published to Docker Hub](https://hub.docker.com/r/radarcns/radar-backend-kafka). Mount a `/etc/radar.yml` file to configure either the streams or the monitor.
206+
207+
This image requires the following environment variable:
208+
209+
- `KAFKA_REST_PROXY`: a valid Rest-Proxy instance
210+
- `KAFKA_SCHEMA_REGISTRY`: a valid Confluent Schema Registry.
211+
- `KAFKA_BROKERS`: number of brokers expected (default: 3).
212+
213+
For a complete use case scenario, check the RADAR-CNS `docker-compose` file available [here](https://github.com/RADAR-CNS/RADAR-Docker/blob/backend-integration/dcompose-stack/radar-cp-hadoop-stack/docker-compose.yml)
166214

167215
## Contributing
216+
168217
Code should be formatted using the [Google Java Code Style Guide](https://google.github.io/styleguide/javaguide.html).
169218
If you want to contribute a feature or fix browse our [issues](https://github.com/RADAR-CNS/RADAR-Backend/issues), and please make a pull request.
170219

0 commit comments

Comments
 (0)