DataDog / heroku-buildpack-datadog

Heroku Buildpack to run the Datadog Agent in a Dyno
https://www.datadoghq.com/
Apache License 2.0
72 stars 93 forks source link

Running dd-agent in heroku containers #381

Open Parad0X opened 2 months ago

Parad0X commented 2 months ago

I'm trying to follow the instructions to setup dd-agent using Docker containers in Heroku but I ran into two issues:

1) datadog-agent won't start without DD_HOSTNAME being set. There's code in datadog.sh that sets it but how is DD_HOSTAME supposed to be set without the buildpack?

https://github.com/DataDog/heroku-buildpack-datadog/blob/2f197c9a5c099f9aaef08a7d39a7399bf06d35de/extra/datadog.sh#L116-L138

2) CMD ["./scripts/entrypoint.sh"] does not start the agent. I can't find anything in Heroku documentation that would explain how to run multiple processes in a container. If I just run the script from the command line in the dyno the agent starts, there are no errors.

3) PS. It would also be helpful to have an example of minimal datadog.yaml config file to get everything going using Docker.

jyee commented 1 month ago
  1. You can set DD_HOSTNAME as an environment variable in Heroku and it will be passed to the container.
  2. In a docker file, only the last CMD will be executed. The simplest way to work around this is to create a small script file that you can call from the CMD line. In that script file, you can call entrypoint.sh and start whatever other process you need.
Parad0X commented 1 month ago
  1. Makes sense. But in this case if I have multiple dynos which all have their unique internal host names, this information will be lost and in DD their traces will be all grouped together.
  2. Yes but there's also heroku.yml which specifies a run command for each type of dyno and they all share the same Dockerfile so I don't see how that's going to work.

Thank you for your help, @jyee 🙏