From d6e30533d7730331452c5f61a98c9d1eec486a0b Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 28 Aug 2019 19:43:26 +0200 Subject: OpenShift support --- Dockerfile | 59 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 13 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index c87f487..fd9120e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,57 @@ -FROM ubuntu:14.04 +FROM alpine:latest -MAINTAINER Leo Unbekandt +MAINTAINER Suren Chilingaryan -RUN adduser --system --home /var/lib/munin --shell /bin/false --uid 1103 --group munin +ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.8/supercronic-linux-amd64 \ + SUPERCRONIC=supercronic-linux-amd64 \ + SUPERCRONIC_SHA1SUM=be43e64c45acd6ec4fce5831e03759c89676a0ea -RUN apt-get update -qq && RUNLEVEL=1 DEBIAN_FRONTEND=noninteractive \ - apt-get install -y -qq cron munin munin-node nginx wget heirloom-mailx patch spawn-fcgi libcgi-fast-perl -RUN rm /etc/nginx/sites-enabled/default && mkdir -p /var/cache/munin/www && chown munin:munin /var/cache/munin/www && mkdir -p /var/run/munin && chown -R munin:munin /var/run/munin +VOLUME /munin +#Only small temporary files, doesn't need volume +#VOLUME /var/lib/nginx -VOLUME /var/lib/munin -VOLUME /var/log/munin +RUN packages="munin nginx wget heirloom-mailx patch spawn-fcgi perl-cgi-fast curl busybox-extras font-adobe-75dpi"; \ + apk update && apk upgrade && apk add --no-cache $packages \ + && curl -fsSLO "$SUPERCRONIC_URL" \ + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && chmod +x "$SUPERCRONIC" \ + && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ + && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic ADD ./munin.conf /etc/munin/munin.conf ADD ./nginx.conf /etc/nginx/nginx.conf ADD ./nginx-munin /etc/nginx/sites-enabled/munin -ADD ./start-munin.sh /munin -ADD ./munin-graph-logging.patch /usr/share/munin -ADD ./munin-update-logging.patch /usr/share/munin +ADD ./start-munin.sh /munin.sh +ADD ./munin-graph-logging.patch /usr/lib/munin +ADD ./munin-update-logging.patch /usr/lib/munin -RUN cd /usr/share/munin && patch munin-graph < munin-graph-logging.patch && patch munin-update < munin-update-logging.patch +# rsyslog is not actually used, but I keep here configuration just in case +# Nginx always creates error_log in /var/log/nginx, but doesn't write there if other locating is configured +RUN \ + #sed -i -e 's|^$FileOwner|#$FileOwner|' "/etc/rsyslog.conf" && \ + #sed -i -e 's|^$FileGroup|#$FileGroup|' "/etc/rsyslog.conf" && \ + #sed -i -e 's|^$PrivDrop|#$PrivDrop|' "/etc/rsyslog.conf" && \ + #sed -i -e 's|^$ModLoad imuxsock|#$ModLoad imuxsock|' "/etc/rsyslog.conf" && \ + #sed -i -e 's|^$ModLoad imklog|#$ModLoad imklog|' "/etc/rsyslog.conf" && \ + \ + rm -rf /var/log/nginx && \ + ln -s /tmp /var/log/nginx && \ + ln -s /tmp /var/lib/nginx/logs && \ + rm -f /etc/nginx/conf.d/default.conf && \ + rm -f /etc/nginx/sites-enabled/default && \ + \ + ln -s /usr/share/webapps/munin/cgi /usr/lib/munin/cgi && \ + cd /usr/lib/munin && patch munin-graph < munin-graph-logging.patch && patch munin-update < munin-update-logging.patch && \ + sed -re "/@[[:alnum:]]+/ d; s|munin if|if|" /etc/munin/munin.cron.sample > /etc/munin/munin.cron && \ + \ + bash -c "mkdir -p /munin/{db,run,log,www/cache}" && \ + ln -s ../www/cache /munin/db/cgi-tmp && \ + rm -rf /var/lib/munin/cgi-tmp && \ + ln -s /munin/www/cache /var/lib/munin/cgi-tmp && \ + \ + chgrp -R root /munin /etc/munin/munin.conf /var/tmp/nginx /var/lib/nginx && \ + chmod -R g+rw /munin /etc/munin/munin.conf /var/tmp/nginx && \ + for name in "/var/tmp/nginx /munin/"; do find $name -type d -print0 | xargs -0 chmod g+x; done EXPOSE 8080 -CMD ["bash", "/munin"] +CMD ["bash", "/munin.sh"] -- cgit v1.2.3