From 22d3c280de70895fe5df15d4f57a87be17362a51 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 29 Aug 2019 00:27:14 +0200 Subject: Move datafile lock into the database folder and keep the rest of run files outside of the volume (since UNIX domain sockets can't be created on GlusterFS) --- Dockerfile | 14 +++++++------- munin-graph-logging.patch | 10 ---------- munin-update-logging.patch | 10 ---------- munin.conf | 2 +- patches/munin-ds-datalock.patch | 11 +++++++++++ patches/munin-graph-logging.patch | 10 ++++++++++ patches/munin-update-logging.patch | 10 ++++++++++ start-munin.sh | 2 +- test/start_test.sh | 2 +- 9 files changed, 41 insertions(+), 30 deletions(-) delete mode 100644 munin-graph-logging.patch delete mode 100644 munin-update-logging.patch create mode 100644 patches/munin-ds-datalock.patch create mode 100644 patches/munin-graph-logging.patch create mode 100644 patches/munin-update-logging.patch diff --git a/Dockerfile b/Dockerfile index fd9120e..cf26e49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0. SUPERCRONIC=supercronic-linux-amd64 \ SUPERCRONIC_SHA1SUM=be43e64c45acd6ec4fce5831e03759c89676a0ea -VOLUME /munin +VOLUME /munin/db #Only small temporary files, doesn't need volume #VOLUME /var/lib/nginx @@ -22,8 +22,7 @@ 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.sh -ADD ./munin-graph-logging.patch /usr/lib/munin -ADD ./munin-update-logging.patch /usr/lib/munin +ADD ./patches /patches # 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 @@ -41,16 +40,17 @@ RUN \ 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 && \ + cd /usr/lib/munin && patch munin-graph < /patches/munin-graph-logging.patch && patch munin-update < /patches/munin-update-logging.patch && \ + cd /usr/share/perl5/vendor_perl/Munin/Master/ && patch Update.pm < /patches/munin-ds-datalock.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}" && \ + bash -c "mkdir -p /munin/{db,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 && \ + chgrp -R root /munin /var/run/munin /etc/munin/munin.conf /var/tmp/nginx /var/lib/nginx && \ + chmod -R g+rw /munin /var/run/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 diff --git a/munin-graph-logging.patch b/munin-graph-logging.patch deleted file mode 100644 index aa4fc56..0000000 --- a/munin-graph-logging.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- /usr/share/munin/munin-graph 2015-11-28 00:45:25.274878597 +0100 -+++ /usr/share/munin/munin-graph 2015-11-28 00:45:44.622466044 +0100 -@@ -73,6 +73,7 @@ - - logger_open($config->{'logdir'}); - logger_debug() if $config->{debug} or defined($ENV{CGI_DEBUG}); -+logger_level("warn"); - - if (! graph_check_cron() ) { - # Should not be launched from cron. diff --git a/munin-update-logging.patch b/munin-update-logging.patch deleted file mode 100644 index 4f8e87b..0000000 --- a/munin-update-logging.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- /usr/share/munin/munin-update 2015-11-28 00:44:27.175435050 +0100 -+++ /usr/share/munin/munin-update 2015-11-28 00:44:57.313544402 +0100 -@@ -34,6 +34,7 @@ - - logger_open($config->{'logdir'}); - logger_debug() if $config->{debug}; -+ logger_level("warn"); - - my $update = Munin::Master::Update->new(); - $update->run(); diff --git a/munin.conf b/munin.conf index 5ceff3f..a331659 100644 --- a/munin.conf +++ b/munin.conf @@ -1,5 +1,5 @@ dbdir /munin/db -rundir /munin/run +rundir /var/run/munin htmldir /munin/www logdir /munin/log diff --git a/patches/munin-ds-datalock.patch b/patches/munin-ds-datalock.patch new file mode 100644 index 0000000..3ec249b --- /dev/null +++ b/patches/munin-ds-datalock.patch @@ -0,0 +1,11 @@ +--- Munin/Master/Update.pm ++++ Munin-ds/Master/Update.pm +@@ -265,7 +265,7 @@ + sub _write_new_service_configs_locked { + my ($self) = @_; + +- my $lock_file = "$config->{rundir}/munin-datafile.lock"; ++ my $lock_file = "$config->{dbdir}/datafile.lock"; + munin_runlock($lock_file); + + my $config_dump_file = $self->{config_dump_file}; diff --git a/patches/munin-graph-logging.patch b/patches/munin-graph-logging.patch new file mode 100644 index 0000000..aa4fc56 --- /dev/null +++ b/patches/munin-graph-logging.patch @@ -0,0 +1,10 @@ +--- /usr/share/munin/munin-graph 2015-11-28 00:45:25.274878597 +0100 ++++ /usr/share/munin/munin-graph 2015-11-28 00:45:44.622466044 +0100 +@@ -73,6 +73,7 @@ + + logger_open($config->{'logdir'}); + logger_debug() if $config->{debug} or defined($ENV{CGI_DEBUG}); ++logger_level("warn"); + + if (! graph_check_cron() ) { + # Should not be launched from cron. diff --git a/patches/munin-update-logging.patch b/patches/munin-update-logging.patch new file mode 100644 index 0000000..4f8e87b --- /dev/null +++ b/patches/munin-update-logging.patch @@ -0,0 +1,10 @@ +--- /usr/share/munin/munin-update 2015-11-28 00:44:27.175435050 +0100 ++++ /usr/share/munin/munin-update 2015-11-28 00:44:57.313544402 +0100 +@@ -34,6 +34,7 @@ + + logger_open($config->{'logdir'}); + logger_debug() if $config->{debug}; ++ logger_level("warn"); + + my $update = Munin::Master::Update->new(); + $update->run(); diff --git a/start-munin.sh b/start-munin.sh index e224de1..564eada 100755 --- a/start-munin.sh +++ b/start-munin.sh @@ -12,7 +12,7 @@ SMTP_MESSAGE_DEFAULT='[${var:group};${var:host}] -> ${var:graph_title} -> warnin SMTP_MESSAGE="${SMTP_MESSAGE:-$SMTP_MESSAGE_DEFAULT}" -mkdir -p /munin/{db,run,log,www/cache} +mkdir -p /munin/{db,log,www/cache} [ -a /munin/db/cgi-tmp ] || ln -s ../www/cache /munin/db/cgi-tmp [ -a /var/lib/munin/cgi-tmp ] || ln -s /munin/www/cache /var/lib/munin/cgi-tmp [ -a /var/log/nginx ] || ln -s /tmp /var/log/nginx diff --git a/test/start_test.sh b/test/start_test.sh index f348c7b..9366ff2 100755 --- a/test/start_test.sh +++ b/test/start_test.sh @@ -10,6 +10,6 @@ basedir="$( cd -P "$( dirname "$0" )" && pwd )/munin" docker run -it \ -u 1001 \ -p 8080:8080 \ - -v $basedir:/munin \ + -v $basedir:/munin/db \ -e NODES="styx:192.168.26.117" \ "$@" -- cgit v1.2.1