Add a Dockerfile for Heka

Partially implements: blueprint heka
Change-Id: Iafe0dba1333f1f84bc5956890c3b7a0c2a45cef3
This commit is contained in:
Éric Lemoine 2016-02-03 11:06:47 +01:00 committed by Sam Yaple
parent 0cb1d969f4
commit ee95dc5c27
4 changed files with 71 additions and 3 deletions

26
docker/heka/Dockerfile.j2 Normal file
View File

@ -0,0 +1,26 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
MAINTAINER {{ maintainer }}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install https://github.com/mozilla-services/heka/releases/download/v0.10.0/heka-0_10_0-linux-amd64.rpm \
&& useradd heka
{% elif base_distro in ['ubuntu'] %}
RUN curl --location https://github.com/mozilla-services/heka/releases/download/v0.10.0/heka_0.10.0_amd64.deb -o heka_0.10.0_amd64.deb \
&& dpkg -i heka_0.10.0_amd64.deb \
&& rm -f heka_0.10.0_amd64.deb
{% endif %}
COPY heka_sudoers /etc/sudoers.d/heka_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN usermod -a -G kolla heka \
&& chmod 755 /usr/local/bin/kolla_extend_start \
&& chown -R heka: /usr/share/heka
{{ include_footer }}
USER heka

View File

@ -0,0 +1,37 @@
#!/bin/bash
# Give processes executed with the "kolla" group the permission to create files
# and sub-directories in the /var/log/kolla directory.
#
# Also set the setgid permission on the /var/log/kolla directory so that new
# files and sub-directories in that directory inherit its group id ("kolla").
if [[ $(stat -c %U:%G /var/log/kolla) != "heka:kolla" ]]; then
sudo chown heka:kolla /var/log/kolla
fi
if [[ $(stat -c %a /var/log/kolla) != "2775" ]]; then
sudo chmod 2775 /var/log/kolla
fi
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
exit 0
fi
# /var/cache/hekad is what the Heka daemon will use for persistent storage
# through process restarts, so make "heka" the user of that directory.
if [[ $(stat -c %U:%G /var/cache/hekad) != "heka:heka" ]]; then
sudo chown heka: /var/cache/hekad
fi
# Give hekad the permission to create the "log" Unix socket file in the
# /var/lib/kolla/heka directory.
if [[ $(stat -c %U:%G /var/lib/kolla/heka) != "heka:kolla" ]]; then
sudo chown heka:kolla /var/lib/kolla/heka
fi
# The Heka daemon will create the /var/lib/kolla/heka/log Unix socket file, so
# make sure it's not present or the Heka daemon will fail when starting.
if [[ -e "/var/lib/kolla/heka/log" ]]; then
rm -rf /var/lib/kolla/heka/log
fi

4
docker/heka/heka_sudoers Normal file
View File

@ -0,0 +1,4 @@
%kolla ALL=(root) NOPASSWD: /bin/chown heka\:kolla /var/log/kolla, /usr/bin/chown heka\:kolla /var/log/kolla
%kolla ALL=(root) NOPASSWD: /bin/chmod 2775 /var/log/kolla, /usr/bin/chmod 2775 /var/log/kolla
%kolla ALL=(root) NOPASSWD: /bin/chown heka\: /var/cache/hekad, /usr/bin/chown heka\: /var/cache/hekad
%kolla ALL=(root) NOPASSWD: /bin/chown heka\:kolla /var/lib/kolla/heka, /usr/bin/chown heka\:kolla /var/lib/kolla/heka

View File

@ -27,7 +27,8 @@ _PROFILE_OPTS = [
cfg.ListOpt('infra',
default=['ceph', 'mariadb', 'haproxy',
'keepalived', 'kolla-toolbox', 'memcached',
'mongodb', 'openvswitch', 'rabbitmq', 'rsyslog'],
'mongodb', 'openvswitch', 'rabbitmq', 'rsyslog',
'heka'],
help='Infra images'),
cfg.ListOpt('main',
default=['cinder', 'ceilometer', 'glance', 'heat',
@ -42,12 +43,12 @@ _PROFILE_OPTS = [
default=['kolla-toolbox', 'glance', 'haproxy',
'heat', 'horizon', 'keepalived', 'keystone',
'memcached', 'mariadb', 'neutron', 'nova',
'openvswitch', 'rabbitmq', 'rsyslog'],
'openvswitch', 'rabbitmq', 'rsyslog', 'heka'],
help='Default images'),
cfg.ListOpt('gate',
default=['glance', 'haproxy', 'keepalived', 'keystone',
'kolla-toolbox', 'mariadb', 'memcached', 'neutron',
'nova', 'openvswitch', 'rabbitmq', 'rsyslog'],
'nova', 'openvswitch', 'rabbitmq', 'rsyslog', 'heka'],
help='Gate images'),
cfg.ListOpt('mesos',
default=['chronos', 'marathon', 'mesos-master', 'mesos-slave',