Re: Multihomed hosts and virtual web hosts

Jonathan Hogg <[email protected]> Sat, 03 May 2003 17:50:53 +0100
Newsgroups gmane.comp.sysutils.ark.devel
Organization One Good Idea Ltd.
Message-ID <BAD9B1FD.1ACEF%[email protected]>
On 2/5/03 18:23, Shprentz, Joel [C] wrote:

> None of the Sidai host and network configurations support multiple IP
> addresses per host. Instead, the code is sprinkled with error messages like
> this:
> 
> raise ark.error.GeneralPanic, 'Can only have one IP address at the moment
> :-('
> 
> Has anyone turned those frowns into smiles?

I've not tried this before I'm afraid.

> Our web servers have multiple IP addresses on the public side to support
> virtual web hosts. The Sidai Apache configuration appears to support a
> single host. Since a virtual host, www.abc.com, could be hosted on multiple
> load-balanced computers (and influence their network and Apache
> configurations), I am exploring the idea of defining an XML file for each
> virtual host (either in the hosts directory or a new virtual-hosts
> directory).  This XML file could describe the virtual host's Apache
> configuration, its IP address(es), etc.
> 
> I would appreciated hearing from anyone who has tried something similar.

However, I have played with this. I had a new thing type called "website",
which I generated the Apache config file from. This was done in the
httpd.conf.tmpl file - loading the ArkWebsiteMgr and iterating through all
the items calling a method on them to generate a virtual host spec fragment.

I'm afraid the exact mechanism is lost in the mists of time as I have since
moved on from the place I did this and my memory is vague. I recall that I
basically had config files something like:

    <website name="www.foo.bar">

        <prototypes>
            <prototype group="." name="standard-site"/>
            <prototype group="." name="ALL"/>
        </prototypes>

        <server> chewbacca </server>

        <host> www.foo.bar </host>
        <user> foo </user>
        <group> foo </group>

        <root> /site/www.foo.bar </root>

    </website>

The idea is that when generating the httpd.conf file on the host
"chewbacca", I'd include a virtual host spec for each website that had
"chewbacca" in its <server/>. How to do the thing manager stuff is lost on
me now, but it worked something like:

    ...

    # Ark-generated virtual hosts:

    <%
        websiteMgr = ArkWebsiteMgr()
        for website in websiteMgr.getall():
            print website.generate_virtual_host_spec()
    %>

The standard-site prototype had more machinery in it for setting the log
files and spitting out the spec based on these config variables.

    <website name="standard-site" prototype="yes">

        <document-root> @website:root@/docs </document-root>
        <log-root> @website:root@/log </log-root>
        <error-log> @website:log-root@/errorlog </error-log>
        ...

    </website>

(Forgive me, it's actually been a while since I used ARK and I've forgotten
the exact syntax for the magic @...@ macros - you should get the idea.)

The other neat thing I could do was add methods that prepared the
directories and checked the webserver was responding to requests for that
virtual host, like:

    % ark website prepare www.foo.bar
    % ark website check ALL

Will is the undisputed King Of Understanding How To Add New Things ;-)

Jonathan




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf