occitech / docker

Docker images we use at Occitech
31 stars 36 forks source link

Munin: example with volumes not work out of the box #34

Closed H-Nestler closed 2 years ago

H-Nestler commented 2 years ago

I used the command suggest in README.md with a volume for logs.

This does not work, if the directoy /data/munin does not exist. Webserver does not start, because wrong directory permissions.

$ rm -rf /data/munin
$ docker run \
 -ti \
 --name=munin \
 -p 127.0.0.1:8080:80 \
 -e THISNODENAME="munin.example.com" \
 -e TZ="Europe/London" \
 -e CRONDELAY=2 \
 -e NODES="anothernode.example.com:1.2.3.4 anothernode2.example.com:5.6.7.8" \
 -v /data/munin/db:/var/lib/munin \
 -v /data/munin/logs:/var/log/munin \
 -v /data/munin/cache:/var/cache/munin \
 occitech/munin:latest
... 
/usr/local/bin/run: line 90: /var/cache/munin/www/index.html: No such file or directory
chown: cannot access '/var/cache/munin/www/index.html': No such file or directory

Webside is not accessable

$ curl -v http://127.0.0.1:8080/
...
< HTTP/1.1 403 Forbidden
...
<p>You don't have permission to access this resource.</p>

If I stop this container and start the container again, then the directory exists and the line 90 has no errors. The webside is empty with the text "Munin has not run yet. Please try again in a few moments." now.

Wait long time not helps. No graphics will be see, because wrong permission for html log.

To fix this, needs to change directory rights after docker was started. This is a simple woraround:

$ docker exec munin chown munin:munin /var/log/munin

Some minutes later Munin website is working.

Pull request #33 fixes this issue completely.

H-Nestler commented 2 years ago

More problems with logs in volume:

The cgi zoom does not work.

tail -f /var/log/apache2/error.log
...
Can't open /var/log/munin/munin-cgi-graph.log (Permission denied) at /usr/share/perl5/Log/Log4perl/Appender/File.pm line 151.

Hotfix:

docker exec munin touch /var/log/munin/munin-cgi-graph.log
docker exec munin chown www-data /var/log/munin/munin-cgi-graph.log

docker exec munin touch /var/log/munin/munin-cgi-html.log
docker exec munin chown www-data /var/log/munin/munin-cgi-html.log
cypx commented 2 years ago

This repository is not maintained anymore, please try on https://github.com/ethersys/ethersys-docker-munin and report issues on it.