On Fri, Sep 13, 2013 at 12:02 AM, akonsu <akonsu@gmail.com> wrote:
Hello,

I have a yapp that I wrote (which so far does nothing, I am only learning), and I need to start only one and no more instances of my yapp for all my yaws instances (I am planning to have yaws behind a load balancer).

I do not know how to do it. So far I have in my yaws.config:

    runmod = my_yapp

    <server localhost>
        port = 8000
        listen = 0.0.0.0
        docroot = /home/akonsu/my_app
        appmods = </, my_appmod>
    </server>

as far as I understand runmod starts my module on the server startup, but I have multiple servers, I do not need that. Does this mean I have to start my app manually, I mean by an external means?

It's not really going to work -- Yaws makes local calls into the yapp, so it must be co-located with Yaws itself.

I'm guessing you were planning for your yapp to be your Twitter client -- if so, I recommend just writing it as a regular Erlang application and running it in its own OS process, and writing an appmod for Yaws that connects to it via Distributed Erlang. The appmod could just send its pid to register itself with the Twitter client, and when the Twitter client got data from Twitter, it could just use that pid along with normal Erlang messaging to send that data to all registered Yaws processes, which in turn would send the data out to their HTTP clients.

--steve