Docker deploy on Heroku
Service Maps is an Enterprise-only feature
Example repo
Please checkout our example repo to see a full working example: https://github.com/Codesee-io/examples/tree/main/docker-datadog-codesee-bridge-example
Create Dockerfile
This Dockerfile will combine: Datadog agent + CodeSee dd-bridge into 1 single image.
FROM node:20-bullseye
# Datadog required environment variables
ENV DD_APM_ENABLED true
ENV DD_APM_NON_LOCAL_TRAFFIC true
# leave this key as empty but pass in the actual value via docker run. Ex: docker run -e DD_API_KEY=xyz
ENV DD_API_KEY ""
ENV DD_ENV staging
ENV DD_APM_DD_URL http://localhost:8080
# replace with your service name
ENV DD_SERVICE docker-datadog-codesee-bridge-example
# CodeSee required environment variables
ENV CODESEE_BRIDGE_FORWARD_HOST https://in-datadog.codesee.io
# leave this key as empty but pass in the actual value via docker run. Ex: docker run -e CODESEE_BRIDGE_TOKEN=xyz
ENV CODESEE_BRIDGE_TOKEN ""
# optional, un-comment to enable debug logging for Datadog and CodeSee agent
# ENV DD_TRACE_DEBUG true
# ENV CODESEE_ENABLE_ACCESS_LOGS true
# Install GPG dependencies for Datadog
RUN apt-get update \
&& apt-get install -y gnupg apt-transport-https gpg-agent curl ca-certificates
# Add Datadog repository and signing keys
ENV DATADOG_APT_KEYRING="/usr/share/keyrings/datadog-archive-keyring.gpg"
ENV DATADOG_APT_KEYS_URL="https://keys.datadoghq.com"
RUN sh -c "echo 'deb [signed-by=${DATADOG_APT_KEYRING}] https://apt.datadoghq.com/ stable 7' > /etc/apt/sources.list.d/datadog.list"
RUN touch ${DATADOG_APT_KEYRING}
RUN curl -o /tmp/DATADOG_APT_KEY_CURRENT.public "${DATADOG_APT_KEYS_URL}/DATADOG_APT_KEY_CURRENT.public" && \
gpg --ignore-time-conflict --no-default-keyring --keyring ${DATADOG_APT_KEYRING} --import /tmp/DATADOG_APT_KEY_CURRENT.public
RUN curl -o /tmp/DATADOG_APT_KEY_C0962C7D.public "${DATADOG_APT_KEYS_URL}/DATADOG_APT_KEY_C0962C7D.public" && \
gpg --ignore-time-conflict --no-default-keyring --keyring ${DATADOG_APT_KEYRING} --import /tmp/DATADOG_APT_KEY_C0962C7D.public
RUN curl -o /tmp/DATADOG_APT_KEY_F14F620E.public "${DATADOG_APT_KEYS_URL}/DATADOG_APT_KEY_F14F620E.public" && \
gpg --ignore-time-conflict --no-default-keyring --keyring ${DATADOG_APT_KEYRING} --import /tmp/DATADOG_APT_KEY_F14F620E.public
RUN curl -o /tmp/DATADOG_APT_KEY_382E94DE.public "${DATADOG_APT_KEYS_URL}/DATADOG_APT_KEY_382E94DE.public" && \
gpg --ignore-time-conflict --no-default-keyring --keyring ${DATADOG_APT_KEYRING} --import /tmp/DATADOG_APT_KEY_382E94DE.public
# Install the Datadog Agent
RUN apt-get update && apt-get -y --force-yes install --reinstall datadog-agent
# Add CodeSee Datadog Bridge
RUN wget https://github.com/Codesee-io/dd-bridge/releases/download/0.194.0/codesee-dd-bridge.x86_64-unknown-linux-musl.tar.gz
RUN wget https://github.com/Codesee-io/dd-bridge/releases/download/0.194.0/codesee-dd-bridge.x86_64-unknown-linux-musl.tar.gz.sha256
RUN shasum -c codesee-dd-bridge.x86_64-unknown-linux-musl.tar.gz.sha256
RUN tar -xf codesee-dd-bridge.x86_64-unknown-linux-musl.tar.gz
# Copy entrypoint
COPY entrypoint.sh .
# Copy example express app
COPY index.js .
COPY package.json .
RUN npm i
EXPOSE 3000
# Expose DogStatsD and trace-agent ports
EXPOSE 8125/udp 8126/tcp
CMD ["/entrypoint.sh"]
entrypoint.sh
This entry point will start 3 services: Datadog agent, CodeSee dd-bridge service and an example Node application.
#!/bin/bash
# start CodeSee Datadog Bridge
./codesee-dd-bridge &
# start Datadog agent
datadog-agent run &
/opt/datadog-agent/embedded/bin/trace-agent --config=/etc/datadog-agent/datadog.yaml &
/opt/datadog-agent/embedded/bin/process-agent --config=/etc/datadog-agent/datadog.yaml &
# start sample Node app to capture Traces
node index.js
heroku.yml
To run a container under Heroku, define docker in the heroku.yml file
build:
docker:
web: Dockerfile
Add DD_API_KEY and CODESEE_BRIDGE_TOKEN key to Heroku Config Vars
Go to your Heroku App Setting page, add the 2 keys to your Config Vars section:
DD_API_KEY - you can get this key from here: https://app.datadoghq.com/organization-settings/api-keys
CODESEE_BRIDGE_TOKEN - we'll provide you this key during onboarding
Deploy and verify
Deploy your Heroku app and go to Datadog Traces and CodeSee Service Map to verify that your installation is working.
Updated 12 months ago