RHub & Notification Framework - Post Deployment Activities

The RHub can be deployed as two flavors.

  1. RHub on Premise

  2. RHub On PAAS

This document explains deployment of both flavors.

RHub on Premise

The RHub deployment process will install the following components to the target deployment environment.

Container name

Details

rhub_orchestrator

RHub core component which has the execute flow api.

config_manager

Managing the synchronization of the configuration from user to rhub orchestrator and respective adapters.

zookeeper

Component for maintaining configuration information, providing distributed synchronization across rhub orchestrator and respective adapters.

Adapters

echo

api_agent

ps_script

oauth_basic

scheduler

ftp_adapter

oauth_jwt

api_endpoint

xml_json

queue

 

Inbuilt adapters which are providing basic functionalities.

 

<<only required adapters needs to be installed>>>

Create RHub instance

RHub instance creation is important step in the RHub installation. As in the RHub deployment it needs to provide the RHub instance id and RHub secret it is recommended to create the RHub instance in the Central Hub management UI (Chub) before starting the deployment. Central Hub is the management UI that is part of Smartops platform for managing the RHub instances. Following are the steps to create RHub instance in the central hub UI. Please note that the Chub is available in Smartops platform from version 7.5.0 onwards.

  1. Click on the 9dots in the SmartOps ui to open the central hub UI.

    Graphical user interface, application
Description automatically generated

  2. Enter the RHub instance details in the respective fields.

    Graphical user interface, text, application
Description automatically generated

    1. The RHub URL should be the server url of RHub instance running in an exposed location.

  3. Once the RHub instance is created successfully, RHub instance id, RHub secret key will be generated. The RHub instance id and secret will be used during the deployment of RHub components. These values should be set as environment values of respective environment variables in the docker compose files.

     

    Graphical user interface, application, Word
Description automatically generated

     

  4. Next step is to update the RHub configuration to the RHub instance. The configuration shall contain the RHub adapter configuration and RHub flow details. Sample RHub configuration is attached here.

  5. The sync operation (Sync button click) will synchronize the configuration into RHub orchestrator and respective adapters.

  6. Following is the basic structure of RHub configuration

Text, application
Description automatically generated

The configuration of adapters, rhub orchestrator, HA enablement configuration are stored in the configuration file. Below are the details of properties stored in the config file.

 

  • meta\storage_credentials: This element is storing the ACL configuration details of connecting from rhub orchestrator or respective adapter to the zookeeper. The username and password given here should same as the username and password set in the environment variables of respective dockers containers.

    "meta": {

    "storage_credentials": [

    {

    "username": "orchestrator",

    "password": "rotartsehcro",

    "acls": {

    "read": true,

    "write": true

    }

    }

    ]

    }

  • adapters\<<adapter_name>>\state: This section storing the adapter specific information. For example, the oauth_basic has to store the username and password for authentication. The state element will have any information that is used in the adapter.

    {

    "state": {

    "credentials": {

    "password_encryption": "sha512",

    "users": [

    {

    "username": "jay2",

    "password": "sha512 hashed key of password",

    "roles": [

    "admin",

    "cms_processor"

    ]

    }

    ]

    }

    }

    }

  • flows: This element is storing the flows and its steps.

 

 

Pre 7.5.0 version of Smartops platform does not have the Central Hub ui. In that case synchronization of the configuration is not possible thru Chub. The config_manager component’s

API to sync config

  1. Method: POST

  2. URL:

    https://<hostname>/configmanager/rhub/{rhub-instance-id}/configsync

    Eg:- https://smartops-rhub-qa.eastus.cloudapp.azure.com/configmanager/rhub/ced0fa15-564d-4b48-b93d-d8ff15e96d9a/configsync

  3. Headers: Content-Type: application/json

  4. RequestBody :

    {

      // configuration file json. Please refer the sample file here.

    }

  5. PathVariable : variableId

      

Sample curl command -
Note: There is a JWT token based authentication is available for the configsync API. But as the Chub is not available till 7.5.0 it can be disabled. To disable the authentication set the cluster_jwt_check_enabled=OFF in the config_manager docker compose file.

Environment variables

Environment variables used in the docker compose.

Container name

Details

rhub_orchestrator

- chub_base_path=<<URL of the Chub.>>

- rhub_rsa_public_key=<<public key to decode the JWT token>>

- organization_name=<replace_organization_name_here>

- rhub_instance_id=<<instance id generated when the rhub instance is created>>

- cluster_connection_string=zoo1:2181,zoo2:2181,zoo3:2181/<replace_organization_name_here>/<replace_instance_id_here>

- cluster_client_class=cluster_client_lib.clients.zookeeper.ZKClusterClient

- cluster_username=<replace_orch_username_here>

- cluster_password=<replace_orch_password_here>

- RHUB_TOKEN=<<rhub secret tcken generated during the rhub instance creation>>

config_manager

- cluster_connection_url=zoo1:2181,zoo2:2181,zoo3:2181

- cluster_organization_name=<replace_organization_name_here>

- cluster_username=<replace_cluster_username_here>

- cluster_password=<replace_cluster_password_here>

- cluster_class=cluster_client_lib.clients.zookeeper.ZKClusterClient

- cluster_instance_id=<<instance id generated when the rhub instance is created>>

- cluster_chub_base_path=https://smartops-qa01.eastus.cloudapp.azure.com/chub

- cluster_service_token=<<rhub secret token generated during the rhub instance creation>>

- cluster_public_key=<replace_key_here>

- cluster_jwt_check_enabled=OFF

- cluster_init_config_sync_enabled=OFF

zookeeper

- ZOO_MY_ID=2

-ZOO_SERVERS=server.1=zoo1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181 server.3=zoo3:2888:3888;2181

- ZOO_STANDALONE_ENABLED=false

- JVMFLAGS=-Xmx1024m

Adapters

 

 

Docker Compose files

Docker compose file for references.

      

URL Rewrite Configuration for Windows VM

The purpose of this change is to redirect the request coming from clients to RHub and ConfigManager. If the request URL has a patter with “orchestrator” then it should redirect to rhub orchestrator. If the request URL has a patter with “configmanager” then it should redirect to Config Manager.

  1. Open the IIS in windows server.

  2. Open the URL Rewrite option for the respective site.

  3. Add inbound rule. Please find the below screenshots for references.

Text, application
Description automatically generated

 

Graphical user interface, text, application, email
Description automatically generated

Nginx Configuration for Linux VM

TBD

RHub on PAAS

Setup WAF rules

Following patterns of URL has to be added in the Application Gateway WAF policy for the core platform.

Please find the following screenshot for reference.

The above url patterns are “allowed” and must take precedence over “blocked” rules. (Note the position of IncludePlatformRules and RabbitMQPHPMyAdmin001.)

Execute the Sync operation once this is done to make sure the communication in between applications is works fine.

Note: For integrating a new adapter we should add adapter details in the adapters section of the configuration as in the image below.

If a valid adapter config is missing healthcheck error will occur as in the image below. Please refer below section.

Values for default RHub instance

Notification Framework

Setups to be done in the target environment

Install AMQP 1.0 plugin in the target environment. The notification framework is using AMQP 1.0 for connecting to rabbitmq. After the plugin installation it requires a restart to reflect the changes in the environment.

Setup Offline Token

If you have done fresh installation, make sure that you generate offline token for Ustglobal Organization and its available in the secret key vault. The offline token is required to communicate from notification framework to user data store.

Notification Framework

Add the flow file mentioned in the above step and click the Save and Sync button.

Create User data store (UDS) objects in the environment

use user_data_store
‎db.getCollection("appregistration").updateMany({}, {"$unset": {"organization": 1}})

{

"customData": {

"document-extracted": {

"channels": [

{

"email": [

"ihubdemo@gmail.com"

]

}

]

}

}

}

 

Steps to configure email notification

Following are the steps to configure and send email notification.

Create outbound email channel in iHub

Open the iHub and create an outbound email channel

Create queue channel in iHub with destination as outbound email channel

Configure the rabbitmq_amqp adapter in Rhub configuration and synchronize

Open RHub from the platform UI and open the rhub instance.

Edit the configuration file and add the rabbitmq_amqp adapter

Get the queue name, routing key & exchange name from the rabbit mq console and update the same in the rabbitmq_amqp adapter configuration

Create flow to invoke rabbitmq_amqp adapter

{

"id": "rabbitmq_amqp_flow",

"required-role": [

"admin",

"cms_processor"

],

"auth": {

"adapterId": "oauth_basic",

"source": "oauthadapter",

"sensitivepayload": {

"token": "$input.body.sensitivepayload.token"

}

},

"variables": {

"API-KEY": "https://covid-19-data.p.rapidapi.com/totals",

"key2": {

"dateparam": "20/02/20201",

"subkey2": "value"

}

},

"steps": [

{

"id": "step_1",

"type": "SYNC",

"adapterId": "rabbitmq_amqp",

"name": "invoke sync1",

"description": "",

"payload": {

"response": {

"data": "json"

},

"headers": {},

"email_object": "$input.body.payload.email_object"

},

"sensitivepayload": {},

"executionId": "$input.body.payload.email_object.executionId",

"correlationId": "$input.body.payload.email_object.correlationId",

"attachments": []

}

],

"type": "SYNC",

"responsepayload": {

"correlationId": "$step.step_1.correlationId",

"mailresponse": "$step.step_1.payload.response.data"

},

"responseStatus": {}

}

Configure new queue in the rhub queue listener adapter and map to the rabbitmq_amqp flow

{

"queue1": {

"queue_host": "amqp://admin:j5c6ym6nFm8M2Yia@smartopsv1-dev03-rabbitmq:5672/notification",

"queue_type": "rabbit",

"queue_name": "inapp",

"flow": "wwwinapp1222",

"flow_url": "https://smartops-dev03.eastus.cloudapp.azure.com/orchestrator/rhub/execute/inappflow",

"payload": {

"url": "https://smartops-dev03.eastus.cloudapp.azure.com/notification-inapp-api/api/v1/notifications",

"method": "post",

"version": "1",

"version1": "15",

"user_id": "$input.body.user_id",

"organization_name": "$input.body.organization_name",

"type": "$input.body.type",

"module": "$input.body.module",

"event_id": "$input.body.event_id",

"notification_obj": "$input.body.notification_obj",

"message": "$input.body.message",

"timestamp": "$input.body.timestamp",

"expiry": "$input.body.expiry",

"priority": "$input.body.priority",

"meta": "$input.body.meta"

},

"sensitivePayload": {

"api_token": "jwt generated by notification framework",

"token": "Basic amF5OmhlbGwwd29ybGQ="

},

"attachments": {}

}

}

Send notification

curl --location --request POST 'https://smartops-dev03.eastus.cloudapp.azure.com/notification-consumer-api/api/v1/notifications/' \

--header 'token: Basic 123' \

--header 'organization-name: ustglobal' \

--header 'Content-Type: application/json' \

--data-raw '{

"userIds": [

"smartops"

],

"module": "clones1",

"type": "alerts",

"event_id": "document-extracted",

"notification_obj": {"subject": "Document Extraction successfully completed", "username": "bct user", "document_name": "this is default msg 1.pdf"},

"message": "testing 1",

"timestamp": "2021-09-16T10:20:30",

"expiry": "2021-09-16T10:20:30",

"priority": 0

}'

 

Appendix

File structure and details of RHub Configuration

Rhub configuration is the json file which keeps the settings of RHub and adapters. It stores the declaration of adapters, flow configuration.

Swagger URLs for APIs