R
Railway•2y ago
johns

Recommended way of connecting datadog-agent

I saw a thread that the template is broken. What's the recommended way to do it?
35 Replies
Percy
Percy•2y ago
Project ID: 120b5ec5-59d8-4087-84ae-4e0b3d934aa7
johns
johnsOP•2y ago
120b5ec5-59d8-4087-84ae-4e0b3d934aa7
Brody
Brody•2y ago
have you tried the template yourself?
johns
johnsOP•2y ago
yes, started running it but trying to figure out how it would be able to ingest information from the server instance which is separate How does networking work across different "Github Repos" that are running?
johns
johnsOP•2y ago
I'm asking a Railway question not a Datadog question. If Datadog wants to pull data from a docker application, I'm pretty sure it needs networking https://docs.datadoghq.com/containers/docker/apm/?tab=linux#tracing-from-other-containers. From what I understand, Railway doesn't support docker-compose but I don't know if the services that are spun up in a single application is actually connected on a network which is why I am asking
Datadog Infrastructure and Application Monitoring
Tracing Docker Applications
Datadog, the leading service for cloud-scale monitoring.
Brody
Brody•2y ago
No, there is no internal networking at the moment. Ideally you will want to run the datadog agent alongside your application so the agent can monitor the program inside the container, and that's why I sent the link to the datadog docs. I personally don't see the point of running a separate service for the agent then having your app call the agents API when your app could call the datadog API directly instead, that's why it makes more sense to me to run the agent from the same container as your app
johns
johnsOP•2y ago
I was just worried about coupling of memory management since DDAgent hogs some by default and it was unclear to me how much resource Railway allocates to the server pod
johns
johnsOP•2y ago
Django application monitoring with datadog
Django application monitoring allows us to analyze the pitfalls of the application so that we can fix it and improve the application.
johns
johnsOP•2y ago
So that the server instance just runs datadog in it itself
Brody
Brody•2y ago
On the dev plan you get 8gb
johns
johnsOP•2y ago
I see I see it's 8vcpu right?
Brody
Brody•2y ago
Correct
johns
johnsOP•2y ago
What's the default nixpacks used for Django? I wanted to modify it but I didn't want to change anything with the existing things that it does
Brody
Brody•2y ago
Not quite sure what you mean
johns
johnsOP•2y ago
I would want to run
bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"
bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"
basically somewhere for building the container image, but it seemed like based on the screenshot provided, Railway detects the language and by default uses some template setup script (which seems to be a nixpacks plan). Is my understanding wrong?
johns
johnsOP•2y ago
Fyi - I haven't added a Dockerfile nor a nixpacks in the root of my project
Brody
Brody•2y ago
Ah got it, to chain build / install scripts you do need to add a nixpacks.toml file https://nixpacks.com/docs/configuration/file Read the whole page and you'll be set
johns
johnsOP•2y ago
Is there a default nixpacks that gets used behind the scenes already for our app (Python + Django + psql + Redis)? Just so that I have something as a reference
Brody
Brody•2y ago
You have the wrong idea, you don't need to define an entire nixpacks.toml file, just define anything extra you need Read the page and you'll understand
johns
johnsOP•2y ago
Hmm ok on it
Brody
Brody•2y ago
For example if you don't define any providers all the defaults will be used
johns
johnsOP•2y ago
ah I see. How can I leverage env variables in the script? Just regular shell script $<env_var_name>?
Brody
Brody•2y ago
That's a good question Let me look into it Will take a bit, I'm on mobile so I can't do much you can set DD_API_KEY and whatever else is needed in the service variables, then the variables will be available to that datadog install script, no need to define any variables in the nixpacks.toml file
[phases.install]
cmds = ['...', 'bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script_agent7.sh)"']
[phases.install]
cmds = ['...', 'bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script_agent7.sh)"']
... will run the default install command(s)
johns
johnsOP•2y ago
I ended up just doing it in the Procfile because I didn't want to experiment with nixpacks, but figured it should work too For future reference, I just did: 1. Set DD_API_KEY and DD_AGENT_MAJOR_VERSION in the env 2. The following for Procfile
web: bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" && python manage.py migrate && ddtrace-run gunicorn backend.wsgi --workers=4
web: bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" && python manage.py migrate && ddtrace-run gunicorn backend.wsgi --workers=4
Brody
Brody•2y ago
youd want to install the dd agent at build time, procfile runs after build
johns
johnsOP•2y ago
Yeah haha will change it
Brody
Brody•2y ago
sounds good, glad you got it working though!
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Rafal - Pirate nation quest
how to run it inside ? should we create a Dockerfile and add the agent in the Dockerfile? do you have any ressource? the template Datadog agent is misleading
Brody
Brody•2y ago
id recommend exactly what you are proposing, use a dockerfile and run the agent alongside the app
Anthony 🦅
Anthony 🦅•2y ago
Hi ! Following @Rafal 's suggestion I tried running a datadog agent and an app in the same Dockerfile (two stages since we have FROM datadog/agent:7 for the agent and FROM node:16.6.1-alpine3.14 for the app). Locally it works perfectly fine, both stages are working. But on railway, only the second one is ran : the app one. The datadog agent stage is discarded, any idea why ?
Brody
Brody•2y ago
you may be starting the agent in the build phase
Anthony 🦅
Anthony 🦅•2y ago
How do you think I should proceed ?
Brody
Brody•2y ago
if you don't mind, could you open your own help thread, and then show us your dockerfile?
Want results from more Discord servers?
Add your server