Categories:
Aura Bridge make-up process
The current section describes the make-up processes that take place within Aura Bridge
Environment variables for Aura bridge make-up
Mandatory environment variables
AURA_ENVIRONMENT_NAME
AURA_MICROSOFT_AZURE_STORAGE_ACCESS_KEY
AURA_MICROSOFT_AZURE_STORAGE_ACCOUNT
AURA_MONGODB_PASSWORD
AURA_MONGODB_URI
AURA_MONGODB_USERNAME
AURA_VERSION
Optional environment variables
These optional variables, together with their default values, are shown below.
AURA_LOCALE_FOLDER # Default: ./locale
AURA_LOCALE_REMOTE_CONTAINER # Default: 'static-resources
AURA_LOCALE_REMOTE_CONTAINER_PREFIX # Default: aura-bridge/locale
AURA_MAKEUP_MODE # Default: full
AURA_MICROSOFT_AZURE_STORAGE_CONFIGURATION_CONTAINER # Default: aura-configuration
AURA_MONGODB_POOL_SIZE # Default: 60
AURA_MONGODB_SSL # Default: false
AURA_SWAGGER_LOCAL_CORE_PATH # Default: swagger-core.yaml
AURA_SWAGGER_LOCAL_PATH # Default: swagger.yaml
AURA_SWAGGER_REMOTE_CONTAINER_PREFIX # Default: swagger
BRIDGE_MONGODB_DATABASE_CACHE # Default: aura-bridge
Manage MongoDB Indexes
In this task, the make-up is responsible for creating the necessary indexes in the MongoDB database. These indexes will only be created if the AURA_MAKEUP_MODE variable is configured to “full”.
The indexes configuration file is in /settings/makeup/aura-bridge-mongodb-indexes.json. An example of this file is shown below.
{
"version":2.3,
"databases": {
"aura-bridge-caches": {
"directline-cache": {
"version": 1,
"indexes": [
{
"version": 1,
"name": "idx_item_caches",
"keys": {
"item": 1
},
"unique": true
},
{
"version": 1,
"name": "idx_ttl_caches",
"keys": {
"lastAccess": 1
},
"expireAfterSeconds": 3600
}
]
},
"dev-behavior-cache": {
"version": 2,
"indexes": [
{
"version": 2,
"name": "idx_ttl_caches",
"keys": {
"lastAccess": 1
},
"expireAfterSeconds": 3600
}
]
},
"bridge-message-queue": {
"version": 2.3,
"indexes": [
{
"version": 2.2,
"name": "idx_ttl_caches",
"keys": {
"expiresAt": 1
},
"expireAfterSeconds": 0,
"force": true
},
{
"version": 2.2,
"name": "idx_queue_search",
"keys": {
"conversationId": 1,
"requestId": 1
},
"force": true,
"unique": false
},
{
"version": 2.2,
"name": "idx_first_message",
"keys": {
"conversationId": 1,
"requestTimestamp": 1,
"responseTimestamp": 1
},
"unique": false,
"force": true
},
{
"version": 2.2,
"name": "idx_ack_find",
"keys": {
"responseId": 1
},
"unique": false,
"force": true
},
{
"version": 2.3,
"name": "idx_ack_find_async_id",
"keys": {
"asyncResponseId": 1
},
"unique": false,
"force": true
}
]
}
}
}
}
Once the make-up is executed, this file will be uploaded to the assigned repository [AURA-STORAGE]/aura-configuration/[AURA_VERSION]/aura-bridge-mongodb-indexes.json. If this remote file exists, it has priority over the local file.
This configuration is assigned in the make-up process by means of the following model:
const options: MakeupMongoIndexManagerOptions = {
mongodbConfiguration: {
AURA_MONGODB_URI: configuration.AURA_MONGODB_URI,
AURA_MONGODB_DB_NAME: configuration.BRIDGE_MONGODB_DATABASE_CACHE,
AURA_MONGODB_USERNAME: configuration.AURA_MONGODB_USERNAME,
AURA_MONGODB_PASSWORD: configuration.AURA_MONGODB_PASSWORD,
AURA_MONGODB_POOL_SIZE: configuration.AURA_MONGODB_POOL_SIZE,
AURA_MONGODB_SSL: configuration.AURA_MONGODB_SSL
},
fileConfiguration: {
containerName: 'aura-configuration',
localPath: 'settings/makeup',
remotePath: '',
files: [{ name: 'aura-bridge-mongodb-indexes.json', mimeType: 'application/json' }]
},
replaceLocalWithRemote: true,
storageCredentials: {
storageKey: configuration.AURA_MICROSOFT_AZURE_STORAGE_ACCESS_KEY,
storageName: configuration.AURA_MICROSOFT_AZURE_STORAGE_ACCOUNT
},
uploadFromLocalToRemote: true,
auraVersion: configuration.AURA_VERSION,
ignoreDownloadErrors: true,
ignoreUploadErrors: true,
dataBaseSuffix: configuration.AURA_ENVIRONMENT_NAME
}
Prepare Locale Resources
This task will only be created if the AURA_MAKEUP_MODE variable is configured to full.
The language resources in aura-bridge are located in /locale/:
en-gb.json
es-es.json
When starting an aura-bridge, these files are loaded remotely from [AURA-STORAGE]/static-resources/aura-bridge/[AURA_VERSION]/locale/.
In the make-up process, the language resources are uploaded to Azure Storage.
Prepare unified swagger
aura-bridge is composed of a set of plugins in which each one is responsible for a single task. Processor or API plugins can have a swagger that defines the complete definition of the service.
In this task, the make-up process is responsible for unifying all these swaggers defined in each plugin in a single and unified swagger. This swagger is used by the oastool in the server’s start-up phase.
To create this unified swagger, the make-up process uses a swagger-core.yaml file that defines the base of the final swagger file.
The process for the creation of this unified swagger is as follows:
- The
swagger-core.yamlfile is used as a base. - Each
swagger.yamlfile of each plugin is merged with theswagger-core.yaml:- Fields
'components.schemas','components.securitySchemes'and'paths'are merged usingObject.assign. - Field
'tags'is added usingArray.push.
- Fields
graph LR
subgraph Unified swagger from plugins and swagger-core.yaml
A[swagger-core.yaml] --> Z[swagger.yaml]
B[swagger.yaml -> admin-plugin] --> Z[swagger.yaml]
C[swagger.yaml -> whatsapp-incoming-processor] --> Z[swagger.yaml]
D[swagger.yaml -> genesys-directline-processor] --> Z[swagger.yaml]
end
It is important to know that entities with the same name defined in different plugins will be overwritten and the last processing will be used during the Swagger unification process (as in paths and securityschemes).