You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Borut Bolčina <bo...@gmail.com> on 2010/09/15 20:28:40 UTC

Deploying several T5 apps in one servlet container

Hi,

I was wondering what is the recipe to deploy several T5 web apps under
*one*Jetty or Tomcat instance. Each of the web apps have their on
context name
(app1, app2, app3). There must be apache http server or nginx in front of
them. Each web app must be accessible by some specific domain name url.

For example: app1 must be accessible at http://a1.acme.com, app2 for example
at http://acme.com/a2

How do I achieve this with most elegance? Can someone explain this in more
detail as there seem to be no information on this subject. I have no
experience in Apache or Nginx http servers and haven't yet used Tapestry URL
rewriting support. Do I have to abandon using context: binding in my web
apps?

-Borut

Re: Deploying several T5 apps in one servlet container

Posted by Peter Stavrinides <P....@albourne.com>.
Hi Borut,

Determine and prioritize exactly what you want, and then go from there:

- Do you need a CDN? i.e.: do you stream video / have lots of static content on a high traffic site?
- Tomcat is not as fast as Apache serving static content, Apache may not be the fastest but its fast enough for most sites 
- Apache in front of Tomcat isn't as fast as Tomcat with Native IO, and you cannot use Native IO with a reverse proxy
- Do you require Asynchronous request processing (for instance if you wish to use Comet), then also forget about Apache in front of Tomcat, that won't work, Jetty is one of the better solutions in this case.
- Apache is very mature, and very stable (imho nothing is as rock solid)
- For SSL Apache is great, and really easy to configure ...almost all web servers do SSL.
- For many security is not always a priority when choosing a technology... but can be the highest priority for others like me, which limits choices to a select few products (i.e.: Those with consistent testing and security patching)
- Web service support out the box?
- EJB support (forget Tomcat in this case), Glassfish or JBoss come to mind

To be perfectly honest, a few years ago I would have recommend Apache with the mod_ajp connector to Tomcat, but today I might defect to Glassfish (Tomcat is its servlet container) as you get to avoid the reverse proxy, and have Comet and EJB in the mix.

Cheers, 
Peter





----- Original Message -----
From: "Thiago H. de Paula Figueiredo" <th...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, 16 September, 2010 00:19:44 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: Deploying several T5 apps in one servlet container

On Wed, 15 Sep 2010 17:47:50 -0300, Borut Bolčina  
<bo...@gmail.com> wrote:

> So, to handle resources like javascript, css and images I would create a  
> cdn binding which would be configurable to accept from which host to get  
> these resources.

That's what I do.

> When doing this, I would loose asset versioning wouldn't I?

Yes, but I guess it wouldn't be hard to add them yourself.

> What about gzip and cache header settings?

These are provided or not by the CDN, as it would be the one serving  
assets, not Tapestry. This is completely outside your application. The  
binding would just generate the links to them.

> What about page and action links, actually all links generated by  
> tapestry?

Page and event URLs are not resources, so they're not handled by the  
Tapestry asset services, so nothing would change here.

> Is this at all important?

You don't need to worry about page and events URLs at all.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Deploying several T5 apps in one servlet container

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 15 Sep 2010 17:47:50 -0300, Borut Bolčina  
<bo...@gmail.com> wrote:

> So, to handle resources like javascript, css and images I would create a  
> cdn binding which would be configurable to accept from which host to get  
> these resources.

That's what I do.

> When doing this, I would loose asset versioning wouldn't I?

Yes, but I guess it wouldn't be hard to add them yourself.

> What about gzip and cache header settings?

These are provided or not by the CDN, as it would be the one serving  
assets, not Tapestry. This is completely outside your application. The  
binding would just generate the links to them.

> What about page and action links, actually all links generated by  
> tapestry?

Page and event URLs are not resources, so they're not handled by the  
Tapestry asset services, so nothing would change here.

> Is this at all important?

You don't need to worry about page and events URLs at all.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Deploying several T5 apps in one servlet container

Posted by Borut Bolčina <bo...@gmail.com>.
So, to handle resources like javascript, css and images I would create a cdn
binding which would be configurable to accept from which host to get these
resources.

When doing this, I would loose asset versioning wouldn't I? What about gzip
and cache header settings?

What about page and action links, actually all links generated by tapestry?
Is this at all important?

-Borut

2010/9/15 Thiago H. de Paula Figueiredo <th...@gmail.com>

> On Wed, 15 Sep 2010 17:05:55 -0300, Borut Bolčina <bo...@gmail.com>
> wrote:
>
>  Yes, almost all web apps we deploy need clustering, load balancing,
>> failover and CDN. I am looking for "best architecture" and practices with
>> real world T5 apps with high traffic. Also, company policy may "dictate" use
>> of http
>> server.
>>
>
> To facilitate things, I would create a binding (or AssetHandler, couldn't
> try Tapestry 5.2 yet) to deal with a CDN and isolate this from the app
> itself.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Deploying several T5 apps in one servlet container

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 15 Sep 2010 17:05:55 -0300, Borut Bolčina  
<bo...@gmail.com> wrote:

> Yes, almost all web apps we deploy need clustering, load balancing,  
> failover and CDN. I am looking for "best architecture" and practices  
> with real world T5 apps with high traffic. Also, company policy may  
> "dictate" use of http
> server.

To facilitate things, I would create a binding (or AssetHandler, couldn't  
try Tapestry 5.2 yet) to deal with a CDN and isolate this from the app  
itself.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Deploying several T5 apps in one servlet container

Posted by Borut Bolčina <bo...@gmail.com>.
Yes, almost all web apps we deploy need clustering, load balancing, failover
and CDN. I am looking for "best architecture" and practices with real world
T5 apps with high traffic. Also, company policy may "dictate" use of http
server.

-Borut

2010/9/15 Kalle Korhonen <ka...@gmail.com>

> On Wed, Sep 15, 2010 at 12:18 PM, Thiago H. de Paula Figueiredo
> <th...@gmail.com> wrote:
> > On Wed, 15 Sep 2010 16:11:32 -0300, Borut Bolčina <
> borut.bolcina@gmail.com>
> > wrote:
> >> I would also like http server to serve static content.
> > Tapestry adds caching HTTP headers and versioning to your static content,
> so
> > I really don't know why Apache would do a significant difference here.
>
> One size doesn't fit all. If you build for speed & scalability, it may
> justify using a different system to serve static files. This is
> especially true if you a have a big number of large files to serve.
> The conventional wisdom is that httpd is roughly on par with
> Tomcat/Jetty serving static content and none are especially good in it
> (not that these guys are final authorities on it but..), see for
> example:
> http://rocketscience.itteco.org/2010/01/03/efficient-serving-static-files-via-http/
> or http://marakana.com/forums/tomcat/general/7.html.
>
> Kalle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Deploying several T5 apps in one servlet container

Posted by Kalle Korhonen <ka...@gmail.com>.
On Wed, Sep 15, 2010 at 12:18 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Wed, 15 Sep 2010 16:11:32 -0300, Borut Bolčina <bo...@gmail.com>
> wrote:
>> I would also like http server to serve static content.
> Tapestry adds caching HTTP headers and versioning to your static content, so
> I really don't know why Apache would do a significant difference here.

One size doesn't fit all. If you build for speed & scalability, it may
justify using a different system to serve static files. This is
especially true if you a have a big number of large files to serve.
The conventional wisdom is that httpd is roughly on par with
Tomcat/Jetty serving static content and none are especially good in it
(not that these guys are final authorities on it but..), see for
example: http://rocketscience.itteco.org/2010/01/03/efficient-serving-static-files-via-http/
or http://marakana.com/forums/tomcat/general/7.html.

Kalle

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Deploying several T5 apps in one servlet container

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 15 Sep 2010 16:11:32 -0300, Borut Bolčina  
<bo...@gmail.com> wrote:

> Hi, Thiago.

Hi!

> What is not correct? You do not have http server in front?

I'm using Jetty by itself, without Apache or anything else between the  
Internet and my application..

> I would also like http server to serve static content.

Tapestry adds caching HTTP headers and versioning to your static content,  
so I really don't know why Apache would do a significant difference here.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Deploying several T5 apps in one servlet container

Posted by Borut Bolčina <bo...@gmail.com>.
Hi, Thiago.

What is not correct? You do not have http server in front?

I would also like http server to serve static content. What are the pros and
cons with that? Asset versioning?

-Borut


2010/9/15 Thiago H. de Paula Figueiredo <th...@gmail.com>

> On Wed, 15 Sep 2010 15:28:40 -0300, Borut Bolčina <bo...@gmail.com>
> wrote:
>
>  Hi,
>>
>
> Hi!
>
>  I was wondering what is the recipe to deploy several T5 web apps under
>> *one*Jetty or Tomcat instance. Each of the web apps have their on
>> context name (app1, app2, app3). There must be apache http server or nginx
>> in front of
>> them.
>>
>
> This is not correct. I have a single Jetty instance handling both
> arsmachina.com.br, pronutricionista.com.br and cristilenesalomao.com.br(which is rewritten to
> cristilenesalomao.pronutricionista.com.br and the rewritten again
> depending on the page). and their subdomains. Kalle showed the Tomcat
> documentation for virtual domains. Here's the Jetty one:
> http://docs.codehaus.org/display/JETTY/Virtual+hosts. Very easy.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Deploying several T5 apps in one servlet container

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 15 Sep 2010 15:28:40 -0300, Borut Bolčina  
<bo...@gmail.com> wrote:

> Hi,

Hi!

> I was wondering what is the recipe to deploy several T5 web apps under
> *one*Jetty or Tomcat instance. Each of the web apps have their on
> context name (app1, app2, app3). There must be apache http server or  
> nginx in front of
> them.

This is not correct. I have a single Jetty instance handling both  
arsmachina.com.br, pronutricionista.com.br and cristilenesalomao.com.br  
(which is rewritten to cristilenesalomao.pronutricionista.com.br and the  
rewritten again depending on the page). and their subdomains. Kalle showed  
the Tomcat documentation for virtual domains. Here's the Jetty one:  
http://docs.codehaus.org/display/JETTY/Virtual+hosts. Very easy.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Deploying several T5 apps in one servlet container

Posted by Kalle Korhonen <ka...@gmail.com>.
Httpd, Tomcat and Jetty all have excellent documentation. Since search
is typically lacking or sub-par, the trick as always is to find the
right place.

For pure tomcat solution:
      <Host name="maindomain.com"  appBase="webapps/maindomain"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
        <Alias>sub1.maindomain.com</Alias>
        <Alias>othername.net</Alias>

For httpd/ajp (similar for other protocols):
<VirtualHost *>
ServerName sub1.maindomain.com
ProxyPass / ajp://localhost:8009/sub1
</VirtualHost>

Kalle


On Wed, Sep 15, 2010 at 11:28 AM, Borut Bolčina <bo...@gmail.com> wrote:
> Hi,
>
> I was wondering what is the recipe to deploy several T5 web apps under
> *one*Jetty or Tomcat instance. Each of the web apps have their on
> context name
> (app1, app2, app3). There must be apache http server or nginx in front of
> them. Each web app must be accessible by some specific domain name url.
>
> For example: app1 must be accessible at http://a1.acme.com, app2 for example
> at http://acme.com/a2
>
> How do I achieve this with most elegance? Can someone explain this in more
> detail as there seem to be no information on this subject. I have no
> experience in Apache or Nginx http servers and haven't yet used Tapestry URL
> rewriting support. Do I have to abandon using context: binding in my web
> apps?
>
> -Borut
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org