YawsPack for ejabberd: Embedded Web Server with Web-based Applications

YawsPack is a compilation of software that complements ejabberd Jabber server with web-based applications. Currently YawsPack includes:

  • Yaws: web server written in Erlang designed to serve high loads.
  • mod_yaws.erl: ejabberd module that embeds Yaws into ejabberd.
  • JWChat: web-based Jabber client. No need to install anything on the client computer (though, you might like to install a better web browser ;-) ).
  • MUCkl: Chatroom client based on JWChat. No need to create a Jabber account to join the defined chatrooms.
  • Jabberworld.org Webchat: Jabber client in PHP.
  • Jeti: Jabber client in Java. The client machine must have Java installed.
  • EyeOS: Operating System over the web.
  • Wiki: Simple wiki included in the original Yaws package.
  • Chat: Simple chat system included in the original Yaws package.
  • JRU-PHP: Jabber Roster Utility in PHP. Does not work currently
  • Real-time wiki: Does not work currently

Included Versions

Requirements

  • Erlang R12B-3 or higher
  • ejabberd 2.0.0 or newer, either compiled from source code or using an installer
  • PHP CGI is required for Jabberworld, EyeOS and JRU-PHP, but it does not seem to work on Windows.
  • Tested on Windows, and GNU/Linux.

License

Verify the individual license of each software included in this package before using the corresponding software. All of them are Free and Open Source, including GPL and Creative Commons.

Downloads

  • YawsPack-0.3.2.tar.bz2 - 3.7 MB - 12 July 2009 - Recompiled Yaws and mod_yaws with Erlang/OTP R12B-3. Requires ejabberd 2.0.0 or higher.
  • YawsPack-0.3.1.tar.bz2 - 3.7 MB - 20 October 2007 - Included old http-bind from Bugzilla + httpd_util:to_lower/1 fix
  • YawsPack-0.3.tar.bz2 - 3.7 MB - 6 October 2006 - Added Real-time wiki, updated Yaws, Jabberworld, EyeOS and JRU-PHP
  • YawsPack-0.2.tar.bz2 - 3.4 MB - 29 August 2006 - Added HTTP Binding support, added Jabberworld.org Webchat, updated JWChat to CVS
  • YawsPack-0.1.tar.bz2 - 3.4 MB - 1 August 2006 (first version)

Quickguide

This is a small guide for installing a prepackaged YawsPack on Windows, Linux, and so forth. For a full reference, and details, please check the tutorial Build YawsPack.

  1. Download the latest YawsPack.
  2. Uncompress it.
  3. Copy the provided 'ejabberd' directory to where ejabberd is installed on your system. The 'include' directory is only required for Wiki and Chat, so it is not strictly required.

    • On Windows:

      C:/Program Files/Ejabberd/
    • On Debian:

      /usr/lib/erlang/lib/ejabberd-2.0.5/
    • On the ejabberd Linux installer:

      /home/username/ejabberd-2.0.5/lib/ejabberd-2.0.5/
  4. Copy the provided 'www' directory to any place of your choice. For example, on Windows you can copy it to C:/Program Files/Ejabberd/www
  5. Edit ejabberd.cfg and enable the new module. Example config:

      {mod_yaws,     [
                      {logdir, "/tmp/"},
                      {servers, [
                        {"localhost", 5224, "/home/test/www", [
                          {dir_listing, true},
                          {ip, {127, 0, 0, 1}}
                        ]}
                      ]}
      ]},

    Modify /home/test/www to indicate the location of the directory where you copied 'www'.

  6. If you want to enable HTTP-BIND, which is recommended over HTTP-POLL, edit ejabberd.cfg and set a listen section like this:

    {listen, [
      ...
      {5280, ejabberd_http,    [http_poll, http_bind, web_admin]},
      ...
    ]}.
  7. Start ejabberd. Now you can point your browser to http://localhost:5224/
  8. If you plan to use JWChat, edit its config.js in which you have to set your server name.
  9. If you plan to use MUCkl, edit its config.js in which you have to set your server name. MUCkl also requires you to create a special Jabber account and set an option in ejabberd.cfg. Refer to the full tutorial for more information.
  10. If you plan to use Jabberworld.org Webchat, edit its index.html and set in jabberServer the Jabber server name. Also edit its proxy.php and set in $url the correct URL for your HTTP-bind component.
  11. If you plan to use Real-time Wiki, edit its file script/config.js and set your server name and set the correct HTTP-BIND URL.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Service Unavailable

When i try to connect jwchat using http-bind i get 'service unavailable' error. Where as http-poll works fine.
Even http://servername.com:5280/http-bind works. I get "Ejabberd mod_http_bind v1.0"

Is there something that I am missing while installing Yaws pack??

Strange, it should work

You could check ejabberd log files, maybe they provide meaningful information to know what is wrong.

If jwchat+yaws+httppoll works, and httpbind seem to work correctly, then jwchat+yaws+httpbind should work too. It's strange. Maybe the problem is on Yaws configuration, but that is done automatically, so you don't need to touch it.

If you try don't find any solution, join ejabberd chatroom and idle there until we met, and we'll try to find the problem.

Can't load the module

Hie badlop,

I'm using ejabberd-1.1.3_1-windows-installer.exe and then I used YawsPack-0.3.tar.bz2 and copied all the beam file to the bin directory.

Now I can run JWChat using http_poll but when I try to connect using http_bind I get an internal server error message.

I checked the ejabberd log file.Here I got two Error logs:

1.=ERROR REPORT==== 2007-10-20 16:46:12 ===
   Cannot open /tmp/auth.log
2.=ERROR REPORT==== 2007-10-20 16:50:27 ===
** State machine <0.326.0> terminating 
** Last message in was {'$gen_sync_all_state_event',
                           {<0.330.0>,#Ref<0.0.0.4691>},
                           {http_put,542393,
                                     "88bd22caf3c358458bfc940695e5f8b42da176c6",
                                     [],
                                     1,
                                     [[60,
                                       "iq",
                                       [[32,"type",61,39,"get",39],
                                        [32,"id",61,39,"auth1",39]],
                                       62,
                                       [[60,
                                         "query",
                                         [[32,
                                           "xmlns",
                                           61,
                                           39,
                                           "jabber:iq:auth",
                                           39]],
                                         62,
                                         [[60,
                                           "username",
                                           [],
                                           62,
                                           ["ranjan"],
                                           60,
                                           47,
                                           "username",
                                           62]],
                                         60,
                                         47,
                                         "query",
                                         62]],
                                       60,
                                       47,
                                       "iq",
                                       62]]}}
** When State == loop
**      Data  == {state,"56a991ae3634a768704fc8e62a3fbe9c705329a2",
                        542392,
                        "8f38b436055cf6f48b9dee8a9196da68de5d1e1a",
                        [],
                        [],
                        {<0.328.0>,#Ref<0.0.0.4682>},
                        <0.328.0>,
                        undefined,
                        877426983000,
                        #Ref<0.0.0.4685>,
                        [{hbr,542392,
                              "8f38b436055cf6f48b9dee8a9196da68de5d1e1a",
                              [],
                              [[],
                               60,
                               ...,
                               ...,
                               100,
                               61,
                               39,
                               "2503385356",
                               39,
                               ...,
                               ...,
                               39,
                               "localhost",
                               39,
                               [],
                               " xml:lang='en'",
                               62]}]}
** Reason for termination = 
** {'module could not be loaded',[{httpd_util,
                                      to_lower,
                                      ["8F38B436055CF6F48B9DEE8A9196DA68DE5D1E1A"]},
                                  {ejabberd_http_bind,handle_sync_event,4},
                                  {gen_fsm,handle_msg,7},
                                  {proc_lib,init_p,5}]}

Can u tell what I'm actually missing here ?!

Try YawsPack 0.3.1

Arif wrote:
Cannot open /tmp/auth.log

I guess this isn't a big problem. I wouln't worry about it.

Arif wrote:
** Reason for termination = 
** {'module could not be loaded',[{httpd_util,
                                      to_lower,
                                      ["8F38B436055CF6F48B9DEE8A9196DA68DE5D1E1A"]},
                                  {ejabberd_http_bind,handle_sync_event,4},
                                  {gen_fsm,handle_msg,7},
                                  {proc_lib,init_p,5}]}

It seems newer versions of Erlang/OTP do not include the function httpd_util:to_lower/1, and also probably the ejabberd Windows installer does not even include the module httpd_util.

I've modified the source code of http-bind to not use that function. Try the new YawsPack 0.3.1, that is the only change. Note that I didn't have time to try it.

how i can bind my yaws to 80

how i can bind my yaws to 80 port instead of 5224 port?

mod_yaws and http_bind

Thank you for the Yaws Pack and the clear instructions on installing it. It has saved me a lot of time getting Yaws and HTTP Binding to work. I am using it with ejabberd 1.1.2 and Erlang R11B from the Fedora Extras 4 repository. I have a few comments.

(1) Extra instruction
At first Yaws would not listen (on port 5224); the first error in the ejabberd logs was:

=ERROR REPORT==== 2006-10-29 10:36:43 ===
Failed to list "/var/lib/ejabberd/.yaws/yaws/undefined" probably due to permission errs: enoent

After creating the directory /var/lib/ejabberd/.yaws/yaws/undefined and restarting ejabberd, Yaws operates as expected.

(2) TCP connections not closed
After editing www/jwchat/config.js to set my server name in the BACKENDS, JWChat served by Yaws worked perfectly. However, using netstat I could see that with one JWChat client using HTTP-Binding, I had 12 TCP connections established from ejabberd to itself on port 5280 (each connection occurs twice in netstat's output). Most of these connections should be closed - when I use Apache as the proxy server to ejabberd with HTTP-Binding, only two connections to port 5280 remain open at any time.

(3) Feature request
It would be convenient to use mod_yaws through ejabberd_http, so it uses the port 5280 listener but serves only certain web directories - in the same way as http_poll, http_bind, and web_admin, or as the default when the directory does not belong to one of these modules. In this way, it would be possible to serve JWChat with no need to proxy the http polling and binding requests.

prob on windows

My Ejabberd log says :

=ERROR REPORT==== 2007-10-10 10:11:57 ===
E(<0.35.0>:gen_mod:47): {undef,[{mod_yaws,
start,
["localhost",
[{logdir,"/tmp/"},
{servers,
[{"localhost",
5224,
"D:/INSTALLED/ejabberd-1.1.3/www",
[{dir_listing,true},
{ip,{127,0,0,1}}]}]}]]},
{gen_mod,start_module,3},
{lists,foreach,2},
{ejabberd_app,start,2},
{application_master,start_it_old,4}]}

Can u please tell me what could be possible reason ?

prob on windows

Didn't work for me too... found:
in ejabberd-2.0.5 ebins where moved to something like: C:\Program Files\ejabberd-2.0.5\lib\ejabberd-2.0.5\ebin.
includes also.

After moving ebin and includes contents to cerresponding folders got the result:
}

=ERROR REPORT==== 2009-07-09 12:02:31 ===
beam/beam_load.c(1730): Error loading function yaws_log:handle_call/3: op int_band f x i x:
please re-compile this module with an R12B compiler

=ERROR REPORT==== 2009-07-09 12:02:31 ===
Loading of c:/Program Files/ejabberd-2.0.5/bin/../lib/ejabberd-2.0.5/ebin/yaws_log.beam failed: badfile

=INFO REPORT==== 2009-07-09 12:02:31 ===
application: yaws
exited: {shutdown,{yaws_app,start,[normal,[]]}}
type: temporary

=ERROR REPORT==== 2009-07-09 12:02:31 ===
beam/beam_load.c(1679): Error loading function yaws_config:validate_group/1: op too_old_compiler:
please re-compile this module with an R12B compiler

=ERROR REPORT==== 2009-07-09 12:02:31 ===
Loading of c:/Program Files/ejabberd-2.0.5/bin/../lib/ejabberd-2.0.5/ebin/yaws_config.beam failed: badfile

=ERROR REPORT==== 2009-07-09 12:02:31 ===
E(<0.526.0>:gen_mod:73) : {undef,
[{yaws_config,make_default_gconf,
[false,undefined]},
{mod_yaws,start,2},
{gen_mod,start_module,3},
{rpc,local_call,3},
{ejabberd_web_admin,node_modules_parse_query,4},
{ejabberd_web_admin,get_node,5},
{ejabberd_web_admin,process_admin,2},
{ejabberd_http,process_request,1}]

so that's old erlang compiler used...
I'm not sure i can recompile package by myself. can anyone here make a "newer" version?

Thanks.

> can anyone here make a

> can anyone here make a "newer" version?

I've updated YawsPack. Only change is: compiled with R12B, and updated Yaws to recent version.

It now should work with the ejabberd 2.0.5 installers, but I didn't try it.

How to configure Yaws logging

I've setup the YawsPack with JWChat support, but the amount of logging is killing me... Is there any way to make Yaws only log ERROR messages (and not INFO), and to only log to the report.log file and not both the report.log and ejabberd.log file?

I'm running a server on a shared hosting provider and the log growth is causing me great pain. I can't provide JWChat to my users if every http-poll event causes a log entry, much less if it causes an entry in multiple files.

I'm an Erlang/Ejabberd/Yaws novice. I've tried looking through documentation but I can't figure out how to control the ERROR/INFO level or even how to turn off logging completely. (help me please...)

$ tail local/var/log/ejabberd/ejabberd.log local/var/log/ejabberd/report.log
==> local/var/log/ejabberd/ejabberd.log <==

=INFO REPORT==== 2006-10-05 23:04:21 ===
I(<0.230.0>:ejabberd_listener:90): (#Port<0.1871>) Accepted connection {{192,168,254,84},38647} -> {{192,168,254,84},5280}

=INFO REPORT==== 2006-10-05 23:04:21 ===
I(<0.224.0>:ejabberd_http:76): started: {gen_tcp,#Port<0.1871>}

=INFO REPORT==== 2006-10-05 23:04:21 ===
I(<0.1198.0>:ejabberd_http:171): (#Port<0.1871>) http query: 'POST' /http-poll

==> local/var/log/ejabberd/report.log <==

=INFO REPORT==== 5-Oct-2006::23:04:21 ===
I(<0.230.0>:ejabberd_listener:90): (#Port<0.1871>) Accepted connection {{192,168,254,84},38647} -> {{192,168,254,84},5280}

=INFO REPORT==== 5-Oct-2006::23:04:21 ===
I(<0.224.0>:ejabberd_http:76): started: {gen_tcp,#Port<0.1871>}

=INFO REPORT==== 5-Oct-2006::23:04:21 ===
I(<0.1198.0>:ejabberd_http:171): (#Port<0.1871>) http query: 'POST' /http-poll

Use HTTP-BIND

zengargoyle wrote:

I'm running a server on a shared hosting provider and the log growth is causing me great pain. I can't provide JWChat to my users if every http-poll event causes a log entry, much less if it causes an entry in multiple files.

HTTP-BIND is more efficient than HTTP-POLL, and is recommended. Enable it on ejabberd.cfg and configure JWChat accordingly.

Using HTTP-BIND will alleviate the problem, but not solve it. Since important stuff is already logged by ejabberd, you can set Yaws logs to /dev/null. And obviously you must rotate ejabberd logs frequently.

zengargoyle wrote:

I've setup the YawsPack with JWChat support, but the amount of logging is killing me... Is there any way to make Yaws only log ERROR messages (and not INFO), and to only log to the report.log file and not both the report.log and ejabberd.log file?

I don't know about parameters, but you can disable all INFO messages with this patch. Note you must recompile ejabberd completely:

--- src/ejabberd.hrl    (revisión: 659)
+++ src/ejabberd.hrl    (copia de trabajo)
@@ -22,9 +22,8 @@
        error_logger:error_msg("E(~p:~p:~p): "++Format++"~n",
                               [self(),?MODULE,?LINE]++Args)).

--define(INFO_MSG(Format, Args),
-       error_logger:info_msg("I(~p:~p:~p): "++Format++"~n",
-                             [self(),?MODULE,?LINE]++Args)).
+-define(INFO_MSG(_Format, _Args),
+       ok.


 -define(MYHOSTS, ejabberd_config:get_global_option(hosts)).

Source for YawsPack/mod_yaws

Thank you for the help so far. :)

I am testing ejabberd-1.1.2 and YawsPack-0.3 and I would like to have the sources for YawsPack and mod_yaws.

Or maybe just some more pointers...

First, I tried compiling my own yaws-1.65 and the mod_yaws.erl from this site (mod_yaws-0.1 I guess...). But with that I could not get HTTP-Binding to work. I tried using the mod_yaws.beam and ejabberd_*.beam from YawsPack-0.3 with my yaws-1.65, but it did not work. I had to not use my yaws-1.65 and use all of the *.beam files from YawsPack in order to get HTTP-Binding to work.

I want to hack yaws-1.65 to reduce logging info. So I think I need the following:

* the sources for the HTTP-Binding patches.
* the sources for mod_yaws that support HTTP-Binding.

Can I mix these sources with yaws-1.65 build and get everything to work?

Is mod_yaws from YawsPack-0.3 the same as mod_yaws.erl on this site? What part of YawsPack is needed for HTTP-Binding? Are there any changes to yaws-1.65 for YawsPack? I was suprised that my yaws-1.65 + YawsPack/mod_yaws.beam + YawsPack/ejabberd_*.beam did not work.

Try updated mod_yaws source code to 0.2

zengargoyle wrote:

Is mod_yaws from YawsPack-0.3 the same as mod_yaws.erl on this site?

That was the problem: the mod_yaws binary included in YawsPack was 0.2, but the source code published was only 0.1. Please try with the new version, since it includes the code required for HTTP-Bind.

zengargoyle wrote:

Can I mix these sources with yaws-1.65 build and get everything to work?

Now that you really have the newest source code, you don't need to mix things. I've compiled from source and tried ejabberd 1.1.2 + ejabberd_http_bind patch + mod_yaws 0.2 + Yaws 0.65 + JWChat CVS and it seems to works correctly.

working, one final question

Aha! Thank you, everything is working with yaws-1.65 now.

I have one final question for now, looking at yaws.app and ejabberd.app I see a "{applications, [kernel, stdlib]}" line. Does this mean that I only need the erlang/lib/{kernel,stdlib} parts of erlang?

I'm trying to save space on my install by removing things that are not needed for runtime. Is there an easy way to determine which parts of erlang erts are not needed? Like debugger, edoc, snmp... So far, I have just been deleting some of the larger erts libraries that don't sound necessary (like snmp), but I don't want my server to crash someday because of a missing library.

Oh, and one little feature request. If possible, it would be nice to still use a yaws.conf file for the embedded server. So as to be able to add protected directories or other yaws applications to the embedded server without modifying mod_yaws each time.

Check binary installer

zengargoyle wrote:

I have one final question for now, looking at yaws.app and ejabberd.app I see a "{applications, [kernel, stdlib]}" line. Does this mean that I only need the erlang/lib/{kernel,stdlib} parts of erlang?

I don't know.

zengargoyle wrote:

Is there an easy way to determine which parts of erlang erts are not needed? Like debugger, edoc, snmp...

The ejabberd binary installer from Process-one website includes a minimal Erlang. Checking it will give you a clue on what is safe to remove and what not.

zengargoyle wrote:

Oh, and one little feature request. If possible, it would be nice to still use a yaws.conf file for the embedded server. So as to be able to add protected directories or other yaws applications to the embedded server without modifying mod_yaws each time.

Yaws in embedded mode does not read from yaws.conf, the options are passed on runtime, by the calling code (mod_yaws). It's possible to parametrice mod_yaws so you can change the Yaws options on ejabberd.cfg or web interface, for example 'appmods'.

All set for now...

badlop wrote:

The ejabberd binary installer from Process-one website includes a minimal Erlang. Checking it will give you a clue on what is safe to remove and what not.

Perfect! That cut my install size in half.

Quote:

Yaws in embedded mode does not read from yaws.conf, the options are passed on runtime, by the calling code (mod_yaws). It's possible to parametrice mod_yaws so you can change the Yaws options on ejabberd.cfg or web interface, for example 'appmods'.

Cool. That's why I wanted the source for the latest mod_yaws... I figure there may be a way to use the yaws load-config-from-file with the embedded configuration and the ejabberd specifics. If I figure it out I'll send a patch. :) I'm still a erlang newbie.

I do it, but have error

E(<0.39.0>:gen_mod:47): {{badrecord,gconf},
[{mod_yaws,start,2},
{gen_mod,start_module,3},
{lists,foreach,2},
{ejabberd_app,start,2},
{application_master,start_it_old,4}]}

Yaws runtime

Hi,
I did the following during installation..
Ejabberd - ejabberd.cfg file
{Listen, [
...
{5280, ejabberd_http, [http_bind, web_admin]},
...
]}

and

{modules, [
...
{mod_yaws, [
{logdir, "/tmp/"},
{servers, [
{"QKAN00191117A", 5224, "/home/test/www", [
{dir_listing, true},
{ip, {127, 0, 0, 1}}
]}
]}
]},
..
]}

I am using Apache tomcat..and I deployed the JabberHttpBind-1.1
This is working fine and I am getting the following msg..

"
Jabber HTTP Binding Servlet v1.1
This is an implementation of JEP-0124 (HTTP-Binding). Please see http://www.jabber.org/jeps/jep-0124.html for details.

Active sessions: 0
"
Then I have in my mukl the following settings in config.js,

var BACKENDTYPE = 'binding';
var HTTPBASE = "/tomcat/JabberHTTPBind-1.1/";
var XMPPDOMAIN = "QKAN00191117A";
var timerval = 2000;

Then the .htaccess file in MUCKl has the following settings..

RewriteEngine On
RewriteRule http-poll/ http://QKAN00191117A:5280/http-poll/ [P]
RewriteRule http-bind/ http://QKAN00191117A:5280/JabberHTTPBind-1.1/ [P]

and I am getting the following error..

"Service Unavailable"

can someone PLEASE help me on this problem.. I am stuck here..
thanks
Vivian

JabberHTTPBind says "Service Unavailable"

Vivian wrote:

and I am getting the following error..
"Service Unavailable"
can someone PLEASE help me on this problem.. I am stuck here..
Vivian

I've got exacly the same message as Vivian:
"Service Unavailable"
I've installed similar bunch of software:
ejabberd-1.1.4, JabberHTTPBind-1.1, MUCkl-0.4.3.
Everything works when I change client to use polling.
But at binding mode MUCkl Debugger returns:
"initial response broken (status: 404)"

I am stuck here too.
Any suggestions?
Where to look?

Lewar

Hi folks, I changed did the

Hi folks,
I changed did the following changes..in the ejabberd.cfm file

{mod_yaws, [
{logdir, “/tmp/"},
{servers, [
{"QKAN00191117A", 5224,
“C:\Program Files/Apache Software Foundation/Tomcat 6.0/webapps/www/”,
[{dir_listing, true}, {ip, {127, 0, 0, 1}}]
}
]}
]},
..
]}

and I am getting the following error....

“Internal Server error
Reconnect
Ok / cancel

The muckl debugger says..
level 1
no body element or incorrect body in initial response

and the error report was..

=ERROR REPORT==== 2007-10-11 11:36:44 ===
E(<0.36.0>:gen_mod:47): {undef,
[{mod_yaws,
start,
["qkan00191117a",
[{logdir,"/tmp/"},
{servers,
[{"QKAN00191117A",
5224,
“Crasberryrogram Files/Apache Software Foundation/Tomcat 6.0/webapps/www/”,
[{dir_listing,true},
{ip,{127,0,0,1}}]}]}]]},
{gen_mod,start_module,3},
{lists,foreach,2},
{ejabberd_app,start,2},
{application_master,start_it_old,4}]}

can someone PLEASE help me on this problem.. what am I doing wrong ?..

thanks
Vivian

Syndicate content