You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-08-08 22:36:41 +02:00
updates from review, WIP
This commit is contained in:
19
build/docker/datadog-agent/Dockerfile
Normal file
19
build/docker/datadog-agent/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM datadog/agent:latest
|
||||
|
||||
LABEL maintainer="lee@geeksinthewoods.com"
|
||||
|
||||
#COPY go_expvar.conf.yaml /etc/datadog-agent/conf.d/go_expvar.d/conf.yaml
|
||||
COPY custom-init.sh /custom-init.sh
|
||||
|
||||
ARG service
|
||||
ENV SERVICE_NAME $service
|
||||
|
||||
ARG env="dev"
|
||||
ENV ENV $env
|
||||
|
||||
ARG gogc="10"
|
||||
ENV GOGC $gogc
|
||||
|
||||
ENV DD_TAGS="source:docker service:${service} service_name:${service} cluster:NA env:${ENV}"
|
||||
|
||||
CMD ["/custom-init.sh"]
|
60
build/docker/datadog-agent/custom-init.sh
Executable file
60
build/docker/datadog-agent/custom-init.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
configFile="/etc/datadog-agent/conf.d/go_expvar.d/conf.yaml"
|
||||
|
||||
echo -e "init_config:\n\ninstances:\n" > $configFile
|
||||
|
||||
if [[ "${DD_EXPVAR}" != "" ]]; then
|
||||
|
||||
while IFS='|' read -ra HOSTS; do
|
||||
for h in "${HOSTS[@]}"; do
|
||||
if [[ "${h}" == "" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
url=""
|
||||
for p in $h; do
|
||||
k=`echo $p | awk -F '=' '{print $1}'`
|
||||
v=`echo $p | awk -F '=' '{print $2}'`
|
||||
if [[ "${k}" == "url" ]]; then
|
||||
url=$v
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${url}" == "" ]]; then
|
||||
echo "No url param found in '${h}'"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo -e " - expvar_url: ${url}" >> $configFile
|
||||
if [[ "${DD_TAGS}" != "" ]]; then
|
||||
echo " tags:" >> $configFile
|
||||
for t in ${DD_TAGS}; do
|
||||
echo " - ${t}" >> $configFile
|
||||
done
|
||||
fi
|
||||
|
||||
for p in $h; do
|
||||
k=`echo $p | awk -F '=' '{print $1}'`
|
||||
v=`echo $p | awk -F '=' '{print $2}'`
|
||||
if [[ "${k}" == "url" ]]; then
|
||||
continue
|
||||
fi
|
||||
echo " - ${k}:${v}" >> $configFile
|
||||
done
|
||||
done
|
||||
done <<< "$DD_EXPVAR"
|
||||
else :
|
||||
echo -e " - expvar_url: http://localhost:80/debug/vars" >> $configFile
|
||||
if [[ "${DD_TAGS}" != "" ]]; then
|
||||
echo " tags:" >> $configFile
|
||||
for t in ${DD_TAGS}; do
|
||||
echo " - ${t}" >> $configFile
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
cat $configFile
|
||||
|
||||
/init
|
Reference in New Issue
Block a user