Skip to content

Conversation

apeschel
Copy link

@apeschel apeschel commented Aug 8, 2016

This script fixes some white-space issues and adds the ability to run custom scripts before the entrypoint starts dd-agent.

Uses https://github.com/docker-library/mysql as a reference.

* Replaces tabs with spaces
* Uses heredoc to generate supervisor.conf
This commit adds the ability for users to run their own scripts before
dd-agent is brought up.

This change uses https://github.com/docker-library/mysql as a reference.
@remh
Copy link

remh commented Sep 23, 2016

Thanks @apeschel
Can you explain your use case a bit more please ?

@apeschel
Copy link
Author

@remh I would like to be able to put a config template into the /etc/dd-agent/conf.d/mysql.yaml and fill in the password data via an environment variable.

Something like this:

#!/bin/bash

echo "Setting Datadog MySQL password."

sed -i -e "s/XXX_DATADOG_MYSQL_PASSWORD/${DATADOG_MYSQL_PASSWORD}/" /etc/dd-agent/conf.d/mysql.yaml

@christ66
Copy link

christ66 commented Jun 5, 2017

This might be useful for users who need to decrypt things like usernames/passwords/certificates before the dd-agent runs.

@aerostitch
Copy link
Contributor

Will this be necessary with agent6? Won't it support env variables on the config or would it be only for the core agent?
Also note that the entrypoint executes exec $@ so you should be able to provide a file that you mount from a volume for example and the content of the file would be:

sed -i -e "s/XXX_DATADOG_MYSQL_PASSWORD/${DATADOG_MYSQL_PASSWORD}/" /etc/dd-agent/conf.d/mysql.yaml
supervisord -n -c /etc/dd-agent/supervisor.conf

But I think it would be a big miss if we can't have the support of env variables directly in the integration config (so directly as a PR in dd-agent instead of just here) IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants