To show runit, socklog, svlogd in docker
Go to file
2016-07-16 18:15:55 +02:00
service initial commit 2016-07-16 18:09:54 +02:00
Dockerfile add missing volume 2016-07-16 18:15:55 +02:00
README.md initial commit 2016-07-16 18:09:54 +02:00

show runit

This container is to show how one can use runit, svlogd and socklog in order to log the service activity.

$ docker run --rm -ti --name runit show-runit
/etc/service/showlog/run started
/etc/service/fakeapp3/log/run started
/etc/service/fakeapp2/log/run started
/etc/service/fakeapp1/log/run started
listening on /dev/log, gid=99, uid=99, starting.
2016-07-16_16:42:49.78418 [stdout] /etc/service/fakeapp1/fakeapp1.sh test: 1 ...
2016-07-16_16:42:51.77754 [stdout] /etc/service/fakeapp1/fakeapp1.sh test: 2 ...
2016-07-16_16:42:49.78307 [stdout] /etc/service/fakeapp2/fakeapp2.sh test: 1 ...
2016-07-16_16:42:49.78490 user.notice: Jul 16 16:42:49 /etc/service/fakeapp3/fakeapp3.sh: test: 1 ...
2016-07-16_16:42:51.78458 [stdout] /etc/service/fakeapp2/fakeapp2.sh test: 2 ...
2016-07-16_16:42:51.78676 user.notice: Jul 16 16:42:51 /etc/service/fakeapp3/fakeapp3.sh: test: 2 ...
2016-07-16_16:42:53.77904 [stdout] /etc/service/fakeapp1/fakeapp1.sh test: 3 ...
2016-07-16_16:42:53.78588 [stdout] /etc/service/fakeapp2/fakeapp2.sh test: 3 ...
2016-07-16_16:42:53.78935 user.notice: Jul 16 16:42:53 /etc/service/fakeapp3/fakeapp3.sh: test: 3 ...
2016-07-16_16:42:55.78062 [stdout] /etc/service/fakeapp1/fakeapp1.sh test: 4 ...
2016-07-16_16:42:55.78736 [stdout] /etc/service/fakeapp2/fakeapp2.sh test: 4 ...
2016-07-16_16:42:55.79176 user.notice: Jul 16 16:42:55 /etc/service/fakeapp3/fakeapp3.sh: test: 4 ...

Build

docker build --ulimit nofile=1024:2048 -t show-runit .

Use

docker run --rm -ti --name runit show-runit
docker run -d -ti --name runit show-runit
docker logs -f runit
docker stop runit
docker start runit
docker exec -ti runit bash
sv status /etc/service/*
sv stop /etc/service/fakeapp1
sv start /etc/service/fakeapp1
ls -la /var/log/fakeapp*