Re: "High Level" question. Managing dynamic vhost deployments...
On 4/27/12 4:27 AM, André Warnier wrote: It seems that you have already most of the parts done, and are just missing the "persistent" part of the entries in server.xml. It would seem like a fairly easy task, with a bit of scripting, to have a template server.xml with some kind of an "include" tag (à la ), and whenever you create a new Host dynamically, adding it to some table, and rewriting the server.xml with the appropriate entries inserted in the template. This way, whenever you restart Tomcat, it would "remember" these Hosts. The script to re-create the server.xml could be inserted in your Tomcat startup mechanism. Yeah, this seems sort of like a double-approach. I'd need to get Tomcat to enable the vhosts, and also have something that would 'dump' that information to server.xml. I think the better approach is what Chuck pointed me to - the host-manager application seems to allow dynamic vhost generation in the running environment, what it needs is a hook to 'regen' the server.xml (or dump the XML for the entries for easy inclusion back into the server.xml). So one last question before I start tearing into host-manager - what I'm guessing it's doing is using JMX calls to tomcat-core (Note, I've done zilcho work with Tomcat internals yet, so sorry if this is way off) and dynamically creating / updating vhosts. If that's the case, it should be pretty easy to modify it to dump the XML, or write a command line tool that does the same thing. Is this sane? :) H. -d - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: "High Level" question. Managing dynamic vhost deployments...
Dave Shevett wrote: Hey folks - I've gotten great help on the list before, I'm looking for some guidance on how to approach this... I have a hosted service that deploys / provisions vhosts running a prepackaged .war app. I'd like to be able to 'spin up' a vhost on the fly, without restarting tomcat. What I'm doing now is: * Create a directory in /etc/tomcat6/Catalina/vhostname/ * Create a ROOT.xml in that dir that has docBase=[sharedwarfilename]...> for the vhost * Edit server.xml to make a new Host entry * Restart tomcat The app goes live (there's an Apache httpd front end with a wildcard on the domain that's using ajp: connections to Tomcat, so foo.domainname.com will look for a vhost of that name on the Tomcat server). This works, but is a pain because it requires a tomcat restart and a manual file edit. What I want to do be able to do is bring up a vhost, maybe via the Tomcat manager, without doing a restart. I can deploy a .war file easy, but the vhost entry wouldn't wake up. My understanding is I can make the vhosts go active via a script or tool that uses JMX calls to Tomcat to configure up the vhost, but my understanding is this configuration is mutable - if Tomcat restarts, all the vhost configurations disappear, and I have to 'reprovision it'. Is it possible to spin up and down vhosts like this without restarting tomcat, and if so, what's the preferred methodology that makes it reproduceable, if the configuration is only in memory, and will disappear if/when tomcat restarts? I read somewhere that there exists an old African proverb which says : if you want to eat an elephant, you have to do it one little piece at a time. It seems that you have already most of the parts done, and are just missing the "persistent" part of the entries in server.xml. It would seem like a fairly easy task, with a bit of scripting, to have a template server.xml with some kind of an "include" tag (à la ), and whenever you create a new Host dynamically, adding it to some table, and rewriting the server.xml with the appropriate entries inserted in the template. This way, whenever you restart Tomcat, it would "remember" these Hosts. The script to re-create the server.xml could be inserted in your Tomcat startup mechanism. Not discounting the other excellent and more elaborate suggestions received on the list, you may want to have a look at such a simple alternative. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: "High Level" question. Managing dynamic vhost deployments...
Dave, I don't know if this will help you, but I've done some work in this area that you may find useful. In my case, I needed a way to create a Tomcat context based on sites that are already configured in Apache. This way, a client could use a control panel to create sites in Apache, and then whenever a request came in for Tomcat, the new context would be created in Tomcat that matched the site in Apache. I did this project for the CFML community, but the process doesn't require CFML in any way. It can be used effectively with anything that needs a dynamic context that will match a site configured in Apache. If you think this might help you, can you check out the project at the following URL: http://www.modcfml.org/ I've been getting a lot of requests to make other aspects dynamic as well, such as custom context configs, aliases, etc. but that would require patching the Host Manager or writing my own classes that interfaced with the same classes that the Host Manager uses. That is a bit intimidating, so I haven't attempted it yet. At any rate, maybe what I've done so far can help you in your efforts. Warm Regards, Jordan Michaels On 04/26/2012 01:37 PM, Caldarale, Charles R wrote: From: Dave Shevett [mailto:shev...@homeport.org] Subject: "High Level" question. Managing dynamic vhost deployments... I'd like to be able to 'spin up' a vhost on the fly, without restarting tomcat. Look at the host-manager (not the manager) webapp that comes bundled with real Tomcat distributions. I would point you to the doc for it ... if it existed. Patches welcome (he says, while ducking under the table). - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: "High Level" question. Managing dynamic vhost deployments...
> From: Dave Shevett [mailto:shev...@homeport.org] > Subject: "High Level" question. Managing dynamic vhost deployments... > I'd like to be able to 'spin up' a vhost on the fly, > without restarting tomcat. Look at the host-manager (not the manager) webapp that comes bundled with real Tomcat distributions. I would point you to the doc for it ... if it existed. Patches welcome (he says, while ducking under the table). - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
"High Level" question. Managing dynamic vhost deployments...
Hey folks - I've gotten great help on the list before, I'm looking for some guidance on how to approach this... I have a hosted service that deploys / provisions vhosts running a prepackaged .war app. I'd like to be able to 'spin up' a vhost on the fly, without restarting tomcat. What I'm doing now is: * Create a directory in /etc/tomcat6/Catalina/vhostname/ * Create a ROOT.xml in that dir that has docBase=[sharedwarfilename]...> for the vhost * Edit server.xml to make a new Host entry * Restart tomcat The app goes live (there's an Apache httpd front end with a wildcard on the domain that's using ajp: connections to Tomcat, so foo.domainname.com will look for a vhost of that name on the Tomcat server). This works, but is a pain because it requires a tomcat restart and a manual file edit. What I want to do be able to do is bring up a vhost, maybe via the Tomcat manager, without doing a restart. I can deploy a .war file easy, but the vhost entry wouldn't wake up. My understanding is I can make the vhosts go active via a script or tool that uses JMX calls to Tomcat to configure up the vhost, but my understanding is this configuration is mutable - if Tomcat restarts, all the vhost configurations disappear, and I have to 'reprovision it'. Is it possible to spin up and down vhosts like this without restarting tomcat, and if so, what's the preferred methodology that makes it reproduceable, if the configuration is only in memory, and will disappear if/when tomcat restarts? Thanks very much! -d - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org