Gmane
Favicon
From: Robin H. Johnson <robbat2 <at> gentoo.org>
Subject: Re: [GLEP] Web Application Installation. Plotting a VHOST config tool.
Newsgroups: gmane.linux.gentoo.devel
Date: 2003-08-06 04:37:41 GMT (4 years, 47 weeks, 5 days, 18 hours and 45 minutes ago)
On Wed, Aug 06, 2003 at 03:44:44AM +0100, Stuart Herbert wrote:
Content-Description: signed data
> On Wednesday 06 August 2003 3:16 am, Robin H.Johnson wrote:
> > Where do you see -vhosts fiting into having multiple instances of a
> > webapp on a single host ?
> 
> Personally, I don't.  If you want multiple instances of a webapp on a single 
> host, the webapps need to be installed with +vhosts.
> 
> -vhosts would be strictly single copy single domain scenario.
Ok, so if -vhosts, we install to /usr/share/webapp/(whatever) and
automatically run the webapp-config tool ?

if +vhosts, we install to /usr/share/webapp/(whatever) and the
administrator is left to run the rest himself.

> > > Btw, talked to Woodchip on IRC tonight, and he seemed happy enough
> > > with us moving the default -vhosts DocRoot from /home/httpd.  So I'm
> > > gonna strongly advocate that the default -vhosts DocRoot moves to
> > > /var/www/localhost/public_html in the near future.
> > Sounds good.
As part of the planning, and a good first step
I'm plotting out a config tool for adding vhosts. All comments welcome
as this is intended to be a good outline of what the tool must do etc
before I write it (borrowing heavily from my exist custom scripts for
the purpose).

Stuart: once before you asked why I didn't use dynamic vhosts.
Two reasons behind it. Firstly, I want seperate log files for each
vhost, and secondly I have a lot of apache configuration directives that
vary per server (funky mod_rewrite stuff mainly to make variable
handling in php interesting). Based on this, I strongly believe that
'simple' vhosts are the best way to go in general.

Looking at the current /home/httpd:
We have:
htdocs cgi-bin error icon

All of these can go into the the /var/www/localhost/ quite easily.

/var/www/≤vhost>/{error,icon} symlink back to the default host usually
(anybody wanting to use them changes them as needed).

I feel the name 'htdocs' belies the meaning of the directory more
accurately, but I'm looking for input on that item.

In my personal setup, I have:
/etc/apache2/conf/vhosts/${FQDN#*.}/${FQDN}
/var/www/${FQDN#*.}/${FQDN}/{htdocs,cgi-bin}
/var/log/apache2/${FQDN#*.}/${FQDN}/
Then I do:
"include /etc/apache2/conf/vhosts/" in my main apache config :-).

But I don't think we really need a hashed setup do we? make it a config
option because I don't know who will want it.

Rough outline of tool:

vhost-config must do three things:
- creates directories (copies a skeleton directory for the most part).
- create apache vhost config files.
- HUP apache so it reads in the new config without stopping.

Proposed rough usage:
vhost-config [opts] fully.qualified-domain.name

opts:
-s server
which server to use this with, defaults to apache, mostly a moot point
until more virtual/httpd exists.
-u owner 
user owner of all files, defaults root for security.
-g group
group owner of all files, defaults to root for security.
-p perms
initial permissions, defaults to 644 (OR'd with 111 for directories).
-G
shortcut for having group writable permissions (effective does OR 020).
-i 
symlink /var/www/localhost/icons to provide icons. (default)
-I [dir]
copies /var/www/localhost/icons to a new directory. Optionally provides
a different directory to take them from.
-e 
symlink /var/www/localhost/error to provide error pages. (default)
-E [dir]
copies /var/www/localhost/error to a new directory. Optionally provides
a different directory to take them from.
-k directory
specify a different skeleton directory (defaults to /etc/vhost-skel/)
-H
HUP apache on completion if everything is good to go.
-h
don't HUP apache at all.
-f file
path to alternative config file (default is /etc/vhost-config.conf).

/etc/vhost-skel/ might contain:
htdocs/ = maybe a simple index.html ?
cgi-bin/ = empty 
icons/ = symlink to /var/www/localhost/icons
error/ = symlink to /var/www/localhost/error
conf/ = [treated specially] ${server}.conf that is used for creating the initial config,
templates of some sort (I'm leaning to M4 as all my existing stuff is in
it, and it's good for templating like this).

After vhost-config has generated all of the nessicary stuff, it should
HUP the apache server if everything is in order.

There is one check that is outside the scope of the tool, namely the
existance of DNS for the specified hostname. If the admin creates a
vhost that does not yet have DNS or name resolution relative to the
system, we should display a warning.

I'd repeat again for good measure, this email is strongly based off the
present capabilites of my private vhost setup scripts, plus the features
I as a developer, sysadmin and user want in a new revision. However I
strongly feel that more input is needed as well.

-- 
Robin Hugh Johnson
E-Mail     : robbat2 <at> orbis-terrarum.net
Home Page  : http://www.orbis-terrarum.net/?l=people.robbat2
ICQ#       : 30269588 or 41961639
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85