Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  Successfully hosted multiple ErlyWeb apps on Yaws?

Guest
Posted: Thu Sep 27, 2007 2:06 am Reply with quote
Guest
Has anyone been able to successfully host multiple ErlyWeb apps on
Yaws, with the same servername/port but with different appmod paths?

I am using yaws 1.71 and erlyweb 0.6.2.

When I use yaws:add_server to add servers for erlyweb apps with the
same
servername and port, only the last server gets recognized. Both apps
work
fine when added independently, and both apps appear in the
yaws_api:getconf(), but only the last server added actually works,
other
servers return 404 when accessed. Is this the expected behavior or a
bug in Yaws?

start_yaws(Port)->
code:add_patha("/opt/local/lib/yaws/ebin"),

yaws:start_embedded("./apps/blog/www",
[{servername, "localhost"},
{port, Port},
{appmods,[{"/blog",erlyweb}]},
{opaque,[{"appname",blog}]},
{allowed_scripts,[]}],
[{logdir,"./log"}]),

yaws:add_server("./apps/wiki/www",
[{servername, "localhost"},
{port, Port},
{appmods,[{"/wiki",erlyweb}]},
{opaque,[{"appname",wiki}]},
{allowed_scripts,[]}]).


print_yaws_conf() ->
io:format("~p~n",[yaws_api:getconf()]).

{ok,{gconf,"/opt/local/lib/yaws",
false,
204,
"./log",
["/opt/local/lib/yaws/examples/ebin"],
[],
15000,
400,
1000000,
8000,
10240,
10000000,
30,
["/opt/local/lib/yaws/examples/include"],
"/usr/bin/php-cgi",
"Yaws 1.71",
[],
"/Users/rcb/.yaws",
false},
[[{sconf,3000,
3,
[],
undefined,
undefined,
"./apps/wiki/www",
[],
{127,0,0,1},
"localhost",
undefined,
undefined,
[],
nolimit,
[{"/wiki",erlyweb}],
yaws_404,
yaws_404,
yaws,
[{"appname",wiki}],
undefined,
[],
[]},
{sconf,3000,
3,
[],
undefined,
undefined,
"./apps/blog/www",
[],
{127,0,0,1},
"localhost",
46,
undefined,
[],
nolimit,
[{"/blog",erlyweb}],
yaws_404,
yaws_404,
yaws,
[{"appname",blog}],
undefined,
[],
[]}]]}




I also posted this on the erlyaws mailing list.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Thu Sep 27, 2007 8:29 am Reply with quote
Guest
It is currently unworkable to host more than one ErlyWeb app on the
same yaws servername/port because opaque/appname cannot uniquely
identify more than one app.

Change Erlyweb:
Stop using opaque/appname entirely since it is ambiguous for more
than one app.
Make erlyweb:create_app generate an additional module that contains
a the entry point for the app (out/1).
eg erlyweb:create_app("blog","./apps") -> erlyweb_blog.erl (or
something similar)
then in yaws configuration: {appmods,[{"/blog",erlyweb_blog},
{"/wiki",erlyweb_wiki}]}

-OR-

Change Yaws:
Add per-appmod-opaques in yaws configuration

Thoughts?

Robin



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Sat Sep 29, 2007 9:35 pm Reply with quote
Guest
There is currently an (experimental) addon to Yaws called Yaws applications - yapps - that is supposed to support administration of several web applications independently on Yaws. Kind of a Java servlet, but as an Erlang application. It
Guest
Posted: Sat Sep 29, 2007 9:50 pm Reply with quote
Guest
Instead of configuring multiple ErlyWeb apps with Yaws, try creating
your own appmod that does the following:

out(A) ->
AppName = case yaws_arg:appmoddata(A) of
Path1 -> "app1"
Path2 -> "app2"
...
end,
A1 = yaws_arg:opaque(A, [{appname, AppName} | yaws_arg:opaque(A)]),
erlyweb:out(A1).

I haven't tried it, but I don't see why it shouldn't work.

Yariv


On 9/27/07, Robin <robi123@gmail.com> wrote:
>
> It is currently unworkable to host more than one ErlyWeb app on the
> same yaws servername/port because opaque/appname cannot uniquely
> identify more than one app.
>
> Change Erlyweb:
> Stop using opaque/appname entirely since it is ambiguous for more
> than one app.
> Make erlyweb:create_app generate an additional module that contains
> a the entry point for the app (out/1).
> eg erlyweb:create_app("blog","./apps") -> erlyweb_blog.erl (or
> something similar)
> then in yaws configuration: {appmods,[{"/blog",erlyweb_blog},
> {"/wiki",erlyweb_wiki}]}
>
> -OR-
>
> Change Yaws:
> Add per-appmod-opaques in yaws configuration
>
> Thoughts?
>
> Robin
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum