Skip to content

[FEAT] Not possible to get debug output running as an S6 service #53

@rpatterson

Description

@rpatterson

Is this a new feature request?

  • I have searched the existing issues

Wanted change

It should be possible to apply any control over output that the main service provides without deep internal knowledge.

Reason for change

ZNC provides a --debug CLI option for inspecting the full set of commands between ZNC, clients and servers but the S6 service hard-codes the CLI options so working around this requires understanding S6. It also provides a admindebug module, but that module requires a TTY and so won't work alongside everything else S6-overlay provides. The --debug option is more "low-level" and just more important to support.

Proposed code change

To workaround this, I exported the /etc/s6-overlay/s6-rc.d/svc-znc/run file from the container and applied the following change to add the --debug CLI option when the DEBUG environment variable was set:

modified   znc/etc/s6-overlay/s6-rc.d/svc-znc/run
@@ -3,7 +3,14 @@
 
 PORT=$(grep "Port =" /config/configs/znc.conf | awk -F '=' '{print $2;exit}')
 
+ZNC_ARGS=""
+if [ "${DEBUG:=}" = "true" ]
+then
+    # Echo IRC commands for easier debugging:
+    ZNC_ARGS+="--debug"
+fi
+
 exec \
     s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PORT}" \
         s6-setuidgid abc /usr/local/bin/znc -d /config \
-        --foreground
+        --foreground ${ZNC_ARGS}

But if I were tackling this issue, I would prefer adding some generalized support for including additional CLI arguments for the container's "main" service to S6-overlay and use that, even if that's little more than a convention.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions