Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Automatic webserver config file generation

by mp (Deacon)
on Aug 27, 2002 at 03:25 UTC ( #193077=perlquestion: print w/replies, xml ) Need Help??

mp has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to develop a build process to create a handful of webserver configuration files (httpd.conf, perl modules that are included on server startup, etc.) for multiple non-identical servers. I am planning to use Template Toolkit to generate the configuration files from a set of templates that differ per server, and some common data that the templates pull in. I am using CVS to manage sharing the source files (templates, data, and perl modules that implement the site) between the various servers.

I have a pretty good handle on how to go about writing and organizing the template files and writing the code to expand them into particular config files, but I don't have a very good handle on how to setup the overall build process.

What I envision is doing a CVS update on the server in question, running something that generates a correct Makefile based on the server's hostname. Then run 'make' to build the files prior to install, 'make test' to do some basic sanity checks, 'make install' to copy the files to their final destination in the appropriate config directories.

To me, this sounds a lot like the typical build process for CPAN modules, but I don't have experience with writing modules for CPAN, only installing and using them. The main difference seems to be that the files in question are primarily configuration files for Apache rather than perl modules and that their destination directories differ.

Is doing something based on ExtUtils::MakeMaker a good way to approach this problem (I have no experience with it)? Or, is there something simpler that I should look at? Overall, does what I described here seem like a sound approach?

  • Comment on Automatic webserver config file generation

Replies are listed 'Best First'.
Re: Automatic webserver config file generation
by PodMaster (Abbot) on Aug 27, 2002 at 05:36 UTC
    ExtUtils::MakeMaker is a good way to go ( god knows shell scripts aren't too portable ), and is practically guaranteed to work on any platform perl runs on.

    You should look at least look at Apache::Config (there's a whole bunch of those modules, and you ought to at least consider two of those).

    Another way to go, and potentially easier to manage, is Ant (it's all xml), which is practically guaranteed to run on any platform java runs on.

    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: Automatic webserver config file generation
by Aristotle (Chancellor) on Aug 27, 2002 at 11:20 UTC

    Config::General uses a configuration file format that's strikingly close to the Apache's. I'm not sure it's entirely compatible, but it is probably worth looking into. The interface is pleasantly simple.

    If you stick with your Template Toolkit approach, its ttree tool can be used to handle the build process, although you still need to cook something up for testing.

    Makeshifts last the longest.

      Thanks you. I am looking at using ttree (or a derivative of it, like what Randall's article describes, if I run into limitations).
•Re: Automatic webserver config file generation
by merlyn (Sage) on Aug 27, 2002 at 17:25 UTC
      Thanks, Randall. Your article was quite helpful.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://193077]
Approved by Zaxo
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-07-01 10:56 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (98 votes). Check out past polls.