You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rainer Jung <ra...@kippdata.de> on 2006/08/25 14:05:25 UTC

mod_define ported to httpd 2.0/2.2

Hi,

I ported mod_define to Apache httpd 2.0 and 2.2.

The module has been originally created by Ralf S. Engelschall for Apache
httpd 1.3 and distributed as an addon to mod_ssl (although it's function
is unrelated to mod_ssl).

There are a couple of people who were looking for a 2.0/2.2 compatible
version on various discussion lists.

I ported it, keeping most of the functional code unchanged, only
changing how it sticks into the new configuration hooks.

I asked Ralf, and we would like to make it available under the ASL 2.0.
Is there a chance to include it into the httpd distribution? Any ideas
about a better home? If there is interest in it, I would place code and
docs on people.apache.org.

The module is a nice enhancemnt to make httpd configs more flexible
without using a much more complex apparatus. It allows to define and use
variables in the configs. Variables could either be defined in the
configs themselves, or induced from the outside as environmnt variables.
In contrast to the usual defines, the variables can be used in all
places in the configuration files.

One unofficial source for the original docs is:

http://www.opensource.apple.com/darwinsource/Current/apache_mod_ssl-680/mod_ssl/pkg.addon/mod_define.html

Regards,

Rainer

Re: mod_define ported to httpd 2.0/2.2

Posted by Jorge Schrauwen <jo...@gmail.com>.
Sounds very intresting, especially in combination with mod_macro!

It's win32 compatible also i presume?

On 8/25/06, Rainer Jung <ra...@kippdata.de> wrote:
> Hi,
>
> I ported mod_define to Apache httpd 2.0 and 2.2.
>
> The module has been originally created by Ralf S. Engelschall for Apache
> httpd 1.3 and distributed as an addon to mod_ssl (although it's function
> is unrelated to mod_ssl).
>
> There are a couple of people who were looking for a 2.0/2.2 compatible
> version on various discussion lists.
>
> I ported it, keeping most of the functional code unchanged, only
> changing how it sticks into the new configuration hooks.
>
> I asked Ralf, and we would like to make it available under the ASL 2.0.
> Is there a chance to include it into the httpd distribution? Any ideas
> about a better home? If there is interest in it, I would place code and
> docs on people.apache.org.
>
> The module is a nice enhancemnt to make httpd configs more flexible
> without using a much more complex apparatus. It allows to define and use
> variables in the configs. Variables could either be defined in the
> configs themselves, or induced from the outside as environmnt variables.
> In contrast to the usual defines, the variables can be used in all
> places in the configuration files.
>
> One unofficial source for the original docs is:
>
> http://www.opensource.apple.com/darwinsource/Current/apache_mod_ssl-680/mod_ssl/pkg.addon/mod_define.html
>
> Regards,
>
> Rainer
>


-- 
~Jorge

Re: mod_define ported to httpd 2.0/2.2

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Aug 25, 2006, at 9:35 AM, Nick Kew wrote:

> On Friday 25 August 2006 14:05, Jim Jagielski wrote:
>> I've never been a fan of mod_define, seeing mod_macro (as
>> Jorge seems to think as well) as much more useful...
>
> Agreed, mod_macro is *the* configuration module:-)
>

:)

>> check
>> out some of my OLD Apache PPTs from the 1st ApacheCons ;)
>> My main issue with mod_define is that there always seemed to
>> be such potential for issues and conflicts, esp when you
>> have rewrite rules, etc...
>
> The argument in favour is that we do periodically get requests
> for variable interpolation in various directives.  A general framework
> would have some value.  But to be really useful, it'll have
> to deal with both config-time and request-time interpolation
> without confusing the hell out of the lusers.  And probably
> other issues I haven't thought about.
>

Many many many years ago (relatively speaking) there was
healthy debate and discussion on having this be native
to Apache or whether 'm4' was good enough... The idea
that people who needed this functionality would be
better served by having an out-of-process job create
the httpd.conf file for you, instead of Apache doing
it all during config time...

I've setup several complex sites which do just that. During
the web server startup process, before apachectl is called,
a Perl script (I'd do it in Ruby now but that's besides the
point) creates a httpd.conf file from pulling in lots
of external info and thus creating it on-the-fly. mod_macro
is useful for such a template-like setup.


Re: mod_define ported to httpd 2.0/2.2

Posted by Jorge Schrauwen <jo...@gmail.com>.
On 8/25/06, Rainer Jung <ra...@kippdata.de> wrote:
> Thanks for the feedback. I'll post URLs during the weekend. Of course
> you'll need to look at it before making decisions, I was simply
> interested in a first basic opinion.
>
> Concerning mod_define and mod_macro: they are a good fit together.
> mod_macro gives you the ability to factor out repeating parts of the
> config, but you have to explicitely call the macros with values.
>
> With mod_define you can set the values from the outside using
> environment variables. That way you can start similar instances with the
> same configs by setting params values during startup - without the need
> to copy and patch the config files.
>
> Sometime one should fuse the two together, but I had the impression,
> that the code of mod_macro first needs some reworking to make it fit
> better into the 2.0/2.2 configuration hooks.
>
the latest version runs quite well, afther some minor tweaks it seems
to compile on mac, win32 and win64 without a problem...

I'm share a config that makes use of mod_macro between my windows and
mac machine atm.

> Regards,
>
> Rainer
>
> Nick Kew schrieb:
> > On Friday 25 August 2006 14:05, Jim Jagielski wrote:
> >> I'm +0 about it, but I agree that I'd like to see
> >> the package 1st :)
> >>
> >> I've never been a fan of mod_define, seeing mod_macro (as
> >> Jorge seems to think as well) as much more useful...
> >
> > Agreed, mod_macro is *the* configuration module:-)
> >
> >> check
> >> out some of my OLD Apache PPTs from the 1st ApacheCons ;)
> >> My main issue with mod_define is that there always seemed to
> >> be such potential for issues and conflicts, esp when you
> >> have rewrite rules, etc...
> >
> > The argument in favour is that we do periodically get requests
> > for variable interpolation in various directives.  A general framework
> > would have some value.  But to be really useful, it'll have
> > to deal with both config-time and request-time interpolation
> > without confusing the hell out of the lusers.  And probably
> > other issues I haven't thought about.
> >
>


-- 
~Jorge

Re: mod_define ported to httpd 2.0/2.2

Posted by Rainer Jung <ra...@kippdata.de>.
Hi Joshua,

that's a very good hint. Somehow I missed ap_resolve_env() when I
searched through the code to check the built-in features.

So is ap_resolve_env() an official feature?

Regards,

Rainer

Joshua Slive schrieb:
> On 8/25/06, Rainer Jung <ra...@kippdata.de> wrote:
>> I put the code up on http://people.apache.org/~rjung/mod_define/
>>
>> Comments are welcome.
>>
>> For big sites and well trained admins having an external tool like m4,
>> scripting languages, ant etc. might be the better way to use config
>> templates.
>>
>> But for a couple of easier use cases and less skilled admins, mod_define
>> seems to be easily usable and makes mod_macro more powerful.
> 
> Isn't this all sort-of obsoleted by the undocumented fact that httpd
> 2.x already resolves env variables in the config file.  (Not that I
> think that is a particularly good idea, but...)
> 
> Joshua.

Re: mod_define ported to httpd 2.0/2.2

Posted by Joshua Slive <jo...@slive.ca>.
On 8/25/06, Rainer Jung <ra...@kippdata.de> wrote:
> I put the code up on http://people.apache.org/~rjung/mod_define/
>
> Comments are welcome.
>
> For big sites and well trained admins having an external tool like m4,
> scripting languages, ant etc. might be the better way to use config
> templates.
>
> But for a couple of easier use cases and less skilled admins, mod_define
> seems to be easily usable and makes mod_macro more powerful.

Isn't this all sort-of obsoleted by the undocumented fact that httpd
2.x already resolves env variables in the config file.  (Not that I
think that is a particularly good idea, but...)

Joshua.

Re: mod_define ported to httpd 2.0/2.2

Posted by Rainer Jung <ra...@kippdata.de>.
I put the code up on http://people.apache.org/~rjung/mod_define/

Comments are welcome.

For big sites and well trained admins having an external tool like m4,
scripting languages, ant etc. might be the better way to use config
templates.

But for a couple of easier use cases and less skilled admins, mod_define
seems to be easily usable and makes mod_macro more powerful.

Regards,

Rainer

Re: mod_define ported to httpd 2.0/2.2

Posted by Rainer Jung <ra...@kippdata.de>.
Thanks for the feedback. I'll post URLs during the weekend. Of course
you'll need to look at it before making decisions, I was simply
interested in a first basic opinion.

Concerning mod_define and mod_macro: they are a good fit together.
mod_macro gives you the ability to factor out repeating parts of the
config, but you have to explicitely call the macros with values.

With mod_define you can set the values from the outside using
environment variables. That way you can start similar instances with the
same configs by setting params values during startup - without the need
to copy and patch the config files.

Sometime one should fuse the two together, but I had the impression,
that the code of mod_macro first needs some reworking to make it fit
better into the 2.0/2.2 configuration hooks.

Regards,

Rainer

Nick Kew schrieb:
> On Friday 25 August 2006 14:05, Jim Jagielski wrote:
>> I'm +0 about it, but I agree that I'd like to see
>> the package 1st :)
>>
>> I've never been a fan of mod_define, seeing mod_macro (as
>> Jorge seems to think as well) as much more useful...
> 
> Agreed, mod_macro is *the* configuration module:-)
> 
>> check 
>> out some of my OLD Apache PPTs from the 1st ApacheCons ;)
>> My main issue with mod_define is that there always seemed to
>> be such potential for issues and conflicts, esp when you
>> have rewrite rules, etc...
> 
> The argument in favour is that we do periodically get requests
> for variable interpolation in various directives.  A general framework
> would have some value.  But to be really useful, it'll have
> to deal with both config-time and request-time interpolation
> without confusing the hell out of the lusers.  And probably
> other issues I haven't thought about.
> 

Re: mod_define ported to httpd 2.0/2.2

Posted by Nick Kew <ni...@webthing.com>.
On Friday 25 August 2006 14:05, Jim Jagielski wrote:
> I'm +0 about it, but I agree that I'd like to see
> the package 1st :)
>
> I've never been a fan of mod_define, seeing mod_macro (as
> Jorge seems to think as well) as much more useful...

Agreed, mod_macro is *the* configuration module:-)

> check 
> out some of my OLD Apache PPTs from the 1st ApacheCons ;)
> My main issue with mod_define is that there always seemed to
> be such potential for issues and conflicts, esp when you
> have rewrite rules, etc...

The argument in favour is that we do periodically get requests
for variable interpolation in various directives.  A general framework
would have some value.  But to be really useful, it'll have
to deal with both config-time and request-time interpolation
without confusing the hell out of the lusers.  And probably
other issues I haven't thought about.

-- 
Nick Kew

Re: mod_define ported to httpd 2.0/2.2

Posted by Jim Jagielski <ji...@jaguNET.com>.
I'm +0 about it, but I agree that I'd like to see
the package 1st :)

I've never been a fan of mod_define, seeing mod_macro (as
Jorge seems to think as well) as much more useful... check
out some of my OLD Apache PPTs from the 1st ApacheCons ;)
My main issue with mod_define is that there always seemed to
be such potential for issues and conflicts, esp when you
have rewrite rules, etc...

Re: mod_define ported to httpd 2.0/2.2

Posted by Nick Kew <ni...@webthing.com>.
On Friday 25 August 2006 13:05, Rainer Jung wrote:

> I ported mod_define to Apache httpd 2.0 and 2.2.

URL?

> I asked Ralf, and we would like to make it available under the ASL 2.0.

That's your choice, of course.  I expect some users will appreciate it.

> Is there a chance to include it into the httpd distribution? Any ideas
> about a better home? If there is interest in it, I would place code and
> docs on people.apache.org.

Why not put it there now, so we can take a look?  Incorporating it
into the httpd distribution might be of interest, but I think we'd need
more information to judge that.

> http://www.opensource.apple.com/darwinsource/Current/apache_mod_ssl-680/mod
>_ssl/pkg.addon/mod_define.html

[an error occurred while processing this directive]  - twice on that page.

References to EAPI show it to be from Apache 1.  And I don't see
any links to documentation or source.

-- 
Nick Kew