[Web-SIG] daemon tools

Robert Brewer fumanchu at amor.org
Mon Mar 5 19:38:51 CET 2007

Jim Fulton wrote:
> For some time, Zope has used a daemon-management tool
> we wrote called zdaemon:
>    http://www.python.org/pypi/zdaemon
> Ironically, this sort of tool isn't Python specific at all,
> and the discussion highlighted some non-Python tools, notably
> daemontools and runit, neither of which seemed as appealing
> as zdaemon for various reasons.

and Robert Brewer replied:
> The user interface isn't Python-specific, but the interaction with  
> WSGI servers, middleware, applications, and frameworks should be.

and Jim answered:
> I don't think we are talking about the same thing...
> I encourage you to look at the zope event system which already  
> supports this use case:
>    http://www.python.org/pypi/zope.event

Yes, and Django has a similar mechanism which they call "signals":


What several people have asked for is the ability to combine
applications (and WSGI components) from a variety of frameworks into a
single "website". What I'm proposing is that we standardize on a set of
topics/channels/events/signals that are "site-wide" events, like start,
stop, restart and graceful. If we collaborated on a tool to manage
those, we could potentially make the codebases of each project smaller,
not just by removing the event manager, but by collaborating on a set of
standard event handlers, one of which could be a "daemonize me" handler.

What we have now:

    CherryPy              Zope              Django
    --------             ------             -------
      ???                events             signals
       |                    |                  |
    autoreload             ???             autoreload
       |                    |                  |
    engine                zdrun               ???
       |                    |                  |
      ???                 zdctl               ???

What we could have instead:

                      webctl     modpython_gateway
                         |           /
         ------------ pywebd ------------
        /                |               \
    --------          ------           ------
    CherryPy           Zope            Django

...where the "pywebd" module:

 1. Composes the WSGI stack (provides a library to do so at least),
 2. Notifies frameworks of site-wide events (like start, stop, restart
and graceful),
 3. Provides plugins that frameworks can "notify"; for example, adding
files to an autoreload plugin.

> I think your "sitewide container" is the main program that loads
> the WSGI components.  This might be Apache, if mod_python is
> used, or some Python script/program.

Apache itself is not going to be the chunk of code that loads the WSGI
components. In my head, a modpython_gateway module (or something
similar) would ask pywebd to do that.

> I was discussing a tool that managed the main program in the
> latter case. Something that started and restarted it, provided
> status information, helped it to run as a proper daemon and so on.

Sure, something like zdctl? But zdctl doesn't do the actual fork, zdrun
does...so what does "help run as a proper daemon" mean?

Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org

More information about the Web-SIG mailing list