Using Amazon ECS
In this guide, we will be using Goreplay to mirror the traffic to HyperTest. Goreplay will be added as a sidecar container in your ECS deployment.
Update your service's task definition and add Goreplay as another container in it.
Brief Steps:
Create a new revision of task definition
Change the network mode to host so containers can talk to each other
Add container with details - Name, image and Env Variables
Create revision
Update service to latest task definition
Change of network mode to Host is necessary for containers to be on same network
1. Required Parameters to run Goreplay:
APPLICATION_PORT: <port on which your app is running>
HYPERTEST_LOGGER_URL: <hypertest-vm-ip>:<hypertest-logger-port> or <hypertest_service_logger_ingress_url>
HT_ENV: <your env name> # for eg: test, staging, etc
2. Create new revision with JSON
Go to the task definition
Select the latest version
Create new revision with JSON from latest one
Add the following json lines for sidecar container inside containerDefinitions
2. Create the new revision via Old UI
Go to the task definition
Select the latest version
Create new revision from latest one
Select Network mode as Host
Scroll down and click on Add Container
A dialog box will open for container details, enter the below one for the same
New Container Details:
Container name - goreplay
Image: public.ecr.aws/hypertestco/goreplay:0.16.1-24-02-2023
Memory Limit: Soft Limit: 300MB
Scroll down to ENVIRONMENT header and add below env variables:
APPLICATION_PORT: <your-application-port>
HYPERTEST_LOGGER_URL: <hypertest-logger-url>" #for eg: 1.2.3.4:8000
HT_ENV: <your env name> # for eg: test, staging etc\
Scroll down and add container
Now the container window is closed, then scroll to end and click on create on create the new revision from bottom right.
3. Update Service to latest task definition
Go to your service in cluster
Stop already running task
Click on update from right side
Select the latest revision of task definition
Keep on Clicking on Next Step and update service in end
After successful update, verify from tasks details that there are two containers running
To Verify the mirroring setup, hit any api on the application and check for request in "last mirrored requests" section or Session page in HyperTest.
Debug mirroring setup via Goreplay
To debug if goreplay is receiving the traffic from your application, we will output the incoming traffic to stdout, so we can see if Goreplay is receiving requests.
Steps:
Exec into the goreplay container using below command:
2. Run the following command:
Now hit any api on your application and verify if Goreplay is able to receive it.
Last updated