Hi - I'm trying to use private networking to set up datadog. I have two docker files that start normally: server and datadog. Both seem to run fine.
I enabled private networking for the project already.
- What are the environment variables I can use to refer to the hostnames of the services? I had to hard code them in.
- It doesn't seem like the services are able to talk to one another. I don't see any errors, but I onyl get silence. Is there something off about the way I defined the hostnames below?
- When I run
railway run echo $DD_SERVICEor any similar command to check the environment variables of the service, I don't get anything. Is this ok?
Here are the dockerfiles:
# Start from the official Node.js 18 image
FROM node:18
# Define environment variables
ENV DD_ENV=prod \
DD_LOGS_INJECTION=true \
DD_SERVICE=cami-server \
DD_AGENT_HOST='datadog.railway.internal'
# Create app directory
WORKDIR /usr/src/app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install app dependencies
RUN yarn install --frozen-lockfile
# Copy app source code
COPY . .
# Build the app
RUN yarn run build
# Start the app
CMD [ "yarn", "run", "start" ]
Datadog:
# Start from the official Datadog agent image
FROM datadog/agent:latest
# Copy your Datadog configuration to the correct location
COPY datadog.yaml /etc/datadog-agent/datadog.yaml
# Set the hostname and port
ENV DD_HOSTNAME='datadog.railway.internal' \
DD_LOGS_ENABLED=true \
DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true \
DD_BIND_HOST=::
# Start the Datadog agent
CMD ["/init"]