Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] cnofig file theory, standard approach

Hey,

I agree with most of your comments, but a few, which I commented on
inline ...

On zo, 30 jun 2019 15:47:43 -0400, Greg Troxel wrote:
> In the pkgsrc-wip entry for mosquitto, there is a patch to the default
> config file, setting the default port explicitly and changing logging.
> Before I can assess if those make sense, I want to understand normal
> config file practice.
> 
> The example config file is very large, but every line is commented or
> blank.  mosquitto.conf(8) indicates that it will use default values, and
> presumably those match exactly the example.
> 
> So, I conclude that the config file should not be installed in
> ${PREFIX}/etc/, as 1) no config file is equivalent to 1K lines of
> comments, 2) a config file with a few settings that are intended is both
> easier to understand and easier to maintain as there are no explicit
> merge conflicts.
> 
> By default, pid_file is blank, and logging is stderr.  These both seem
> off for what feels like the standard approach, which is to start a
> single global mosquitto instance as root, which drops privs to the
> username mosquitto.  I would expect this to write a pidfile (as root,
> before dropping) so that the service management system, whatever that
> is, can signal mosquitto to exit.  And to remove this on exit, which I
> realize doesn't quite go with priv dropping, but it seems
> /var/run/foo.pid is overwhelming owned by root, even for programs that
> do implement priv dropping.
> 
> Is this indeed what's normal, and does everyone have to configure it?
> If so, it seems I should be installing a config file for use which has
> these few settings, but it also seems these should be the default.

Writing pid-files is a workaround for legacy init systems, that run
scripts to launch daemons, and then forget about them.
A proper init system, and today there exist several alternatives, do not
depend on the pid file.
So, as with many option, this should only be activated when necessary,
but the fact that your distro depend on it does not justify to make it
the mosquitto default.

stderr is the only logging option that does not depend on other daemons,
so from mosquitto point of view, it a good default.

> 
> A further query is that it seems like the command-line args are
> backwards in that not daemonizing is default, but I realize it's too
> hard to change that and it doesn't really matter.

Deamonizing should be controlled by the service supervisor, it should
not be the default from each and every program.
I appreciate the mosquitto's approach to this.


Kurt


Back to the top