Skip to content

Commit

Permalink
remove collectd, add telegraf, optimize dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Salt committed Jan 24, 2018
1 parent 3f46c9a commit f119578
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 37 deletions.
39 changes: 13 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,33 @@
FROM phusion/baseimage:0.9.22
MAINTAINER Alex Salt <alex.salt@e96.ru>

ENV USE_TELEGRAF 0
ENV USE_CONSUL 1
ENV USE_COLLECTD 0
ENV CONSUL_VERSION 0.9.3
ENV DEBIAN_FRONTEND noninteractive

# remove ssh
RUN rm -rf /etc/my_init.d/00_regen_ssh_host_keys.sh /etc/service/sshd

RUN apt-get update -qq && apt-get install -y --no-install-recommends \
ca-certificates bind9-host iproute2 \
htop apt-transport-https unzip nano \
tzdata \
collectd libpython2.7 \

&& curl -sSL https://dl.influxdata.com/telegraf/releases/telegraf_1.5.1-1_amd64.deb -o /tmp/telegraf.deb \
&& dpkg -i /tmp/telegraf.deb \
&& curl -sSL https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip > /tmp/consul.zip \
&& curl -sSL https://github.com/kreuzwerker/envplate/releases/download/v0.0.8/ep-linux -o /usr/local/bin/ep && chmod +x /usr/local/bin/ep \
&& unzip -d /usr/local/bin /tmp/consul.zip && rm /tmp/consul.zip \
&& mkdir -p /etc/consul/conf.d \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /etc/my_init.d/00_regen_ssh_host_keys.sh /etc/service/sshd \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# do locales
RUN locale-gen ru_RU.UTF-8
COPY config/locale /etc/default/locale

# envplate
RUN curl -L https://github.com/kreuzwerker/envplate/releases/download/v0.0.8/ep-linux -o /usr/local/bin/ep && chmod +x /usr/local/bin/ep

# consul
RUN curl https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip > /tmp/consul.zip && \
unzip -d /usr/local/bin /tmp/consul.zip && \
rm /tmp/consul.zip && \
mkdir -p /etc/consul/conf.d
ADD config/consul.json /etc/consul/consul.json

# collectd
RUN mkdir /etc/collectd/conf.d
RUN touch /etc/collectd/types.db
ADD config/collectd/collectd.conf /etc/collectd/
# consul config
COPY config/consul.json /etc/consul/consul.json

# install init scripts
ADD init.d/ /etc/my_init.d/
COPY init.d/ /etc/my_init.d/

# install services
ADD services/consul.sh /etc/service/consul/run
ADD services/collectd.sh /etc/service/collectd/run
COPY services/consul.sh /etc/service/consul/run
COPY services/telegraf.sh /etc/service/telegraf/run
9 changes: 0 additions & 9 deletions init.d/02_collectd.sh

This file was deleted.

6 changes: 6 additions & 0 deletions init.d/02_telegraf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

if [ "$USE_TELEGRAF" != 1 ]; then
touch /etc/service/telegraf/down
exit 0
fi
2 changes: 0 additions & 2 deletions services/collectd.sh

This file was deleted.

3 changes: 3 additions & 0 deletions services/telegraf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exec telegraf --config /etc/telegraf/telegraf.conf

0 comments on commit f119578

Please sign in to comment.