Yes. In yaws.conf the yapp module will be install as an arg_rewrite module in the root (/) path. It will change the docroot for Yaws for every request that has a path that matches a registered yapp. The docroot for the request will be path_of_your_app/priv/docroot.
The yapp handler will also install its O&M part in the path /yapp. If you check the source code for the yapp application you will see that it contains .yaws files in it priiv/docroot directory - so it will be installed by "itself"  so to speak.

It is strange  that the yapp handler application shuts down immediately once you started it. Did you prepare your mnesia database with mnesia:create_schema/1 ?
And are you starting Yaws from the same directory as you created mnesia (or using the -mnesia option) and are you using the same node name as when you created the schema - check the "Executing" section in "Yaws applications" documentation.
Best Regards
Mikael

2009/6/22 Praveen Ray <praveen.ray@yellowfish.biz>
Thanks for all your replies. This is definitely beginning to make sense.
So, yapp is just another OTP app that (I think) installs itself as handler for the path '/' and then dispatches to other OTP Apps which are configured in it's own mnesia table. I hope this is correct?
I'm trying to bootstrap yapp as documented on the website. Built the yapp and copied it to yaws/lib. Here are lines from my yaws.conf:
ebin_dir = /home/praveen/erlang-projects/yaws/lib/yapp/ebin
runmod = yapp
<server erlang-server>
  port = 8000
  listen = 0.0.0.0
  docroot = /home/praveen/erlang-projects/webapps/webapp-1.0/priv
 
  arg_rewrite_mod = yapp
  <opaque>
     yapp_server_id = auniqueid
     bootstrap_yapps = yapp
  </opaque>
</server>
Then, I start yaws as 'bin/yaws -i' which tries to start yapp but fails:
=INFO REPORT==== 22-Jun-2009::13:02:40 ===
Yapp starting but Yaws not ready - waiting 500 ms
=INFO REPORT==== 22-Jun-2009::13:02:41 ===
Starting yapp

=INFO REPORT==== 22-Jun-2009::13:02:41 ===
  application: yapp
  exited: {shutdown,{yapp_app,start,[normal,[]]}}
  type: temporary

Any ideas on how to get it going? Looks like mnesia is already started:
2>application:which_applications().
[{mnesia,"MNESIA CXC 138 12","4.4.7"},
 {yaws,"yaws WWW server","1.82"},
 {crypto,"CRYPTO version 1","1.5.3"},
 {stdlib,"ERTS CXC 138 10","1.15.5"},
 {kernel,"ERTS CXC 138 10","2.12.5"}]


Thanks again.
On Mon, Jun 22, 2009 at 8:35 AM, Mikael Karlsson <karlsson.rm@gmail.com> wrote:
Hi,
 
if you have a yaws worker process handling a http request that crashes I think Yaws will respond will some http error code. It doesn't matter if you use appmod or yapps. The point Steve makes (i think) is that you can have independent application backends that works like services for your web applications and that the backend may have supervised processes, although they do not need to.
Consider a Yapp as an erlang OTP application bundled with web resources (.html .yaws files) and some support to hook it into a URL path. The closest parallell you get from the Java world, if come from that side, is a "servlet".
The thing with Yapps is that you can administrate and deploy web applications independently of each other - you do not need to update the yaws.conf (as with appmods) to add or remove applications to a running server, instead you update a "registry" that by default is implemented with mnesia. The precondition is that your Erlang OTP application that makes up the Yapp is in the load path of the Erlang VM and have the yapp handler application called yapp (a bit confusing I know...) started. Once this is set you can add your application to the registry of the running Yaws server using the "Web GUI" at http://lyourhost:port/yapp .
 
Mikael