Re: Adding/removing hosts dynamically?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jeffrey, On 1/25/2010 1:28 PM, Jeffrey Janner wrote: > Chuck said: > >> Try the HTML version of host-manager to get familiar with it: >> http://localhost:8080/host-manager/html >> >> Note that the updates made by the HTML and plain text servlets are not > persistent, so will be lost upon Tomcat restart. >You'll need some > additional means to preserve the added hosts. > > Any idea why this is so? > The 4.x version of this feature, while clumsy and slightly buggy, > updated the server.xml file. Let's say you have an XML file and you want to insert some data into it with a program. Where do you insert it? How do you handle whitespace, comments, etc.? It's just something that is a PITA and nobody has wanted to put the effort into doing it. Patches are always welcome. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktd7sYACgkQ9CaO5/Lv0PBApQCfSaLq6nq3DWMmdn+A6OvzgPtm 9asAoJZ+e9LTszv/QdfWzYQlfJkX40c5 =SnAd -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Adding/removing hosts dynamically?
Chuck said: >Try the HTML version of host-manager to get familiar with it: >http://localhost:8080/host-manager/html > >Note that the updates made by the HTML and plain text servlets are not persistent, so will be lost upon Tomcat restart. >You'll need some additional means to preserve the added hosts. Any idea why this is so? The 4.x version of this feature, while clumsy and slightly buggy, updated the server.xml file. Jeff *** NOTICE * This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply or by telephone (call us collect at 512-343-9100) and immediately delete this message and all its attachments. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Adding/removing hosts dynamically?
Thanks Chuck, I was able to find it and play with it a little bit. Pretty self-explanatory once I figured out how to modify the tomcat-users.xml file to get access to it. It's a real bummer that it's not persistent, but it's still a great app. Thanks for your help! -Jordan Caldarale, Charles R wrote: From: Jordan Michaels [mailto:jor...@viviotech.net] Subject: Re: Adding/removing hosts dynamically? I'm extremely interested in this. Any chance anyone who has used this before could provide some direction (example implementation)? Try the HTML version of host-manager to get familiar with it: http://localhost:8080/host-manager/html Note that the updates made by the HTML and plain text servlets are not persistent, so will be lost upon Tomcat restart. You'll need some additional means to preserve the added hosts. From the org/apache/catalina/manager/host/HostManagerServlet.java source code: * Servlet that enables remote management of the virtual hosts installed * on the server. Normally, this functionality will be protected by * a security constraint in the web application deployment descriptor. * However, this requirement can be relaxed during testing. * * This servlet examines the value returned by getPathInfo() * and related query parameters to determine what action is being requested. * The following actions and parameters (starting after the servlet path) * are supported: * * /add?name={host-name}&aliases={host-aliases}&manager={manager} - * Create and add a new virtual host. The host-name attribute * indicates the name of the new host. The host-aliases * attribute is a comma separated list of the host alias names. * The manager attribute is a boolean value indicating if the * webapp manager will be installed in the newly created host (optional, * false by default). * /remove?name={host-name} - Remove a virtual host. * The host-name attribute indicates the name of the host. * * /list - List the virtual hosts installed on the server. * Each host will be listed with the following format * host-name#host-aliases. * /start?name={host-name} - Start the virtual host. * /stop?name={host-name} - Stop the virtual host. * * * NOTE - Attempting to stop or remove the host containing * this servlet itself will not succeed. Therefore, this servlet should * generally be deployed in a separate virtual host. * Seems like the javadocs aren't currently installed on tomcat.apache.org, or I would have directed you there. - 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: Adding/removing hosts dynamically?
> From: Jordan Michaels [mailto:jor...@viviotech.net] > Subject: Re: Adding/removing hosts dynamically? > > I'm extremely interested in this. Any chance anyone who has used this > before could provide some direction (example implementation)? Try the HTML version of host-manager to get familiar with it: http://localhost:8080/host-manager/html Note that the updates made by the HTML and plain text servlets are not persistent, so will be lost upon Tomcat restart. You'll need some additional means to preserve the added hosts. >From the org/apache/catalina/manager/host/HostManagerServlet.java source code: * Servlet that enables remote management of the virtual hosts installed * on the server. Normally, this functionality will be protected by * a security constraint in the web application deployment descriptor. * However, this requirement can be relaxed during testing. * * This servlet examines the value returned by getPathInfo() * and related query parameters to determine what action is being requested. * The following actions and parameters (starting after the servlet path) * are supported: * * /add?name={host-name}&aliases={host-aliases}&manager={manager} - * Create and add a new virtual host. The host-name attribute * indicates the name of the new host. The host-aliases * attribute is a comma separated list of the host alias names. * The manager attribute is a boolean value indicating if the * webapp manager will be installed in the newly created host (optional, * false by default). * /remove?name={host-name} - Remove a virtual host. * The host-name attribute indicates the name of the host. * * /list - List the virtual hosts installed on the server. * Each host will be listed with the following format * host-name#host-aliases. * /start?name={host-name} - Start the virtual host. * /stop?name={host-name} - Stop the virtual host. * * * NOTE - Attempting to stop or remove the host containing * this servlet itself will not succeed. Therefore, this servlet should * generally be deployed in a separate virtual host. * Seems like the javadocs aren't currently installed on tomcat.apache.org, or I would have directed you there. - 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
Re: Adding/removing hosts dynamically?
I'm extremely interested in this. Any chance anyone who has used this before could provide some direction (example implementation)? Bare-bones documentation - if you will? Thank you! -Jordan richard42 wrote: richard42 wrote: ...it appears to add it successfully, but only empty pages are served to the browser for that website. This seems to happen on the live server and my local machine (both Tomcat 6.0). Please ignore this, I have since got it working (needed to add a context). Thanks once more. Cheers, Richard. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Adding/removing hosts dynamically?
richard42 wrote: > > ...it appears to add it successfully, but only empty pages are served to > the browser for that website. This seems to happen on the live server and > my local machine (both Tomcat 6.0). > Please ignore this, I have since got it working (needed to add a context). Thanks once more. Cheers, Richard. -- View this message in context: http://old.nabble.com/Adding-removing-hosts-dynamically--tp27261390p27266468.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Adding/removing hosts dynamically?
Thank you for the advice! I have tried the host manager app as well as a class that I have just written which implements ContainerServlet. Unfortunately, I find that when I create a new host (by adding a StandardHost to the Engine), it appears to add it successfully, but only empty pages are served to the browser for that website. This seems to happen on the live server and my local machine (both Tomcat 6.0). Does anybody have any suggestions as to why this might be occurring please? Many thanks, Richard. Filip Hanik - Dev Lists wrote: > > answer is yes, it is possible. Others have done it successfully. > If you want a place to start, take a look at host manager servlet > http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java?view=annotate > > Note, this doesn't imply that you have to do it over HTTP, implement it > any way you want to fit your environment -- View this message in context: http://old.nabble.com/Adding-removing-hosts-dynamically--tp27261390p27266255.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Adding/removing hosts dynamically?
answer is yes, it is possible. Others have done it successfully. If you want a place to start, take a look at host manager servlet http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java?view=annotate Note, this doesn't imply that you have to do it over HTTP, implement it any way you want to fit your environment best Filip On 01/21/2010 10:24 AM, richard42 wrote: Dear Forum, Is it possible to dynamically add/remove hosts through code without restarting Tomcat (6.0)? I am writing an application that creates new websites on the fly (eg. website1.mydomain.com, website2.mydomain.com etc). Each of these websites will exist in a separate directory on the server - this is so they may be upgraded independently in the future. 1. I have considered programatically editing server.xml, but have ruled this out since it would require restarting Tomcat afterwards (and hence downtime of existing sites). 2. I have also considered running multiple instances of Tomcat, but each instance would have to use a different TCP port. In the absence of any additional software, this would mean I would need lots of external IPs. 3. I have looked at the 'tomcat-manager' app (and considered interfacing with it via HTTP) but the start function does not seem to work and from what I have read, this app is no longer supported? Would anybody be able to advise me on the best approach please? I have not ruled out any of the above options completely if they can be implemented reliably and without restarting the server. Thank you in advance! Richard. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Adding/removing hosts dynamically?
> From: richard42 [mailto:tom...@webcogs.com] > Subject: Adding/removing hosts dynamically? > > Is it possible to dynamically add/remove hosts through code without > restarting Tomcat (6.0)? Yes - use the supplied host-manager webapp. It's mostly undocumented, so you'll need to poke around in it a bit; it does seem to do what you need. - 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
Adding/removing hosts dynamically?
Dear Forum, Is it possible to dynamically add/remove hosts through code without restarting Tomcat (6.0)? I am writing an application that creates new websites on the fly (eg. website1.mydomain.com, website2.mydomain.com etc). Each of these websites will exist in a separate directory on the server - this is so they may be upgraded independently in the future. 1. I have considered programatically editing server.xml, but have ruled this out since it would require restarting Tomcat afterwards (and hence downtime of existing sites). 2. I have also considered running multiple instances of Tomcat, but each instance would have to use a different TCP port. In the absence of any additional software, this would mean I would need lots of external IPs. 3. I have looked at the 'tomcat-manager' app (and considered interfacing with it via HTTP) but the start function does not seem to work and from what I have read, this app is no longer supported? Would anybody be able to advise me on the best approach please? I have not ruled out any of the above options completely if they can be implemented reliably and without restarting the server. Thank you in advance! Richard. -- View this message in context: http://old.nabble.com/Adding-removing-hosts-dynamically--tp27261390p27261390.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org