You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by wa...@us.ibm.com on 1999/03/10 22:05:11 UTC

NT multiple services patch


This patch enables multiple servers on NT by providing a clean way to
install, uninstall, and signal multiple services.  A server is referred to
by either its service name or the full path to its configuration file.

The following options were added or modified:

-f [server]         : Force this Apache to use config of [server]
-t [server]         : Test the config of [server]
-i [name [server]]  : Install service "name" to use config [server]
-u [name]           : Uninstall service "name"
-k action [server]  : Signal running Apache [server] (console or service)
                      action is (start|restart|shutdown)

If server is not specified, Apache searches for it in this order:

1) ./SERVER_CONFIG_FILE
2) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
/[Version]/ConfPath
3) /HTTPD_ROOT/SERVER_CONFIG_FILE

.. with the exception of -k, for which we add a step
1.5) Registry: HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
/[Version]/LastRun
    (the confpath of the last Apache instance)

If name is not specified with -i or -u, Apache uses the default ("Apache").

(See attached file: service.pch)

Keith Wannamaker
IBM IHS Development Team
RTP, NC  USA

Re: NT multiple services patch

Posted by Keith Wannamaker <kr...@raleigh.ibm.com>.
> > > > > If server is not specified, Apache searches for it in this order:
> > > > >
> > > > > 1) ./SERVER_CONFIG_FILE
> > > > > 2) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > > > /[Version]/ConfPath
> > > > > 3) /HTTPD_ROOT/SERVER_CONFIG_FILE
> > > > >
> > > > > .. with the exception of -k, for which we add a step
> > > > > 1.5) Registry: HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > > > /[Version]/LastRun
> > > > >     (the confpath of the last Apache instance)
> > > > >
> > > > > If name is not specified with -i or -u, Apache uses the default ("Apache").
>
> Well, the patch actually makes various changes to the way that Apache
> finds its configuration information (as listed in your steps 1, 1.5, 2 and
> 3, above). I'd prefer a patch which adds the option of specifying the
> service name, but otherwise does not alter the functionality of how Apache
> finds its configuration file.

If we allow multiple servers, I believe we have to change the way Apache
finds its configuration information.  This is why:

Consider two Apache services:

ServerA, with a ConfPath of \ServerA\conf\httpd.conf
ServerB, with a ConfPath of \ServerB\conf\httpd.conf

Say ServerA was installed first, so the registry entries look like:
HKLM/SOFTWARE/Apache Group/Apache/[Version]/ConfPath=\ServerA\conf\httpd.conf
HKLM/SYSTEM/CCS/Services/ServerA/Parameters/ConfPath=\ServerA\conf\httpd.conf
HKLM/SYSTEM/CCS/Services/ServerB/Parameters/ConfPath=\ServerB\conf\httpd.conf

If both servers are running, and the user issues "apache -k shutdown" from
\ServerB, ServerA will shutdown.  Apache currently will look for a
configuration only in HKLM/SOFTWARE and /HTTPD_ROOT/SERVER_CONFIG_FILE.
This result would be confusing and  not intuitive, because the user
expects ServerB, the cwd, to shutdown.
Apache should look for ./SERVER_CONFIG_FILE before it looks in the registry.

This is the way Win32 searches for DLLs- cwd takes precedence.

Keith Wannamaker
IBM HTTP Server Development

Re: NT multiple services patch

Posted by Keith Wannamaker <kr...@raleigh.ibm.com>.
Paul Sutton wrote:
> 
> On Thu, 18 Mar 1999, Keith Wannamaker wrote:
> > Paul Sutton wrote:
> > > On Thu, 18 Mar 1999, Bill Stoddard wrote:
> > > > wannamak@us.ibm.com wrote:
> > > > > The following options were added or modified:
> > > > >
> > > > > -f [server]         : Force this Apache to use config of [server]
> > > > > -t [server]         : Test the config of [server]
> > > > > -i [name [server]]  : Install service "name" to use config [server]
> > > > > -u [name]           : Uninstall service "name"
> > > > > -k action [server]  : Signal running Apache [server] (console or service)
> > > > >                       action is (start|restart|shutdown)
> > > > >
> > > > > If server is not specified, Apache searches for it in this order:
> > > > >
> > > > > 1) ./SERVER_CONFIG_FILE
> > > > > 2) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > > > /[Version]/ConfPath
> > > > > 3) /HTTPD_ROOT/SERVER_CONFIG_FILE
> > > > >
> > > > > .. with the exception of -k, for which we add a step
> > > > > 1.5) Registry: HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > > > /[Version]/LastRun
> > > > >     (the confpath of the last Apache instance)
> > > > >
> > > > > If name is not specified with -i or -u, Apache uses the default ("Apache").
> > > >
> > > > I'm planning to commit this patch later today unless I hear objections.
> > >
> > > Wouldn't it be simpler just to have a new argument which specifies the
> > > service name, which could be used with any other the other options. E.g.
> > > (say using -n for this argument):
> >
> > That's what the patch allows you to do, without the "-n".
> 
> Yes, I just think it is cleaner to allow the setting of the service name
> via an (optional) argument rather than bay adding additional processing
> for each of the -k, -u, -i and -t options.

In the patch, the service name can be set with an optional argument, -f.
ie
apache -f foo_service -t 
is equivalent to
apache -t foo_service

I added the check for a service name with the -t, -i, -u, -k options for
usability.  It seems more intuitive.

> 
> > > In the registry, simply add the "name" (as given by -n or defaulting to
> > > Apache) to the key, e.g:
> > >
> > >   HKLW/SOFTWARE/Apache Group/Apache/<version>/<name>
> >
> > The patch stores the config file path in the registry
> > key under each service entry.
> >
> > Since the patch does what you suggest, I'm not sure I understand.
> > Simpler from a coding perspective?
> 
> Well, the patch actually makes various changes to the way that Apache
> finds its configuration information (as listed in your steps 1, 1.5, 2 and
> 3, above). I'd prefer a patch which adds the option of specifying the
> service name, but otherwise does not alter the functionality of how Apache
> finds its configuration file.

The following discussion applies only to cases where a user does not 
specify a particular configuration:

Apache currently searches for its configuration like so:
(1) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
    /[Version]/ServerRoot
(2) /HTTPD_ROOT/SERVER_CONFIG_FILE

This is not sufficient when multiple configurations are introduced.
It is easier to separate configurations in directories than to override
the locations of the logging and pid files in each configuration.
Assuming that,

(1) ./SERVER_CONFIG_FILE was added so an Apache console server would
load the 
intuitive configuration if a user's cwd was a particular server root.

Multiple configurations also introduce another problem:  Signaling.
Apache _services_ are easy, because the service is a unique identifier
for
a particular conf file (it is stored under each service entry). 
However, if an
Apache console server is started, who knows which configuration the user
specified?
That's why the (1.5) LastRun step was added.

Every Apache instance updates LastRun to the conf path it is using.
This fulfills the requirement that a console Apache server started in
one console can be subsequently killed by a simply "apache -k shutdown"
from another console (assuming no other Apache instances are started in
the interim).

> 
> The patch contains the following comment:
> 
> +/* To allow for multiple services, store the configuration file's full path
> + * under each service entry:
> + *
> + * HKLM\System\CurrentControlSet\Services\[service name]\Parameters\ConfPath
> + *
> + * The default configuration path (for console apache) is stored:
> + *
> + * HKLM\Software\[Vendor]\[Software]\[Version]\ConfPath
> + *
> + * The last console apache configuration path is stored:
> + *
> + * HKLM\Software\[Vendor]\[Software]\[Version]\LastRun
> + */
> 
> So it is storing the path under ConfPath in the services section of the
> current control set, rather than under HKLM\SOFTWARE. It seems to replace
> ServerRoot with ConfPath. This is where I start to loose track of the how
> the explanation in your mail message map onto the patch. It seems that
> there are a lot more changes involved than are listed in the mail. We need
> to understand the implications of this patch in detail, especially as it
> seems it will alter the current way that Apache works.

ServerRoot does not uniquely identify multiple configurations - ConfPath
does.
The patch does replace ServerRoot with ConfPath.

For services, ConfPath is stored under the service name.
For the "default" console server, ConfPath is stored under
HKLM\SOFTWARE.
It's similar to ServerRoot (What conf does "apache" in a non-server root
cwd use?)

The patch adds a great deal of flexibility to Win32 Apache by
accommodating
multiple console and service configurations, while maintaining backwards 
compatibility.  It changes the way Apache finds it's configuration, but
it's
business-as-usual after that.

> Speaking of the patch, it is larger than it needs to be because of changes
> in indentation. It would be nice also if you could limit lines to 80
> characters wide to avoid line wraps.

It does map sections the files it touches to the spaces-not-tabs Apache
coding standard.  I can adjust the formatting of the source code to < 80
chrs.

Keith Wannamaker
IBM HTTP Server Development Team
RTP, NC, USA

Re: NT multiple services patch

Posted by Paul Sutton <pa...@awe.com>.
On Thu, 18 Mar 1999, Keith Wannamaker wrote:
> Paul Sutton wrote:
> > On Thu, 18 Mar 1999, Bill Stoddard wrote:
> > > wannamak@us.ibm.com wrote:
> > > > The following options were added or modified:
> > > >
> > > > -f [server]         : Force this Apache to use config of [server]
> > > > -t [server]         : Test the config of [server]
> > > > -i [name [server]]  : Install service "name" to use config [server]
> > > > -u [name]           : Uninstall service "name"
> > > > -k action [server]  : Signal running Apache [server] (console or service)
> > > >                       action is (start|restart|shutdown)
> > > >
> > > > If server is not specified, Apache searches for it in this order:
> > > >
> > > > 1) ./SERVER_CONFIG_FILE
> > > > 2) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > > /[Version]/ConfPath
> > > > 3) /HTTPD_ROOT/SERVER_CONFIG_FILE
> > > >
> > > > .. with the exception of -k, for which we add a step
> > > > 1.5) Registry: HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > > /[Version]/LastRun
> > > >     (the confpath of the last Apache instance)
> > > >
> > > > If name is not specified with -i or -u, Apache uses the default ("Apache").
> > >
> > > I'm planning to commit this patch later today unless I hear objections.
> > 
> > Wouldn't it be simpler just to have a new argument which specifies the
> > service name, which could be used with any other the other options. E.g.
> > (say using -n for this argument):
> 
> That's what the patch allows you to do, without the "-n".

Yes, I just think it is cleaner to allow the setting of the service name
via an (optional) argument rather than bay adding additional processing
for each of the -k, -u, -i and -t options.

> > In the registry, simply add the "name" (as given by -n or defaulting to
> > Apache) to the key, e.g:
> > 
> >   HKLW/SOFTWARE/Apache Group/Apache/<version>/<name>
> 
> The patch stores the config file path in the registry
> key under each service entry.
> 
> Since the patch does what you suggest, I'm not sure I understand.
> Simpler from a coding perspective?

Well, the patch actually makes various changes to the way that Apache
finds its configuration information (as listed in your steps 1, 1.5, 2 and
3, above). I'd prefer a patch which adds the option of specifying the
service name, but otherwise does not alter the functionality of how Apache
finds its configuration file.

The patch contains the following comment:

+/* To allow for multiple services, store the configuration file's full path
+ * under each service entry:
+ *
+ * HKLM\System\CurrentControlSet\Services\[service name]\Parameters\ConfPath
+ *
+ * The default configuration path (for console apache) is stored:
+ * 
+ * HKLM\Software\[Vendor]\[Software]\[Version]\ConfPath
+ *
+ * The last console apache configuration path is stored:
+ *
+ * HKLM\Software\[Vendor]\[Software]\[Version]\LastRun
+ */

So it is storing the path under ConfPath in the services section of the
current control set, rather than under HKLM\SOFTWARE. It seems to replace
ServerRoot with ConfPath. This is where I start to loose track of the how
the explanation in your mail message map onto the patch. It seems that
there are a lot more changes involved than are listed in the mail. We need
to understand the implications of this patch in detail, especially as it
seems it will alter the current way that Apache works. 

Speaking of the patch, it is larger than it needs to be because of changes
in indentation. It would be nice also if you could limit lines to 80
characters wide to avoid line wraps.

Paul


Re: NT multiple services patch

Posted by Keith Wannamaker <kr...@raleigh.ibm.com>.
Paul Sutton wrote:
> 
> On Thu, 18 Mar 1999, Bill Stoddard wrote:
> > wannamak@us.ibm.com wrote:
> > > This patch enables multiple servers on NT by providing a clean way to
> > > install, uninstall, and signal multiple services.  A server is referred to
> > > by either its service name or the full path to its configuration file.
> > >
> > > The following options were added or modified:
> > >
> > > -f [server]         : Force this Apache to use config of [server]
> > > -t [server]         : Test the config of [server]
> > > -i [name [server]]  : Install service "name" to use config [server]
> > > -u [name]           : Uninstall service "name"
> > > -k action [server]  : Signal running Apache [server] (console or service)
> > >                       action is (start|restart|shutdown)
> > >
> > > If server is not specified, Apache searches for it in this order:
> > >
> > > 1) ./SERVER_CONFIG_FILE
> > > 2) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > /[Version]/ConfPath
> > > 3) /HTTPD_ROOT/SERVER_CONFIG_FILE
> > >
> > > .. with the exception of -k, for which we add a step
> > > 1.5) Registry: HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > > /[Version]/LastRun
> > >     (the confpath of the last Apache instance)
> > >
> > > If name is not specified with -i or -u, Apache uses the default ("Apache").
> >
> > I'm planning to commit this patch later today unless I hear objections.
> 
> Wouldn't it be simpler just to have a new argument which specifies the
> service name, which could be used with any other the other options. E.g.
> (say using -n for this argument):
> 
>   apache -n Apache
>   apache -n Apache2
> 
> to start two copies of Apache, and
> 
>   apache -n Apache -k shutdown
>   apache -n Apache2 -k shutdown
> 

That's what the patch allows you to do, without the "-n".
With the patch, the syntax would be:

apache -k shutdown Apache or
apache -k shutdown (since "Apache" is the default)

apache -k shutdown Apache2

The patch allows you to interchange a service name or a config file path
for [server].

> If no -n option is given, default to "Apache" (the current setting).
> 
> In the registry, simply add the "name" (as given by -n or defaulting to
> Apache) to the key, e.g:
> 
>   HKLW/SOFTWARE/Apache Group/Apache/<version>/<name>

The patch stores the config file path in the registry
key under each service entry.

Since the patch does what you suggest, I'm not sure I understand.
Simpler from a coding perspective?

KW

Re: NT multiple services patch

Posted by Paul Sutton <pa...@awe.com>.
On Thu, 18 Mar 1999, Bill Stoddard wrote:
> wannamak@us.ibm.com wrote:
> > This patch enables multiple servers on NT by providing a clean way to
> > install, uninstall, and signal multiple services.  A server is referred to
> > by either its service name or the full path to its configuration file.
> > 
> > The following options were added or modified:
> > 
> > -f [server]         : Force this Apache to use config of [server]
> > -t [server]         : Test the config of [server]
> > -i [name [server]]  : Install service "name" to use config [server]
> > -u [name]           : Uninstall service "name"
> > -k action [server]  : Signal running Apache [server] (console or service)
> >                       action is (start|restart|shutdown)
> > 
> > If server is not specified, Apache searches for it in this order:
> > 
> > 1) ./SERVER_CONFIG_FILE
> > 2) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > /[Version]/ConfPath
> > 3) /HTTPD_ROOT/SERVER_CONFIG_FILE
> > 
> > .. with the exception of -k, for which we add a step
> > 1.5) Registry: HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> > /[Version]/LastRun
> >     (the confpath of the last Apache instance)
> > 
> > If name is not specified with -i or -u, Apache uses the default ("Apache").
> 
> I'm planning to commit this patch later today unless I hear objections.

Wouldn't it be simpler just to have a new argument which specifies the
service name, which could be used with any other the other options. E.g.
(say using -n for this argument):

  apache -n Apache
  apache -n Apache2

to start two copies of Apache, and
  
  apache -n Apache -k shutdown
  apache -n Apache2 -k shutdown

If no -n option is given, default to "Apache" (the current setting).

In the registry, simply add the "name" (as given by -n or defaulting to
Apache) to the key, e.g:

  HKLW/SOFTWARE/Apache Group/Apache/<version>/<name>

Paul



Re: NT multiple services patch

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
wannamak@us.ibm.com wrote:
> 
> This patch enables multiple servers on NT by providing a clean way to
> install, uninstall, and signal multiple services.  A server is referred to
> by either its service name or the full path to its configuration file.
> 
> The following options were added or modified:
> 
> -f [server]         : Force this Apache to use config of [server]
> -t [server]         : Test the config of [server]
> -i [name [server]]  : Install service "name" to use config [server]
> -u [name]           : Uninstall service "name"
> -k action [server]  : Signal running Apache [server] (console or service)
>                       action is (start|restart|shutdown)
> 
> If server is not specified, Apache searches for it in this order:
> 
> 1) ./SERVER_CONFIG_FILE
> 2) Registry:  HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> /[Version]/ConfPath
> 3) /HTTPD_ROOT/SERVER_CONFIG_FILE
> 
> .. with the exception of -k, for which we add a step
> 1.5) Registry: HKEY_LOCAL_MACHINE/SOFTWARE/Apache Group/Apache
> /[Version]/LastRun
>     (the confpath of the last Apache instance)
> 
> If name is not specified with -i or -u, Apache uses the default ("Apache").
> 
> (See attached file: service.pch)


I'm planning to commit this patch later today unless I hear objections.


-- 
Bill Stoddard
stoddard@raleigh.ibm.com