diff options
| author | Éric Lemoine <elemoine@mirantis.com> | 2016-02-03 11:06:47 +0100 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2016-02-19 19:23:49 +0000 |
| commit | ee95dc5c274013e3fc54c63e940378e37940f4f5 (patch) | |
| tree | f613002be8b37e59c32a4a270cbbd52c30aa5239 /docker | |
| parent | 0cb1d969f499df7c4cbbb52a177eefab4973c2d6 (diff) | |
| download | kolla-ee95dc5c274013e3fc54c63e940378e37940f4f5.tar.gz kolla-ee95dc5c274013e3fc54c63e940378e37940f4f5.zip | |
Add a Dockerfile for Heka
Partially implements: blueprint heka
Change-Id: Iafe0dba1333f1f84bc5956890c3b7a0c2a45cef3
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/heka/Dockerfile.j2 | 26 | ||||
| -rw-r--r-- | docker/heka/extend_start.sh | 37 | ||||
| -rw-r--r-- | docker/heka/heka_sudoers | 4 |
3 files changed, 67 insertions, 0 deletions
diff --git a/docker/heka/Dockerfile.j2 b/docker/heka/Dockerfile.j2 new file mode 100644 index 000000000..8ce52f4e5 --- /dev/null +++ b/docker/heka/Dockerfile.j2 @@ -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 diff --git a/docker/heka/extend_start.sh b/docker/heka/extend_start.sh new file mode 100644 index 000000000..6e0b2b68c --- /dev/null +++ b/docker/heka/extend_start.sh @@ -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 diff --git a/docker/heka/heka_sudoers b/docker/heka/heka_sudoers new file mode 100644 index 000000000..b42b22e75 --- /dev/null +++ b/docker/heka/heka_sudoers @@ -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 |
