Skip to content

Commit

Permalink
Merge pull request #5 from DataDog/sarahchen6/update-readme-for-docke…
Browse files Browse the repository at this point in the history
…r-usage

Update readme for Docker usage
  • Loading branch information
lloeki authored Oct 22, 2024
2 parents bab0bc1 + ff93444 commit 7947565
Showing 1 changed file with 70 additions and 28 deletions.
98 changes: 70 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,36 @@

## Quick start

### Using Docker

Run the following command to start a new Docker container with `catadog`.

```
docker run --rm -d --name catadog ghcr.io/datadog/catadog
```

### or Ruby Bundler

Run the following commands to install and run `catadog` locally.

```
git clone https://github.com/DataDog/catadog
cd catadog
bundle install
bundle exec catadog
```

Now start your agent and app!
### Now start your agent and app!

Remember to do either one of:
Remember to do one of the following:

- configure your app's agent connection to hit on the correct port
- configure your agent to listen to another port, and have `catadog` listen on 8126 as the default and point to the new agent's port by using the settings below
- configure your agent to listen to another port, have `catadog` listen on 8126 as the default, and point to the new agent's port by using the settings below

## Examples

_**Note that if using Docker, replace `bundle exec catadog` with `docker run ghcr.io/datadog/catadog` in the examples below.**_

Change listening host and port (defaults to 127.0.0.1:8128)

```
Expand Down Expand Up @@ -60,6 +74,12 @@ Bring your own mock! (you can use `--mock` multuiple times)
bundle exec catadog --mock /path/to/mock.rb:MockMiddlewareClass --no-forward
```

Run program as a background process

```
bundle exec catadog --daemon
```

Select specific areas:

```
Expand Down Expand Up @@ -135,6 +155,53 @@ Show the contents of the blocked ips list:
bundle exec catadog | jq 'select(.kind=="rc") | .response.body.target_files | .[] | select(.path | test("ASM_DATA/blocked_ips"))'
```

## Using Docker Compose

By leveraging the `docker-compose.yaml` file, you can automatically connect your app to `catadog` and your datadog agent.

First, [instrument your app](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/ruby/#instrument-your-application) with the datadog gem.

Then, include the following environment variables in a `.env` file.

```
DD_ENV=env-name.dev
DD_HOSTNAME=host-name
DD_API_KEY=<api_key>
```

Update your `docker-compose.yaml` such as below.

```
services:
app:
...
catadog:
image: ghcr.io/datadog/catadog:latest
command: --agent-host agent
depends_on:
- agent
ports:
- "8126:8128"
agent:
image: datadog/agent
env_file:
- ".env"
environment:
- DD_APM_ENABLED=true
- DD_BIND_HOST=0.0.0.0
- DD_APM_NON_LOCAL_TRAFFIC=true
- DD_REMOTE_CONFIGURATION_ENABLED=true
```

Run the following commands.

```
docker compose build
docker compose up -d
```

Finally, see your app send traces to `catadog`!

## The big idea

*dd-trace-cat*
Expand All @@ -158,28 +225,3 @@ TODO:
- *traces*: GUI like dd-trace-cat
- *all*: mock (static, dynamic)
- *all*: record, replay

























0 comments on commit 7947565

Please sign in to comment.