tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikolaj Rydzewski <mikol...@becomo.com>
Subject Re: Deploying new virtual hosts
Date Fri, 02 Dec 2005 11:50:54 GMT
George Sexton wrote:

>I'm trying to sort out a way I can automate deploying new virtual hosts on
>my Tomcat server. Right now I'm running about 70 virtual hosts. Each virtual
>host has only one ROOT context. I'm planning on scaling up to at least 200
>virtual hosts before I need to get a second machine. The second machine will
>probably be more powerful, and I'll want to scale it into the region of
>something like 1000 virtual hosts. I've looked through the documentation on
>the Tomcat site and don't think I'm seeing what I need.
>
>Ideally I would like something that would be scriptable that would let me
>automatically deploy the virtual hosts. If I can't get that, some
>application that would let me create a new virtual host without stopping and
>re-starting tomcat would be nice. I'm thinking in the near future I will
>need to deploy several new virtual hosts per day. If I can't do it
>automatically, I'd at least like one tool that works that could be used to
>create a virtual host correctly.
>  
>
Have you tried embeded tomcat? It's very easy to set up, and add new 
hosts, contexts, etc. on the fly. So it would be possible with very 
little effort to create small app to create/delete any host inside such 
tomcat.

Sample code:

embedded = new Embedded();
embedded.setCatalinaHome(catalinaHome.getAbsolutePath());
Engine engine = embedded.createEngine();
engine.setDefaultHost("localhost");
Host host = embedded.createHost("localhost", appBase.getAbsolutePath());
engine.addChild(host);
Context ctx = embedded.createContext("/ctx, docBase.getAbsolutePath());
host.addChild(ctx);
embedded.addEngine(engine);
Connector connector = embedded.createConnector((InetAddress) null, 8080, 
false);
embedded.addConnector(connector);
embedded.start();


-- 
Mikolaj Rydzewski  <mikolajr@becomo.com>
Becomo S.A.
tel. (12) 2927104



Mime
View raw message