Skip to content

Commit

Permalink
Merge pull request #8 from bobrik/nobody
Browse files Browse the repository at this point in the history
Drop privileges to nobody, make MESOS_HOST optional
  • Loading branch information
bobrik committed Jun 4, 2015
2 parents 94c9332 + d41cba9 commit 20ed7cd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion collector/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ RUN echo "APT::Install-Recommends false;" >> /etc/apt/apt.conf.d/recommends.conf
apt-get update && \
apt-get upgrade -y && \
apt-get install -y collectd python-pip ca-certificates && \
pip install envtpl
pip install envtpl && \
apt-get install -y curl && \
curl -sL https://github.com/tianon/gosu/releases/download/1.4/gosu-amd64 > /usr/bin/gosu && \
chmod +x /usr/bin/gosu && \
apt-get remove -y curl && \
apt-get autoremove -y

COPY ./docker/collectd.conf.tpl /etc/collectd/collectd.conf.tpl
COPY ./docker/run.sh /run.sh
Expand Down
2 changes: 1 addition & 1 deletion collector/docker/collectd.conf.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hostname "{{ COLLECTD_HOST | default(MESOS_HOST) }}"
Hostname "{{ COLLECTD_HOST }}"

FQDNLookup false
Interval {{ COLLECTD_INTERVAL | default(10) }}
Expand Down
8 changes: 7 additions & 1 deletion collector/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

set -e

if [ -n "${MESOS_HOST}" ]; then
if [ -z "${COLLECTD_HOST}" ]; then
export COLLECTD_HOST="${MESOS_HOST}"
fi
fi

if [ ! -e "/.initialized" ]; then
touch "/.initialized"
envtpl /etc/collectd/collectd.conf.tpl
fi

collectd -f > /dev/null
gosu nobody collectd -f > /dev/null

0 comments on commit 20ed7cd

Please sign in to comment.