Skip to content

Commit

Permalink
Merge pull request #50 from RADAR-CNS/managementportal-integrated
Browse files Browse the repository at this point in the history
Managementportal integrated
  • Loading branch information
afolarin authored Oct 12, 2017
2 parents c5ba936 + b5b970d commit 44fa028
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 7 deletions.
2 changes: 2 additions & 0 deletions dcompose-stack/radar-cp-hadoop-stack/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.env
/etc/smtp.env
/radar.yml
/output/
10 changes: 6 additions & 4 deletions dcompose-stack/radar-cp-hadoop-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

## Configuration

First move `etc/env.template` file to `./.env` and check and modify all its variables. To have a valid HTTPS connection for a public host, set `SELF_SIGNED_CERT=no`. You need to provide a public valid DNS name as `SERVER_NAME` for SSL certificate to work. IP addresses will not work.
1. First move `etc/env.template` file to `./.env` and check and modify all its variables. To have a valid HTTPS connection for a public host, set `SELF_SIGNED_CERT=no`. You need to provide a public valid DNS name as `SERVER_NAME` for SSL certificate to work. IP addresses will not work.

Modify `etc/smtp.env.template` to set a SMTP host to send emails with, and move it to `etc/smtp.env`. The configuration settings are passed to a [namshi/smtp](https://hub.docker.com/r/namshi/smtp/) Docker container. This container supports a.o. regular SMTP and GMail.
2. Modify `etc/smtp.env.template` to set a SMTP host to send emails with, and move it to `etc/smtp.env`. The configuration settings are passed to a [namshi/smtp](https://hub.docker.com/r/namshi/smtp/) Docker container. This container supports a.o. regular SMTP and GMail.

Modify the `etc/redcap-integration/radar.yml.template` to configure the properties of Redcap instance and the management portal, and move it to `etc/redcap-integration/radar.yml`. For reference on cofiguration of this file look at the Readme file here - https://github.com/RADAR-CNS/RADAR-RedcapIntegration#configuration
3. Modify the `etc/redcap-integration/radar.yml.template` to configure the properties of Redcap instance and the management portal, and move it to `etc/redcap-integration/radar.yml`. For reference on configuration of this file look at the Readme file here - https://github.com/RADAR-CNS/RADAR-RedcapIntegration#configuration
In the REDcap portal under Project Setup, define the Data Trigger as `https://<YOUR_HOST_URL>/redcapint/trigger`

Finally, move `etc/radar.yml.template` to `etc/radar.yml` and edit it, especially concerning the monitor email address configuration.
4. Move `etc/managementportal/changelogs/config/liquibase/oauth_client_details.csv.template` to `etc/managementportal/changelogs/config/liquibase/oauth_client_details.csv` and change OAuth client credentials for production MP. (Except ManagementPortalapp)

5. Finally, move `etc/radar.yml.template` to `etc/radar.yml` and edit it, especially concerning the monitor email address configuration.

## Usage

Expand Down
42 changes: 40 additions & 2 deletions dcompose-stack/radar-cp-hadoop-stack/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ networks:
redcap:
driver: bridge
internal: true
management:
driver: bridge
internal: true

volumes:
kafka-1-data: {}
Expand Down Expand Up @@ -217,8 +220,9 @@ services:
networks:
- redcap
- default
#depends_on:
#- hotstorage
- management
depends_on:
- managementportal-app
restart: always
volumes:
- "./etc/redcap-integration:/usr/local/tomcat/conf/radar"
Expand Down Expand Up @@ -291,6 +295,7 @@ services:
smtp:
image: namshi/smtp:latest
networks:
- default
- mail
volumes:
- /var/spool/exim
Expand Down Expand Up @@ -479,10 +484,43 @@ services:
- rest-proxy-1
- dashboard
- radar-integration
- managementportal-app
ports:
- "80:80"
- "443:443"
volumes:
- certs:/etc/letsencrypt
- certs-data:/data/letsencrypt
- "./etc/nginx.conf:/etc/nginx/nginx.conf:ro"

managementportal-app:
image: radarcns/management-portal:latest
networks:
- default
- management
- mail
depends_on:
- managementportal-postgresql
- smtp
environment:
SPRING_PROFILES_ACTIVE: prod,swagger
SPRING_DATASOURCE_URL: jdbc:postgresql://managementportal-postgresql:5432/managementportal
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER}
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD}
MANAGEMENTPORTAL_MAIL_FROM: ${FROM_EMAIL}
MANAGEMENTPORTAL_MAIL_BASEURL: https://${SERVER_NAME}/managementportal
JHIPSTER_SLEEP: 10 # gives time for the database to boot before the application
JAVA_OPTS: -Xmx256m # maximum heap size for the JVM running ManagementPortal, increase this as necessary
volumes:
- ./etc/managementportal/changelogs:/changelogs

managementportal-postgresql:
image: postgres:9.6.2
volumes:
- "${MP_POSTGRES_DIR}/:/var/lib/postgresql/"
environment:
POSTGRES_USER : ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: managementportal
networks:
- management
6 changes: 5 additions & 1 deletion dcompose-stack/radar-cp-hadoop-stack/etc/env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SERVER_NAME=localhost
SELF_SIGNED_CERT=yes
[email protected]
RADAR_TOPIC_LIST=android_empatica_e4_acceleration,android_empatica_e4_acceleration_output,android_empatica_e4_battery_level,android_empatica_e4_battery_level_output,android_empatica_e4_blood_volume_pulse,android_empatica_e4_blood_volume_pulse_output,android_empatica_e4_electrodermal_activity,android_empatica_e4_electrodermal_activity_output,android_empatica_e4_heartrate,android_empatica_e4_inter_beat_interval,android_empatica_e4_inter_beat_interval_output,android_empatica_e4_sensor_status,android_empatica_e4_sensor_status_output,android_empatica_e4_temperature,android_empatica_e4_temperature_output,application_server_status,application_record_counts,application_uptime,application_external_time,android_phone_battery_level,android_phone_acceleration,android_phone_light,android_pebble2_acceleration,android_pebble2_battery_level,android_pebble2_heart_rate,android_pebble2_heart_rate_filtered,active_questionnaire_phq8,schemaless-key,schemaless-value
RADAR_TOPIC_LIST=android_empatica_e4_acceleration,android_empatica_e4_acceleration_output,android_empatica_e4_battery_level,android_empatica_e4_battery_level_output,android_empatica_e4_blood_volume_pulse,android_empatica_e4_blood_volume_pulse_output,android_empatica_e4_electrodermal_activity,android_empatica_e4_electrodermal_activity_output,android_empatica_e4_heartrate,android_empatica_e4_inter_beat_interval,android_empatica_e4_inter_beat_interval_output,android_empatica_e4_sensor_status,android_empatica_e4_sensor_status_output,android_empatica_e4_temperature,android_empatica_e4_temperature_output,application_server_status,application_record_counts,application_uptime,application_external_time,android_phone_battery_level,android_phone_acceleration,android_phone_light,android_pebble2_acceleration,android_pebble2_battery_level,android_pebble2_heart_rate,android_pebble2_heart_rate_filtered,active_questionnaire_phq8,schemaless-key,schemaless-value,thincit_code_breaker,thincit_spotter,thincit_symbol_check,thincit_trails
RADAR_RAW_TOPIC_LIST=android_empatica_e4_acceleration,android_empatica_e4_battery_level,android_empatica_e4_blood_volume_pulse,android_empatica_e4_electrodermal_activity,android_empatica_e4_inter_beat_interval,android_empatica_e4_sensor_status,android_empatica_e4_temperature,application_server_status,application_record_counts,application_uptime,application_external_time,android_phone_battery_level,android_phone_acceleration,android_phone_light,android_pebble2_acceleration,android_pebble2_battery_level,android_pebble2_heart_rate,android_pebble2_heart_rate_filtered,active_questionnaire_phq8
RADAR_AGG_TOPIC_LIST=android_empatica_e4_acceleration_output,android_empatica_e4_battery_level_output,android_empatica_e4_blood_volume_pulse_output,android_empatica_e4_electrodermal_activity_output,android_empatica_e4_heartrate,android_empatica_e4_inter_beat_interval_output,android_empatica_e4_sensor_status_output,android_empatica_e4_temperature_output,application_server_status,application_record_counts,application_uptime,application_external_time,active_questionnaire_phq8
HOTSTORAGE_USERNAME=<mongodb-user>
Expand All @@ -12,3 +12,7 @@ HDFS_DATA_DIR_2=/usr/local/var/lib/docker/hdfs-data-2
HDFS_NAME_DIR_1=/usr/local/var/lib/docker/hdfs-name-1
HDFS_NAME_DIR_2=/usr/local/var/lib/docker/hdfs-name-2
MONGODB_DIR=/usr/local/var/lib/docker/mongodb
MP_POSTGRES_DIR=/usr/local/var/lib/docker/postgres
POSTGRES_USER=<postgresdb-user>
POSTGRES_PASSWORD=<postgresdb-pwd>
FROM_EMAIL=<from-email>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
client_id;resource_ids;client_secret;scope;authorized_grant_types;web_server_redirect_uri;authorities;access_token_validity;refresh_token_validity;additional_information;autoapprove
ManagementPortalapp;res_ManagementPortal;my-secret-token-to-change-in-production;read,write;password,refresh_token,authorization_code,implicit;;ROLE_PROJECT_ADMIN,ROLE_USER,ROLE_SYS_ADMIN;1800;3600;{};true
pRMT;res_ManagementPortal;;read,write;refresh_token,authorization_code;http://localhost:8080;ROLE_USER;43200;5184000;{};true
radar_restapi;res_ManagementPortal,res_gateway;;read;client_credentials;;ROLE_USER;1800;3600;{};true
THINC-IT;res_gateway,res_ManagementPortal;;read,write;password,refresh_token,authorization_code,implicit;;ROLE_PROJECT_ADMIN,ROLE_USER,ROLE_SYS_ADMIN;43200;5184000;{};true
radar_redcap_integrator;res_ManagementPortal;;read,write;client_credentials;;ROLE_EXTERNAL_ERF_INTEGRATOR;1800;2000;{};true
5 changes: 5 additions & 0 deletions dcompose-stack/radar-cp-hadoop-stack/etc/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,10 @@ http {
proxy_pass http://rest-api:8080/radar/frontend/;
proxy_set_header Host $host;
}

location /managementportal/{
proxy_pass http://managementportal-app:8080/;
proxy_set_header Host $host;
}
}
}
2 changes: 2 additions & 0 deletions dcompose-stack/radar-cp-hadoop-stack/etc/smtp.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ SMARTHOST_ADDRESS=mail.example.com
SMARTHOST_PORT=587
[email protected]
SMARTHOST_PASSWORD=XXXXXXXX
SMARTHOST_ALIASES=*.amazonaws.com
RELAY_NETWORKS=:172.0.0.0/8:192.168.0.0/16
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ check_parent_exists HDFS_DATA_DIR_2 ${HDFS_DATA_DIR_2}
check_parent_exists HDFS_NAME_DIR_1 ${HDFS_NAME_DIR_1}
check_parent_exists HDFS_NAME_DIR_2 ${HDFS_NAME_DIR_2}
check_parent_exists MONGODB_DIR ${MONGODB_DIR}
check_parent_exists MP_POSTGRES_DIR ${MP_POSTGRES_DIR}

if [ -z ${SERVER_NAME} ]; then
echo "Set SERVER_NAME variable in .env"
Expand Down
14 changes: 14 additions & 0 deletions images/managementportal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM openjdk:8-jre-alpine

ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
JHIPSTER_SLEEP=0

# add directly the war
ADD https://github.com/RADAR-CNS/ManagementPortal/releases/download/v0.1-alpha/management-portal-0.0.1-SNAPSHOT.war /app.war

VOLUME /tmp
EXPOSE 8080 5701/udp
VOLUME /changelogs
CMD echo "The application will start in ${JHIPSTER_SLEEP}s..." && \
sleep ${JHIPSTER_SLEEP} && \
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -cp /changelogs:/app.war org.springframework.boot.loader.WarLauncher
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
client_id;resource_ids;client_secret;scope;authorized_grant_types;web_server_redirect_uri;authorities;access_token_validity;refresh_token_validity;additional_information;autoapprove
ManagementPortalapp;res_ManagementPortal;my-secret-token-to-change-in-production;read,write;password,refresh_token,authorization_code,implicit;;ROLE_PROJECT_ADMIN,ROLE_USER,ROLE_SYS_ADMIN;1800;3600;{};true
pRMT;res_ManagementPortal;;read,write;refresh_token,authorization_code;http://localhost:8080;ROLE_USER;43200;5184000;{};true
radar_restapi;res_ManagementPortal,res_gateway;;read;client_credentials;;ROLE_USER;1800;3600;{};true
THINC-IT;res_gateway,res_ManagementPortal;;read,write;password,refresh_token,authorization_code,implicit;;ROLE_PROJECT_ADMIN,ROLE_USER,ROLE_SYS_ADMIN;43200;5184000;{};true
radar_redcap_integrator;res_ManagementPortal;;read,write;client_credentials;;ROLE_EXTERNAL_ERF_INTEGRATOR;1800;2000;{};true

0 comments on commit 44fa028

Please sign in to comment.