summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-08-29 00:27:14 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-08-29 00:27:14 +0200
commit22d3c280de70895fe5df15d4f57a87be17362a51 (patch)
treefa7e7c36ffce89fcf5d4f4e609bc76f2417613fb
parentd6e30533d7730331452c5f61a98c9d1eec486a0b (diff)
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)
-rw-r--r--Dockerfile14
-rw-r--r--munin.conf2
-rw-r--r--patches/munin-ds-datalock.patch11
-rw-r--r--patches/munin-graph-logging.patch (renamed from munin-graph-logging.patch)0
-rw-r--r--patches/munin-update-logging.patch (renamed from munin-update-logging.patch)0
-rwxr-xr-xstart-munin.sh2
-rwxr-xr-xtest/start_test.sh2
7 files changed, 21 insertions, 10 deletions
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.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/munin-graph-logging.patch b/patches/munin-graph-logging.patch
index aa4fc56..aa4fc56 100644
--- a/munin-graph-logging.patch
+++ b/patches/munin-graph-logging.patch
diff --git a/munin-update-logging.patch b/patches/munin-update-logging.patch
index 4f8e87b..4f8e87b 100644
--- a/munin-update-logging.patch
+++ b/patches/munin-update-logging.patch
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" \
"$@"