Skip to content

Commit

Permalink
Merge pull request #11 from doopai/master
Browse files Browse the repository at this point in the history
feat(fluentd): use official fluent/fluentd:1.3 docker image
  • Loading branch information
Cryptophobia authored Jul 27, 2019
2 parents d094f5f + 01e73d3 commit cc5bb5c
Show file tree
Hide file tree
Showing 33 changed files with 49 additions and 494 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
manifests/*.tmp.yaml
rootfs/opt/fluentd/deis-output/pkg
rootfs/fluentd/deis-output/pkg
rootfs/*.gem
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ docker-build:
docker tag ${IMAGE} ${MUTABLE_IMAGE}

test: docker-build
docker run ${IMAGE} /bin/bash -c "cd /opt/fluentd/deis-output && rake test"
docker run ${IMAGE} /bin/bash -c "cd /fluentd/deis-output && rake test"

install:
helm upgrade fluentd charts/fluentd --install --namespace deis --set org=${IMAGE_PREFIX},docker_tag=${VERSION}
Expand Down
2 changes: 1 addition & 1 deletion charts/fluentd/templates/logger-fluentd-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
heritage: deis
rules:
- apiGroups: [""]
resources: ["pods"]
resources: ["pods", "namespaces"]
verbs: ["list", "get", "watch"]
{{- end -}}
{{- end -}}
66 changes: 23 additions & 43 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,27 @@
FROM quay.io/deis/base:v0.3.6
FROM fluent/fluentd:v1.3

COPY . /
COPY fluentd /fluentd
COPY entrypoint.sh /bin/
RUN chmod +x /bin/entrypoint.sh

RUN buildDeps='g++ gcc make ruby-dev'; \
apt-get update && \
apt-get install -y \
$buildDeps \
ruby && \
export FLUENTD_VERSION=0.14.13 && \
gem install --no-document fluentd -v $FLUENTD_VERSION && \
gem install bundler && \
bundle install --gemfile=/opt/fluentd/deis-output/Gemfile && \
rake --rakefile=/opt/fluentd/deis-output/Rakefile build && \
fluent-gem install --no-document fluent-plugin-kubernetes_metadata_filter -v 0.25.3 && \
fluent-gem install --no-document fluent-plugin-elasticsearch -v 2.3.0 && \
fluent-gem install --no-document fluent-plugin-remote_syslog -v 0.3.2 && \
fluent-gem install --no-document fluent-plugin-sumologic-mattk42 -v 0.0.4 && \
fluent-gem install --no-document fluent-plugin-gelf-hs -v 1.0.4 && \
fluent-gem install --no-document influxdb -v 0.3.2 && \
fluent-gem install --no-document nsq-ruby -v 1.7.0 && \
fluent-gem install --local /opt/fluentd/deis-output/pkg/fluent-plugin-deis_output-0.1.0.gem && \
# cleanup
apt-get purge -y --auto-remove $buildDeps && \
apt-get autoremove -y && \
apt-get clean -y && \
# package up license files if any by appending to existing tar
COPYRIGHT_TAR='/usr/share/copyrights.tar'; \
gunzip -f $COPYRIGHT_TAR.gz; tar -rf $COPYRIGHT_TAR /usr/share/doc/*/copyright; gzip $COPYRIGHT_TAR && \
rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/log/* \
/var/cache/debconf/* \
/etc/systemd \
/lib/lsb \
/lib/udev \
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
bash -c "mkdir -p /usr/share/man/man{1..8}"
RUN apk add bash findutils
RUN apk add --update --virtual .build-deps sudo build-base ruby-dev \
&& gem install bundler \
&& bundle config --global silence_root_warning 1 \
&& bundle install --gemfile=/fluentd/deis-output/Gemfile \
&& rake --rakefile=/fluentd/deis-output/Rakefile build \
&& fluent-gem install --no-document fluent-plugin-kubernetes_metadata_filter -v 2.1.4 \
&& fluent-gem install --no-document fluent-plugin-elasticsearch -v 2.12.0 \
&& fluent-gem install --no-document fluent-plugin-remote_syslog -v 1.0.0 \
&& fluent-gem install --no-document fluent-plugin-sumologic-mattk42 -v 0.0.4 \
&& fluent-gem install --no-document fluent-plugin-gelf-hs -v 1.0.7 \
&& fluent-gem install --no-document influxdb -v 0.6.1 \
&& fluent-gem install --no-document nsq-ruby -v 2.3.1 \
&& fluent-gem install --local /fluentd/deis-output/pkg/fluent-plugin-deis_output-0.1.0.gem \
&& sudo gem sources --clear-all \
&& apk del .build-deps \
&& rm -rf /var/cache/apk/* /root/.gem/ruby/*/cache/*.gem

COPY /var /var
ENTRYPOINT ["/bin/entrypoint.sh"]

CMD ["/opt/fluentd/sbin/boot"]
CMD ["/fluentd/sbin/boot"]
3 changes: 3 additions & 0 deletions rootfs/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/dumb-init /bin/sh

exec "$@"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 9 additions & 10 deletions rootfs/opt/fluentd/sbin/boot → rootfs/fluentd/sbin/boot
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/bin/bash
FLUENTD_CONF=${FLUENTD_CONF:-"/opt/fluentd/conf/fluentd.conf"}
FLUENTD_CONF="/fluentd/etc/${FLUENTD_CONF}"
INSTALL_BUILD_TOOLS=${INSTALL_BUILD_TOOLS:-"false"}
BUILD_TOOLS='g++ gcc make ruby-dev'

if [ "$INSTALL_BUILD_TOOLS" == "true" ]
then
echo "Installing Build tools!"
apt-get update
apt-get install -y ruby $BUILD_TOOLS
apk add --update --virtual .build-deps sudo build-base ruby-dev
fi

# is there a broken symlink in /var/log/containers?
Expand All @@ -24,9 +23,9 @@ if [ -n "$BROKEN_LINK" ]; then
echo "linked /var/lib/docker/containers to $TARGET_DIR"
fi

source /opt/fluentd/sbin/plugins
source /opt/fluentd/sbin/sources
source /opt/fluentd/sbin/filters/filters
source /fluentd/sbin/plugins
source /fluentd/sbin/sources
source /fluentd/sbin/filters/filters

if [ -n "$DROP_FLUENTD_LOGS" ]
then
Expand All @@ -42,7 +41,7 @@ cat << EOF >> $FLUENTD_CONF
@type copy
EOF

source /opt/fluentd/sbin/stores/stores
source /fluentd/sbin/stores/stores

cat << EOF >> $FLUENTD_CONF
</match>
Expand All @@ -51,9 +50,9 @@ EOF
if [ "$INSTALL_BUILD_TOOLS" == "true" ]
then
echo "Removing Build tools!"
apt-get remove -y --auto-remove --purge $BUILD_TOOLS
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
sudo gem sources --clear-all
apk del .build-deps
rm -rf /var/cache/apk/* /root/.gem/ruby/*/cache/*.gem
fi

exec fluentd -c $FLUENTD_CONF
File renamed without changes.
3 changes: 3 additions & 0 deletions rootfs/fluentd/sbin/filters/filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /fluentd/sbin/filters/kubernetes
source /fluentd/sbin/filters/custom_filters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions rootfs/fluentd/sbin/stores/stores
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

source /fluentd/sbin/stores/deis
source /fluentd/sbin/stores/elastic_search
source /fluentd/sbin/stores/syslog
source /fluentd/sbin/stores/sumologic
source /fluentd/sbin/stores/custom_stores
source /fluentd/sbin/stores/gelf
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions rootfs/opt/fluentd/sbin/filters/filters

This file was deleted.

8 changes: 0 additions & 8 deletions rootfs/opt/fluentd/sbin/stores/stores

This file was deleted.

Loading

0 comments on commit cc5bb5c

Please sign in to comment.