Integrate Akamas with Dynatrace Cloud Automation
Integrating Dynatrace Cloud Automation with Akamas enables developers, performance engineers, DevOps, and SREs to automatically optimize their applications in terms of performance, resilience, and cost efficiency (according to any defined application-specific goal), when these applications are released into staging or other testing environments. The integration of Akamas with Cloud Automation ensures that services provide the highest quality at the lowest possible cost.
To integrate Dynatrace Cloud Automation with Akamas, follow the instructions below.
Prerequisites
Akamas
-
Set up an optimization study and save the study ID for later use.
-
Install the Akamas pre-built container on the Akamas server. This container will act as a bi-directional bridge between the Akamas study and Cloud Automation webhooks. Make sure the host and port 6000 are publicly reachable on the Akamas server. Note that port 6000 is the predefined port; to use a different host or certificate, please contact Akamas support.
- Create an application directory, such as
/usr/local/cloudautomation
. In the application directory, download the files below.
1curl https://akamas.s3.us-east-2.amazonaws.com/integrations/keptn/docker-compose.yml -o docker-compose.yml2curl https://akamas.s3.us-east-2.amazonaws.com/integrations/keptn/env.templ -o env.templ- To expose the integration API called by the Cloud Automation webhook via HTTPS, edit
docker-compose.yml
by replacing the value of thevolumes
parameter with the location of your certificate directory specified when enabling HTTPS on Akamas. - Rename the
.env.templ
file to.env
, then edit the file by replacing the values of theKEPTN_URL
andKEPTN_TOKEN
variables with your own values, and save the file. Start the container.
1docker-compose up -d - Create an application directory, such as
Dynatrace
-
Create a Cloud Automation project with a shipyard file, and a task (for example,
optimize
) to trigger Akamas optimization in the desired stage (for example,staging
). -
Create a Cloud Automation secret for Akamas.
-
On the Cloud Automation bridge, select your Cloud Automation project.
-
Select Settings, and then select Secrets.
-
Select Add Secret and enter the following values:
-
Name: Enter a name for the secret (for example,
akamas
). -
Scope: Select
keptn-webhook-service
. -
Key/Value: Enter your values for the key/value pair (for example,
key: pwd
,value: <a_base64_encoded_user:password_combination>
1).1If the user is
akamas
and the password istestpassword
, the combineduser:password
(akamastestpassword
) is encoded intoYWthbWFzOnRlc3RwYXNzd29yZA==
. To easily encode your password, see Encode to Base64 format.
-
-
Select Add secret.
-
Set up the Akamas webhook subscription
-
On the Cloud Automation bridge, select your Cloud Automation project.
-
Select Settings, and then select Integrations.
-
Select webhook-service from the list, and then select Add subscription.
-
Enter the following values:
- Task: Select the task associated with your shipyard file (in this case,
optimize
). - Task suffix: Select
triggered
. - Request method: Select
POST
. - URL: Enter your URL endpoint
https://<akamas-url>:6000/v1/study-run
(make sure to replace<akamas-url>
with your actual Akamas URL).
- Task: Select the task associated with your shipyard file (in this case,
-
Select Add custom header and enter the following values:
- For Name, enter
Authorization
. - For Value, enter
Basic {{.secret.<secret_name>.<key_name>}}
, making sure to replace<secret_name>
with the name of your secret and<key_name>
with the key name you entered when creating the Cloud Automation secret (see Prerequisites). Example:{{.secret.akamas.pwd}}
.
- For Name, enter
-
Enter a Custom payload.
Example:
Be sure to replace
<study-id>
with your Akamas study ID.1{2 "study-id": "<study-id>",3 "project": "{{.data.project}}",4 "stage": "{{.data.stage}}",5 "service": "{{.data.service}}",6 "type": "{{.type}}",7 "shkeptncontext": "{{.shkeptncontext}}",8 "triggeredid": "{{.id}}"9} -
Under Send finished event, select
by webhook receiver
. -
Select Create subscription.
Trigger a sequence
Cloud Automation triggers Akamas whenever the defined task in the sequence is triggered:
When the task associated with the Akamas optimization in the sequence is executed, Cloud Automation triggers the corresponding webhook service.
The webhook service launches the Akamas optimization, which is executed on the Akamas side.
After the Akamas optimization ends, the finished event with the result of the Akamas optimization is sent to Cloud Automation.
To trigger the sequence, follow the steps below.
- Create a file named
triggered-event.json
.
Example:
1{2"type": "sh.keptn.event.mystage.mysequence.triggered",3"specversion":"1.0",4"source":"manual-trigger",5"data":{6"project":"myproject",7"stage":"mystage",8"service":"myservice"9}10}
Send the event.
1keptn send event --file triggered-event.json
After sending the event, you can
Monitor the sequence progress on the Cloud Automation sequence page of the project
Monitor the Akamas study progress