From 4346acb65126733e6e59f58639a5e00148f6eff4 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Mon, 27 Jul 2026 00:18:03 +0500 Subject: [PATCH] Switch to s6-overlay, add cron (and cronjobs), syslog. --- CHANGELOG.md | 8 ++++++++ Dockerfile | 11 +++++------ README.md | 19 +++++++++++++++++-- configuration/s6/.s6-svscan/finish | 5 ----- configuration/s6/innd/finish | 3 --- configuration/s6/innd/run | 3 --- configuration/s6/nnrpd/finish | 3 --- configuration/s6/nnrpd/run | 3 --- etc/cont-init.d/05-inn-logging-prepare.sh | 9 +++++++++ etc/cont-init.d/10-inn-config.sh | 5 +++++ etc/cont-init.d/11-inn-database.sh | 5 +++++ etc/cont-init.d/12-inn-spool.sh | 5 +++++ etc/cont-init.d/20-news-crontab.sh | 3 +++ etc/crontabs/news | 5 +++++ etc/services.d/cron/run | 3 +++ etc/services.d/innd/log/run | 3 +++ etc/services.d/innd/run | 4 ++++ etc/services.d/nnrpd/log/run | 3 +++ etc/services.d/nnrpd/run | 4 ++++ 19 files changed, 79 insertions(+), 25 deletions(-) delete mode 100755 configuration/s6/.s6-svscan/finish delete mode 100755 configuration/s6/innd/finish delete mode 100755 configuration/s6/innd/run delete mode 100755 configuration/s6/nnrpd/finish delete mode 100755 configuration/s6/nnrpd/run create mode 100755 etc/cont-init.d/05-inn-logging-prepare.sh create mode 100755 etc/cont-init.d/10-inn-config.sh create mode 100755 etc/cont-init.d/11-inn-database.sh create mode 100755 etc/cont-init.d/12-inn-spool.sh create mode 100755 etc/cont-init.d/20-news-crontab.sh create mode 100644 etc/crontabs/news create mode 100755 etc/services.d/cron/run create mode 100755 etc/services.d/innd/log/run create mode 100755 etc/services.d/innd/run create mode 100755 etc/services.d/nnrpd/log/run create mode 100755 etc/services.d/nnrpd/run diff --git a/CHANGELOG.md b/CHANGELOG.md index c29800e..3ca4fa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) but do not follows semantic versioning as it is useless in this type of project. +## [2.7.4-2] - 2026-07-26 + +### Added + +* switch to s6-overlay (which is more suitable for containers than plain s6). +* syslogd support via s6-overlay. + ## [2.7.4-1] - 2026-07-26 ### Added @@ -19,5 +26,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) Initial container release with inn 2.7.4 built with perl/python/sqlite support. +[2.7.4-2]: https://code.pztrn.name/containers/inn2/compare/2.7.4-1...2.7.4-2 [2.7.4-1]: https://code.pztrn.name/containers/inn2/compare/2.7.4...2.7.4-1 [2.7.4]: https://code.pztrn.name/containers/inn2/releases/tag/2.7.4 diff --git a/Dockerfile b/Dockerfile index 5a778fa..a04b195 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,8 @@ RUN apk add --no-cache \ perl-utils \ python3 \ python3-dev \ - s6 \ + s6-overlay \ + s6-overlay-syslogd \ shadow \ sqlite-dev \ ssmtp \ @@ -46,16 +47,14 @@ RUN mkdir /src && cd /src && \ mv /inn2/spool /inn2/spool-default && \ rm -rf /src -COPY configuration /etc -COPY start-innd.sh /start-innd +COPY etc /etc -RUN groupmod -g 600 news && usermod -u 600 -g 600 -d /inn2 news && chown -R news:news /inn2 && chown -R news:news /etc/s6 +RUN groupmod -g 600 news && usermod -u 600 -g 600 -d /inn2 news && chown -R news:news /inn2 && chown -R news:news /etc/cont-init.d /etc/services.d WORKDIR /inn2 ENV PATH=/inn2/bin:$PATH -USER news EXPOSE 119 EXPOSE 563 VOLUME [ "/inn2/db", "/inn2/spool", "/inn2/log" ] -CMD ["/usr/bin/s6-svscan", "/etc/s6"] +ENTRYPOINT [ "/init" ] diff --git a/README.md b/README.md index 1b21b35..bf061d2 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ services: - "./data/run:/inn2/run" - "./data/spool:/inn2/spool" - "./data/tmp:/inn2/tmp" + - "./data/syslog:/var/log" ulimits: nofile: soft: 65535 @@ -47,6 +48,7 @@ services: - "./data/run:/inn2/run" - "./data/spool:/inn2/spool" - "./data/tmp:/inn2/tmp" + - "./data/syslog:/var/log" networks: inn2-ipvlan: ipv4_address: 192.168.168.168 # ip address from real LAN. @@ -81,10 +83,12 @@ Note that this code is built to support dual-stack (IPv4+IPv6). You should eithe ## Cronjobs -There is a section in documentation about cron jobs you should configure. This docker image currently isn't supporting these, so configure it separately with lines like: +This Docker image come with a recommended in documentation set of cronjobs. To customize it copy `etc/crontabs/news` file, make neccessary changes and mount it to container in `/etc/crontabs/news`. + +If you want to use cron outside of your container: ```shell -0 3 * * * docker compose run inn news.daily expireover lowmark +0 3 * * * docker compose run inn news.daily expireover lowmark delayrm ``` ## Sending emails @@ -115,3 +119,14 @@ inn2 is launched as UID/GID 600 in container, so chown directories properly acco * If you're not using userns isolation - use `chown 600:600`. * If you're using it - use `600 + id from /etc/subuid`, e.g. if you're using default Docker remapping this could be `chown 100600:100600`. + +## Logs + +Logs are split in two destinations: + +* `/inn2/log` - default INN logs destination. +* `/var/log` - syslog logs. + +As INN might log in both of them you should mount a directory for each. + +For syslog logs it is a known bug that logs isn't written in `/var/log/innd` or `/var/log/nnrpd`, take a look at `/var/log/syslogd/everything/current` for logs with `news` topic. This might be fixed somewhere soon. diff --git a/configuration/s6/.s6-svscan/finish b/configuration/s6/.s6-svscan/finish deleted file mode 100755 index 804b105..0000000 --- a/configuration/s6/.s6-svscan/finish +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -for file in /etc/s6/*/finish; do - $file -done diff --git a/configuration/s6/innd/finish b/configuration/s6/innd/finish deleted file mode 100755 index 50f9103..0000000 --- a/configuration/s6/innd/finish +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -kill "$(cat /inn2/run/innd.pid)" diff --git a/configuration/s6/innd/run b/configuration/s6/innd/run deleted file mode 100755 index 9d5f21a..0000000 --- a/configuration/s6/innd/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/execlineb -P - -/start-innd diff --git a/configuration/s6/nnrpd/finish b/configuration/s6/nnrpd/finish deleted file mode 100755 index 9a0b04e..0000000 --- a/configuration/s6/nnrpd/finish +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -kill "$(cat /inn2/run/nnrpd-563.pid)" diff --git a/configuration/s6/nnrpd/run b/configuration/s6/nnrpd/run deleted file mode 100755 index 3c011eb..0000000 --- a/configuration/s6/nnrpd/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/execlineb -P - -nnrpd -D -f -p 563 -S diff --git a/etc/cont-init.d/05-inn-logging-prepare.sh b/etc/cont-init.d/05-inn-logging-prepare.sh new file mode 100755 index 0000000..18b183b --- /dev/null +++ b/etc/cont-init.d/05-inn-logging-prepare.sh @@ -0,0 +1,9 @@ +#!/bin/sh -e + +mkdir -p /var/log/innd +chown -R 65534:65534 /var/log/innd +chmod 02755 /var/log/innd + +mkdir -p /var/log/nnrpd +chown -R 65534:65534 /var/log/nnrpd +chmod 02755 /var/log/nnrpd diff --git a/etc/cont-init.d/10-inn-config.sh b/etc/cont-init.d/10-inn-config.sh new file mode 100755 index 0000000..69c1d04 --- /dev/null +++ b/etc/cont-init.d/10-inn-config.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ ! -f "/inn2/etc/inn.conf" ]; then + cp -r /inn2/etc-default/* /inn2/etc +fi diff --git a/etc/cont-init.d/11-inn-database.sh b/etc/cont-init.d/11-inn-database.sh new file mode 100755 index 0000000..4c3c54f --- /dev/null +++ b/etc/cont-init.d/11-inn-database.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ ! -f "/inn2/db/history" ]; then + cp -r /inn2/db-default/* /inn2/db +fi diff --git a/etc/cont-init.d/12-inn-spool.sh b/etc/cont-init.d/12-inn-spool.sh new file mode 100755 index 0000000..8440db5 --- /dev/null +++ b/etc/cont-init.d/12-inn-spool.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ ! -d "/inn2/spool/articles" ]; then + cp -r /inn2/spool-default/* /inn2/spool +fi diff --git a/etc/cont-init.d/20-news-crontab.sh b/etc/cont-init.d/20-news-crontab.sh new file mode 100755 index 0000000..95c7786 --- /dev/null +++ b/etc/cont-init.d/20-news-crontab.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +chown news:news /etc/crontabs/news diff --git a/etc/crontabs/news b/etc/crontabs/news new file mode 100644 index 0000000..b136503 --- /dev/null +++ b/etc/crontabs/news @@ -0,0 +1,5 @@ +# min hour day month weekday command +0 5 * * * cd /inn2; /inn2/bin/news.daily expireover lowmark delayrm +15 * * * * cd /inn2; /inn2/bin/rnews -U +0 4 * * * cd /inn2; /inn2/bin/ctlinnd -t 120 -s reload incoming.conf 'flush cache' +*/10 * * * * cd /inn2; /inn2/bin/nntpsend diff --git a/etc/services.d/cron/run b/etc/services.d/cron/run new file mode 100755 index 0000000..e53c097 --- /dev/null +++ b/etc/services.d/cron/run @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/sbin/crond -f diff --git a/etc/services.d/innd/log/run b/etc/services.d/innd/log/run new file mode 100755 index 0000000..2eba3cf --- /dev/null +++ b/etc/services.d/innd/log/run @@ -0,0 +1,3 @@ +#!/bin/sh + +exec logutil-service /var/log/innd diff --git a/etc/services.d/innd/run b/etc/services.d/innd/run new file mode 100755 index 0000000..2109c5c --- /dev/null +++ b/etc/services.d/innd/run @@ -0,0 +1,4 @@ +#!/bin/sh + +exec 2>&1 +exec s6-setuidgid news /inn2/bin/innd -f diff --git a/etc/services.d/nnrpd/log/run b/etc/services.d/nnrpd/log/run new file mode 100755 index 0000000..f6d536b --- /dev/null +++ b/etc/services.d/nnrpd/log/run @@ -0,0 +1,3 @@ +#!/bin/sh + +exec logutil-service /var/log/nnrpd diff --git a/etc/services.d/nnrpd/run b/etc/services.d/nnrpd/run new file mode 100755 index 0000000..041bbba --- /dev/null +++ b/etc/services.d/nnrpd/run @@ -0,0 +1,4 @@ +#!/bin/sh + +exec 2>&1 +exec s6-setuidgid news nnrpd -D -f -p 563 -S