As an addendum to Alex's email I feel I should  explain a few of
scripts and CGIs that kept the system running behind the scenes.

4D Client
=======
Each copy of 4D Client was launched, and managed, with a Perl script.
This script did the following:

1. Polls the 4D server's database port and if there was a positive
response launch 4D Client.
2. After launching the 4D client the script would shift into a
different mode where it would poll the 4D Client's internal web port
for a simple active4D file, but one the did include a few lines of
embedded a4d that did nothing but return some standard text. ( I think
the text was something in the region of "The System is operating".)
The first positive response that matched the text would indicate that
the system is fully operational and a CGI on the gateway server was
called that added this server into the server pool list.

The script would then poll the server at a specified interval checking
the returned text. If an error occurred, or the text did not match
then this was considered to be grounds to remove this server from the
server pool. So a server remove CGI was called on the gateway server
that removed this from the server pool and then Perl's Win32 support
was used to Force Quit the 4D client and the process resumed from 1.
above.

Web Server in front of 4D Client
=======================

On the Web server in front of the 4D client it was setup as standard
to Proxy requests through to the 4D Client but a custom CGI was
attached to the 503 error handler. This error handler did 2 things:
1. When called it also called the removeCGI on the gateway server.
2. Redirected the user back to the gateway server so it can reselect
another server from the pool.

Gateway Server
============

The Add and Remove CGIs mentioned above:  these two seperate CGIs add
or remove the specified server a mod_rewrite random map. These CGIs
were protected in that they could not be called from the internet.

Incoming requests, that don't have a server assignment cookie set call
a mod_rewrite random map where a server prefix is randomly selected
from the map created with the add and remove CGIs above. If there are
no servers in the map then default server is "error" and this causes,
later on in the mod_rewrite setup, the request to be redirected to a
standard error page.

Now if there is a server assignment cookie, either set above, or from
an external request the prefix is placed into another mod_rewrite map,
this time not a random map, and the actual internal server IP address
and port is returned. These are then used to proxy the request to the
actual server than the prefix addresses.

A final CGI was also present on the gateway server, this CGI allowed
us to see the status of the 4D Server, the 4D Clients and the Web
Servers on the Client machine. It also presented us with the ability
to call the Add/Remove CGIs for arbitary machines. ( This script was,
of course, password protected.) In the days before full xhtml browsers
this was designed as a WML page and an extremely light html page
meaning we could, and did, manage the server from our mobile phones.

Michael Bond
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to