Strange title, I know. But hear me out.

I talked before about creating easy to deploy "AOLserver Applications". This is do-able the way I described it, but to do it right, quite invasive in the core. And it probably still won't be simple enough for people used to PHP deployments.

Here are some other thoughts to make deploying a new app as simple as it is in PHP:

- On demand pools
I looked into the nsdb code and nothing seems to indicate that you can't define pools at any time you please. So a special "ns_db gethandle" that takes something like "nsdb:postgres:localhost:5432/ mydb?user=foo&password=bar&timeout=10&max=20" should be implementable. It would create a handle name from the arguments (rewrite them; people could use a different order of arguments in different places...) and then see it the pool exists. If not, define the pool and then continue as normal.

All this would require from the user is editting the main config file with:

ns_section "ns/db/drivers"
ns_param   postgres nspostgres.so

in fact, "base.tcl" could do a "file exists" for every know database driver and load it if it is there.


- On demand libraries
create an "ns_libload" command. sources a tcl file from the given location (relative), in the global scope. In a special namespace in the interpreter, an array is kept of which have been loaded and what the mtime was. With the "ns_libload_mode" command you can set it to "always", "check" and "persist". Check would be default; ever time the ns_modload for that file is called, the mtime is checked; if it is new, load it. This would overwrite any procs with the same name that already exist. Because every interpreter loads any library only once, this should be just as efficient as the current libs. (when set to persist, of course!)

Good practice would be to only ever source 1 library in any .adp, which in turn takes care of sourcing anything, but that is up to the user.

- .nsaccess files
Work pretty similar to Apache's .htaccess. They are sourced by "walking back" the directory tree and the first one found counts for all subdirectories. These could have a section of stuff that needs to be executed before the actual URL is processed. This means you could do a request to /news/story/1234.html and the .htaccess in the news directory would be called first and does an ns_registerproc to handle "/news/story*". A run-once section could be used to schedule procedures.

The last on is the most invasive in the core, but the first two seem very do-able. The library thing can be done entirely in Tcl, probably in an hour or two! But it's no good without also doing the first. (database on demand)

My goal with this all is that all a user needs to do to install "ns_wiki" is to:
# cd /usr/local/aolserver/servers/server1/pages
# tar -xvzf ns_wiki.tar
# mv ns_wiki wiki
# chown nsd wiki/wiki.cfg

A "setup.adp" could ask for database detail, work out where it is so it can register the correct urls and take all other sorts of config paramters.

Of course, none if this will change the behaviour of any existing AOLserver apps, which is the beauty of this solution!

Any thoughts?

Bas.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to