Categories:
Hot swapping of Aura applications configuration
Guidelines to execute modifications in Aura applications configuration through a hot swapping process
Prerequisites
-
The URL of aura-configuration-api must have the following format:
https://{{aura-services-domain}}.auracognitive.com/aura-services/v2/configurationwhere:{{aura-services-domain}}should besvc-[country]-[environment], for instancesvc-es-pre
-
Recommended:
kubectlinstalled in your local host.curlinstalled in your local host.jqinstalled in your local host.
Access Aura Configuration API
Get the APIKey
First, we must get the APIKey, AURA_AUTHORIZATION_HEADER, of aura-configuration-api. For this purpose, follow these steps:
-
Execute the following command:
# substitute {{aura-environment}} with the environment you're configuring export AURA_ENVIRONMENT={{aura-environment}} $ kubectl -n $AURA_ENVIRONMENT get secret aura-configuration-api -o json | jq -r ".data.AURA_AUTHORIZATION_HEADER|@base64d -
Copy the value of APIKey.
Update the application configuration
To update the configuration of an application, we must make a patch to the aura-configuration-api indicating the application that we want to modify and the new value:
- Execute the next curl to update configuration:
# generate a valid UUID as correlator
# substitute {{correlator}} with the generated UUID
# substitute aura-services-domain with the specific information for environment, svc-[country]-[environment].
# substitute {{applicationId}} with the value of application to change
# substitute {{apikey}} with the value of APIKey get in the previous step
$ curl --location --request PATCH 'https://{{aura-services-domain}}.auracognitive.com/aura-services/v2/configuration/applications/{{applicationId}}' \
--header 'correlator: {{correlator}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: {{apikey}}' \
--data-raw '{
"id": "{{applicationId}}",
// Send the object to update
}
}'
- Check the change through the following request:
# generate a valid UUID as correlator
# substitute {{correlator}} with the generated UUID
# substitute aura-services-domain with the specific information for environment svc-[country]-[environment].
# substitute {{applicationId}} with the value of application to change
# substitute {{apikey}} with the value of APIKey get in the previous step
# The response will be the application configuration.
$ curl --location --request GET 'https://{{aura-services-domain}}.auracognitive.com/aura-services/v2/configuration/applications/{{applicationId}}' \
--header 'correlator: {{correlator}}' \
--header 'Accept: application/json' \
--header 'Authorization: {{apikey}}'
ℹ️ NOTE: The config-watcher runs periodically (every 5 minutes) and when it detects that the application configuration has been modified, it will restart the pods.