-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from RADAR-CNS/release1.0.0
Release-1.0.0
- Loading branch information
Showing
52 changed files
with
1,251 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,113 +65,19 @@ In addition to Confluent Kafka platform components, RADAR-CNS platform offers | |
* RADAR-Monitor - Status monitors, | ||
* [RADAR-HotStorage](https://github.com/RADAR-CNS/RADAR-HotStorage) via MongoDB, | ||
* [RADAR-REST API](https://github.com/RADAR-CNS/RADAR-RestApi), | ||
* a Hadoop cluster, and | ||
* an email server. | ||
|
||
* A Hadoop cluster, and | ||
* An email server. | ||
* Management Portal - A web portal to manage patient monitoring studies. | ||
* RADAR-Gateway - A validating gateway to allow only valid and authentic data to the platform | ||
* Catalog server - A Service to share source-types configured in the platform. | ||
To run RADAR-CNS stack in a single node setup: | ||
|
||
1. Navigate to `radar-hadoop-cp-stack`: | ||
1. Navigate to `radar-cp-hadoop-stack`: | ||
|
||
```shell | ||
cd RADAR-Docker/dcompose-stack/radar-hadoop-cp-stack/ | ||
``` | ||
2. Configure monitor settings in `radar.yml`: | ||
|
||
```yaml | ||
battery_monitor: | ||
level: CRITICAL | ||
email_address: | ||
- [email protected] | ||
- [email protected] | ||
email_host: smtp | ||
email_port: 25 | ||
email_user: [email protected] | ||
topics: | ||
- android_empatica_e4_battery_level | ||
disconnect_monitor: | ||
# timeout in milliseconds -> 5 minutes | ||
timeout: 300000 | ||
email_address: | ||
- [email protected] | ||
- [email protected] | ||
email_host: smtp | ||
email_port: 25 | ||
email_user: [email protected] | ||
# temperature readings are sent very regularly, but | ||
# not too often. | ||
topics: | ||
- android_empatica_e4_temperature | ||
``` | ||
3. Create `smtp.env` and configure your email settings following `smtp.env.template`. Configure alternative mail providers like Amazon SES or Gmail by using the parameters of the [`namshi/smtp` Docker image](https://hub.docker.com/r/namshi/smtp/). | ||
4. (Optional) Modify flush.size and HDFS direcotory for Cold storage in `sink-hdfs.properties` | ||
|
||
```ini | ||
flush.size= | ||
topics.dir=/path/to/data | ||
``` | ||
Note: To have different flush.size for different topics, you can create multipe property configurations for a single connector. To do that, | ||
|
||
4.1 Create multipe property files that have different `flush.size` for given topics. | ||
Examples [sink-hdfs-high.properties](https://github.com/RADAR-CNS/RADAR-Docker/blob/dev/dcompose-stack/radar-cp-hadoop-stack/sink-hdfs-high.properties) , [sink-hdfs-low.properties](https://github.com/RADAR-CNS/RADAR-Docker/blob/dev/dcompose-stack/radar-cp-hadoop-stack/sink-hdfs-low.properties) | ||
|
||
4.2 Add `CONNECTOR_PROPERTY_FILE_PREFIX: <prefix-value>` enviornment variable to `radar-hdfs-connector` service in `docker-compose` file. | ||
|
||
4.3 Add created property files to the `radar-hdfs-connector` service in `docker-compose` with name abides to prefix-value mentioned in `CONNECTOR_PROPERTY_FILE_PREFIX` | ||
|
||
```ini | ||
radar-hdfs-connector: | ||
image: radarcns/radar-hdfs-connector-auto:0.2 | ||
restart: on-failure | ||
volumes: | ||
- ./sink-hdfs-high.properties:/etc/kafka-connect/sink-hdfs-high.properties | ||
- ./sink-hdfs-low.properties:/etc/kafka-connect/sink-hdfs-low.properties | ||
environment: | ||
CONNECT_BOOTSTRAP_SERVERS: PLAINTEXT://kafka-1:9092,PLAINTEXT://kafka-2:9092,PLAINTEXT://kafka-3:9092 | ||
CONNECTOR_PROPERTY_FILE_PREFIX: "sink-hdfs" | ||
``` | ||
|
||
5. Configure Hot Storage settings in `.env` file | ||
|
||
```ini | ||
HOTSTORAGE_USERNAME=mongodb-user | ||
HOTSTORAGE_PASSWORD=XXXXXXXX | ||
HOTSTORAGE_NAME=mongodb-database | ||
``` | ||
6. To install the stack | ||
|
||
```shell | ||
sudo ./install-radar-stack.sh | ||
cd RADAR-Docker/dcompose-stack/radar-cp-hadoop-stack/ | ||
``` | ||
|
||
To stop RADAR-CNS stack on a single node setup, run | ||
|
||
```shell | ||
cd RADAR-Docker/dcompose-stack/radar-hadoop-cp-stack/ | ||
sudo ./stop-radar-stack.sh | ||
``` | ||
To reboot RADAR-CNS stack on a single node setup, run | ||
|
||
```shell | ||
cd RADAR-Docker/dcompose-stack/radar-hadoop-cp-stack/ | ||
sudo ./reboot-radar-stack.sh | ||
``` | ||
To start RADAR-CNS stack on a single node setup after installing, run | ||
|
||
```shell | ||
cd RADAR-Docker/dcompose-stack/radar-hadoop-cp-stack/ | ||
sudo ./start-radar-stack.sh | ||
``` | ||
|
||
#### cAdvisor | ||
|
||
cAdvisor (Container Advisor) provides container users an understanding of the resource usage and performance characteristics of their running containers. | ||
|
||
To view current resource performance,if running locally, try [http://localhost:8181](http://localhost:8181). This will bring up the built-in Web UI. Clicking on `/docker` in `Subcontainers` takes you to a new window with all of the Docker containers listed individually. | ||
|
||
#### Portainer | ||
|
||
Portainer provides simple interactive UI-based docker management. If running locally, try [http://localhost:8182](http://localhost:8182) for portainer's UI. To set-up portainer follow this [link](https://www.ostechnix.com/portainer-an-easiest-way-to-manage-docker/). | ||
2. Follow the README instructions there for correct configuration. | ||
|
||
### Logging | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
# Check whether services are healthy. If not, restart them and notify the maintainer. | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
. "$DIR/util.sh" | ||
. .env | ||
|
||
function hipchat_notify() { | ||
# Send notification via HipChat, if configured. | ||
if [ "$HEALTHCHECK_HIPCHAT_NOTIFY" == "yes" ] ; then | ||
if [ -z "$HEALTHCHECK_HIPCHAT_ROOM_ID" ] ; then | ||
echo "Error: HipChat notifications are enabled, but \$HEALTHCHECK_HIPCHAT_ROOM_ID is undefined. Unable to send HipChat notification." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$HEALTHCHECK_HIPCHAT_TOKEN" ] ; then | ||
echo "Error: HipChat notifications are enabled, but \$HEALTHCHECK_HIPCHAT_TOKEN is undefined. Unable to send HipChat notification." | ||
exit 1 | ||
fi | ||
|
||
color=$1 | ||
body=$2 | ||
curl -X POST -H "Content-Type: application/json" --header "Authorization: Bearer $HEALTHCHECK_HIPCHAT_TOKEN" \ | ||
-d "{\"color\": \"$color\", \"message_format\": \"text\", \"message\": \"$body\" }" \ | ||
https://api.hipchat.com/v2/room/$HEALTHCHECK_HIPCHAT_ROOM_ID/notification | ||
fi | ||
} | ||
|
||
unhealthy=() | ||
|
||
# get all human-readable service names | ||
# see last line of loop | ||
while read service; do | ||
# check if a container was started for the service | ||
container=$(sudo-linux docker-compose ps -q $service) | ||
if [ -z "${container}" ]; then | ||
# no container means no running service | ||
continue | ||
fi | ||
health=$(sudo-linux docker inspect --format '{{.State.Health.Status}}' $container 2>/dev/null || echo "null") | ||
if [ "$health" = "unhealthy" ]; then | ||
echo "Service $service is unhealthy. Restarting." | ||
unhealthy+=("${service}") | ||
sudo-linux docker-compose restart ${service} | ||
fi | ||
done <<< "$(sudo-linux docker-compose config --services)" | ||
|
||
if [ "${#unhealthy[@]}" -eq 0 ]; then | ||
if [ -f .unhealthy ]; then | ||
rm -f .unhealthy | ||
hipchat_notify green "All services are healthy again" | ||
fi | ||
echo "All services are healthy" | ||
else | ||
echo "$unhealthy services were unhealthy and have been restarted." | ||
|
||
# Send notification to MAINTAINER | ||
# start up the mail container if not already started | ||
sudo-linux docker-compose up -d smtp | ||
# save the container, so that we can use exec to send an email later | ||
container=$(sudo-linux docker-compose ps -q smtp) | ||
SAVEIFS=$IFS | ||
IFS=, | ||
display_services="[${unhealthy[*]}]" | ||
IFS=$SAVEIFS | ||
display_host="${SERVER_NAME} ($(hostname -f), $(curl -s http://ipecho.net/plain))" | ||
body="Services on $display_host are unhealthy. Services $display_services have been restarted. Please log in for further information." | ||
echo "Sent notification to $MAINTAINER_EMAIL" | ||
echo "$body" | sudo-linux docker exec -i ${container} mail -aFrom:$FROM_EMAIL "-s[RADAR] Services on ${SERVER_NAME} unhealthy" $MAINTAINER_EMAIL | ||
|
||
echo "${unhealthy[@]}" > .unhealthy | ||
|
||
hipchat_notify red "$body" | ||
|
||
exit 1 | ||
fi |
Oops, something went wrong.