On Sun, Apr 27, 2008 at 4:04 AM, Claes Wikstrom <klacke@...> wrote:
> Anders Nygren wrote:
> > If yaws is started in embedded mode and a yaws process terminates
> > all the processes are restarted, since yaws_sup is one_for_all.
> > This means that it is necessary to reinitialize yaws from my application
> > by calling yaws:start_embedded or yaws_api:setconf.
> > What is the recommended way of doing this?
> The idea is that yaws is just an OTP application and you
> must add yaws to your set of supervised apps - similar
> to all the other applications in your system
I think You missed the point of my question.
I have an app my_app that depends on yaws, so the boot script starts
yaws in embedded mode before starting my_app.
1, during system startup yaws is started in embedded mode. So it is
not listening to any ports and no virtual servers are running
2, since my_app depends on yaws it is started after yaws
3, my_app reads its configuration data, creates the yaws config data and calls
4, when start_embedded is called yaws starts the listener(s) and virtual hosts
(yaws_server calls yaws_server:gserv)
At this point everything is working as it should
But when a yaws process terminates
5, All yaws processes are restarted by yaws_sup, this means that the gserv
processes are terminated and not restarted
6, It is necessary for my_app to call yaws:start_embedded again, but
my_app has no
way of knowing that yaws has restarted.
Even if I have yaws as an included application in my_app and I start
my_app_sup, I have no way of knowing that yaws has restarted, without adding
a link or monitor from one of my processes to one of the yaws processes.
So I think that maybe the gserv processes should also be in the supervisor tree.
Instead of just linked to from yaws_server.
However that would still not completely solve my problem. Another issue is with
yaws_soap_srv. It is not possible to feed the WSDLs to yaws_soap_srv during
startup. It has to be done by calling yaws_soap_srv:setup. So even though
yaws_soap_srv is restarted by yaws_sup when yaws process terminates, I have
to detect the restart, (and again there is no clean way of doing that), and call
I think we should add a yaws_soap_srv:start_link/1 that makes it possible to
add a list of wsdls in the startup. And a field in gconf or sconf for
this. I think
it should be in sconf, since different virtual hosts can have different WSDLs
If this sounds like a good idea I can make the changes for yaws_soap_srv
but I do not dare to touch the gserv part yet.