Forum OpenACS Q&A: Virtual Hosting - OpenACS 3.2.5

Collapse
Posted by David Walker on
I've managed to hack together some procedures and methods in OpenACS 3.2.5 to give me the ability to do virtual hosting within a single instance of AOLServer. The problems with it are:
  • it doesn't know what to do with settings parsed during the server startup (It just takes those settings from the primary/default /web/<servername>/parameters/<servername>. tcl)
  • with the right coding it is possible to read settings and connect to database pools for other virtual servers
Is there any interest in this?

Does OpenACS 4 do virtual hosting?
Collapse
Posted by Yon Derek on
I think the problems with vhosting are more AOLServer-related than OpenACS-related. As I have a keen interest in those issues, I've just recently installed AOLServer 4 (still beta) with nsvhr and got virtual hosting working within one instance (no OpenACS but this is next on the plate). I believe that since AOLServer 4 supports vhosting better than 3.x did, you should be able to have it without any changes to OpenACS with both 3.2.5 and 4. This is, however, only educated guess at this time.
Collapse
Posted by David Walker on
I guess I can put your name down as not interested in Virtual Hosting within the OpenACS.

I would like to see the ability to host multiple OpenACS's in a single hostname (for use with SSL) and to do that the code must be in OpenACS
  • https://secure.vorteon.com/client1/
  • https://secure.vorteon.com/client2/

Right now I'm intercepting calls to ns_url2file, ns_db gethandle, and ns_info pageroot and a few other functions. This approach probably wouldn't work with java or C modules since I'm intercepting at the tcl layer.

If no one else is interested I'll just keep it to myself then.
Collapse
Posted by Tom Jackson on

David:

Virtual hosting means multiple domains, so you might be out of luck unless it is possible to load multiple nsssl modules each listening on a different ip. (Has anyone ever tried this?)

However, one ssl module can be used if you don't mind the browser popup warning of a domain name mismatch for one or more of the domains.

My VAT module has instructions for hosting more than one domain from one OpenACS install. Just keep in mind that aD never did anything to help with this situation. You can get a current copy of the VAT at: http://zmbh.com/discussion/vat/. Feel free to bug me over any install problems. As an example of two servers sharing one OpenACS: http://saleonall.com/ and http://stellardata.com/

Collapse
Posted by David Walker on
What I am talking about is having 2 or more separate db/pageroot combinations hosted on a single IP with a single certificate.

https://secure.vorteon.com/client1/ecommerce/ refers to the ecommerce module of client1
https://secure.vorteon.com/client2/ecommerce/ refers to the ecommerce module of client2
http://www.client1.com/bboard/ refers to the bboard module of client1
and http://www.client2.com/bboard/ referst to the bboard module of client2
all within a single instance of aolserver 3 series.

I forgot to mention that a single set of TCL procedures will apply to all the sites included.
I already have this working for the domain names but not yet for the domain name + subdirectory idea.
Collapse
Posted by Tom Jackson on

The VAT module includes a templating system. Templates are grouped into modules. Currently the module name is the first directory under pageroot. So in http://example.com/ecom/ 'ecom' would be the module name. If you had a script that showed the cart contents, that template would be named 'cart', for instance. if you set this up correctly, then visiting /ecom/cart would run the cart script and template. But the cart ending can be used anywhere under /ecom/, so you could encode the client number into the url just as well: /ecom/client1/cart. I have a simple proc that pulls the variables out of the url, that I have posted to this forum in the past. With this method, you can have one set of scripts and templates for many clients.

Collapse
Posted by Jonathan Ellis on
Not to rain on your parade, but typically when people speak of "virtual hosting" they mean complete separation of the two installations, including tcl procs. Otherwise you have two sites with the same ad_context_bar_ws, ad_footer, and the other dozen or so procs that you'd want distinct for each site.
Collapse
Posted by Tom Jackson on

Sorry to confuse everyone. In the future, when I use the phrase "virtual hosting" it shall mean a piece of software that uses the Host header to help distinguish what content to serve the request.

Collapse
Posted by David Walker on
Depending on the definition it is or isn't virtual hosting. It does use the header to determine what to serve. It does not offer a completely separate environment to each virtual site. It does use a different database and pageroot for each virtual site.

For me, if I am managing a set of sites, I find it simpler to have the same functions on all of them. The functions you mentioned could easily be customized to pull their values from the virtual server's parameters/<servername>.tcl, the database, some site templates, or just to use a bunch of if statements. In fact, they probably should do that anyway since they are really part of the front end face to the public and not really a backend function like the rest of the functions.

For me it beats updating a bunch of sites with the exact same information and risking overwriting a function that I customized without thinking about it in addition to being great for a bunch of small sites that I would still like to have all the OpenACS features without the overhead of a separate environment for each of them.

Collapse
Posted by Ola Hansson on
David,

I believe you can achieve what you're thinking of in OpenACS 4 by using the "subsites" feature. If I understand things correctly you can create as many subsites as you like and mount them under suitable urls beneith your domain, each having their own instance of the config params, master template etc...

I tried to follow the "skin" demo in the docs that demonstrates this, but it crashed at some point. Try it out soon when OpenACS 4 has come further along...(OpenACS 4 is already looking *very* interesting though😉)

Collapse
Posted by David Walker on
That is what I was hoping. Do you know if it supports subsites with their own domain names as well as a shared name?
i.e. http://www.vorteon.com/grax/ and http://www.grax.com/ serve the same info?
Collapse
12: Domain Based Subsites (response to 1)
Posted by Ryan Campbell on
Read the authoritative thread on using the subsite module to do multiple domain hosting in ACS 4. Basically, you create a table of hostnames and site-nodes. When a request comes in, you lookup the hostname from the request to figure out which node is root for that host. I've done a prototype and it works quite well. Viola, ASP'ized ACS.
Collapse
Posted by David Walker on
Thanks.  That is exactly what I am interested in and similar to what I've done with OpenACS 3.2.5 except I've only done the domain based part so far and not the subsite/url based part.