Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 7173ab3

Browse files
author
Aaron Kalin
authored
Merge pull request #154 from DataDog/aaron.kalin/traffic_container
Traffic Container Improvements
2 parents 3c871ab + fa512bc commit 7173ab3

File tree

8 files changed

+94
-1628
lines changed

8 files changed

+94
-1628
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Traffic Replay Container
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- traffic-replay/**
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v1
22+
- name: Setup Docker Buildx
23+
uses: docker/setup-buildx-action@v1
24+
- name: Login to Docker Hub
25+
uses: docker/login-action@v1
26+
with:
27+
username: ${{ secrets.DOCKERHUB_USERNAME }}
28+
password: ${{ secrets.DOCKERHUB_TOKEN }}
29+
- name: Build and Push Docker Image
30+
uses: docker/build-push-action@v2
31+
with:
32+
context: ./traffic-replay
33+
platforms: linux/amd64 # TODO: Support linux/arm64?
34+
push: true
35+
tags: ddtraining/traffic-replay:latest

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ This way, we don't have to manually click around the site to see all the places
6969

7070
### Containerized replay
7171

72+
#### Building and running manually
73+
7274
Example traffic can be perpetually sent via the `traffic-replay` container. To build and run it via Docker and connect it to your running cluster in docker-compose (by default the docker-compose_default network is created).
7375

7476
```
@@ -85,15 +87,15 @@ environment:
8587
- FRONTEND_PORT=80
8688
```
8789
88-
### Local replay
90+
#### Running via Docker Compose
8991
90-
You can reuse the recorded traffic ad-hoc:
92+
We automatically build new traffic-replay containers on every release and you can spin up the traffic-replay container with your Docker Compose cluster by adding the config as an override via the example below.
9193
92-
```bash
93-
$ ./gor --input-file-loop --input-file requests_0.gor --output-http "http://localhost:3000"
94+
```
95+
POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres docker-compose -f deploy/docker-compose/docker-compose-broken-instrumented.yml -f deploy/docker-compose/docker-compose-traffic-replay.yml up
9496
```
9597

96-
This command opens up the traffic recording, and ships all the requests to `localhost`, at port 3000. After running this traffic generator for a while, we'll be able to see the services that make up our application within Datadog.
98+
Any of the other docker compose configurations can work with this traffic container just by adding another `-f deploy/docker-compose/docker-compose-traffic-replay.yml` to the compose command.
9799

98100
## Viewing Our Broken Services in Datadog
99101

UPDATING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Maintenance and Upgrade Guide
2+
3+
## Rails Apps
4+
5+
To upgrade any new gems in the Gemfile do the following procedure. To install new gems, replace the `bundle upgrade` with `bundle install`
6+
7+
### For the broken and instrumented storefront
8+
9+
```
10+
cd store-frontend-broken-instrumented
11+
docker run --interactive --tty --rm --name storefrontdev --mount type=bind,source="$(pwd)",target=/app ddtraining/storefront:latest /bin/bash
12+
# bundle upgrade
13+
# exit
14+
```
15+
16+
Commit the new Gemfile and Gemfile.lock
17+
18+
### For the fixed and instrumented storefront
19+
20+
```
21+
cd store-frontend-instrumented-fixed
22+
docker run --interactive --tty --rm --name storefrontdev --mount type=bind,source="$(pwd)",target=/app ddtraining/storefront-fixed:latest /bin/bash
23+
# bundle upgrade
24+
# exit
25+
```
26+
27+
Commit the new Gemfile and Gemfile.lock

deploy/docker-compose/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ They currently exist in three different versions:
1212

1313
`docker-compose-fixed-instrumented`: View a fixed application and compare it to the previously broken deployment.
1414

15+
`docker-compose-traffic-replay`: Simulate traffic to the application.
16+
1517
The application itself runs on `docker-compose`. First, install Docker along with docker-compose. Then sign up with a trial [Datadog account](https://www.datadoghq.com/), and grab your API key from the Integrations->API tab.
1618

17-
To run any of the scenarios:
19+
To run any of the scenarios, be in the root directory:
1820

1921
```bash
2022
$ git clone https://github.com/DataDog/ecommerce-workshop.git
21-
$ cd ecommerce-workshop/deploy/docker-compose
22-
$ POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres DD_API_KEY=<YOUR_API_KEY> docker-compose -f <docker_compose_with_your_selected_scenario> up
23+
$ cd ecommerce-workshop
24+
$ POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres DD_API_KEY=<YOUR_API_KEY> docker-compose -f deploy/docker-compose/<docker_compose_with_your_selected_scenario> up
2325
```
2426

2527
With this, the docker images will be pulled, and you'll be able to visit the app.
2628

27-
When you go to the homepage, you'll notice that, although the site takes a while to load, it mostly looks as if it works. Indeed, there are only a few views that are broken. Try navigating around the site to see if you can't discover the broken pieces.
29+
When you go to the homepage, you'll notice that, although the site takes a while to load, it mostly looks as if it works. Indeed, there are only a few views that are broken. Try navigating around the site to see if you can't discover the broken pieces.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: '3'
2+
services:
3+
traffic-replay:
4+
image: "ddtraining/traffic-replay:latest"
5+

gor

-17 MB
Binary file not shown.

0 commit comments

Comments
 (0)