Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  mod_python for yaws ??

Ke Han
Posted: Wed Aug 30, 2006 8:03 pm Reply with quote
User Joined: 02 Mar 2005 Posts: 107 Location: Shanghai
Does anyone know how mod_python for apache works? If its not too
hard, I would like to make something like this for yaws...or at least
a special purpose interface for running trac through yaws.
My impetus for this is to use trac (trac.edgewall.com) served by yaws.
Currently supported methods for serving trac pages are: cgi,
fast_cgi, mod_python and tracd (trac's standalone http server).

If its possible, I will integrate yaws to trac by starting with the
howto for running python as a port:
http://wiki.trapexit.org/index.php/
Writing_an_Erlang_Port_using_OTP_Principles

The trouble is, I have no clue what mod_python for apache does. What
info and structure from the http request am I supposed to pass on to
the python process?
I could go the fast_cgi route instead, but I don't know where to
start on this one either, so I figured running python as a port and
trying to emulate a mod_python solution would be my first try.

Any ideas?

thanks, ke han


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message
anders_n
Posted: Wed Aug 30, 2006 8:08 pm Reply with quote
User Joined: 28 Feb 2005 Posts: 155 Location: Saltillo, Mexico
On 8/30/06, ke han <ke.han@redstarling.com> wrote:
> Does anyone know how mod_python for apache works? If its not too
> hard, I would like to make something like this for yaws...or at least
> a special purpose interface for running trac through yaws.
> My impetus for this is to use trac (trac.edgewall.com) served by yaws.
> Currently supported methods for serving trac pages are: cgi,
> fast_cgi, mod_python and tracd (trac's standalone http server).
>
> If its possible, I will integrate yaws to trac by starting with the
> howto for running python as a port:
> http://wiki.trapexit.org/index.php/
> Writing_an_Erlang_Port_using_OTP_Principles
>
> The trouble is, I have no clue what mod_python for apache does. What
> info and structure from the http request am I supposed to pass on to
> the python process?
> I could go the fast_cgi route instead, but I don't know where to
> start on this one either, so I figured running python as a port and
> trying to emulate a mod_python solution would be my first try.
>

I have no idea either of how mod_python works but I am also interested
in running
trac via yaws instead of apache.

/Anders

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Yahoo Messenger
Guest
Posted: Wed Aug 30, 2006 8:33 pm Reply with quote
Guest
On 8/30/06, ke han <ke.han@redstarling.com> wrote:
> Does anyone know how mod_python for apache works? If its not too
> hard, I would like to make something like this for yaws...or at least
> a special purpose interface for running trac through yaws.
> My impetus for this is to use trac (trac.edgewall.com) served by yaws.
> Currently supported methods for serving trac pages are: cgi,
> fast_cgi, mod_python and tracd (trac's standalone http server).
>
> If its possible, I will integrate yaws to trac by starting with the
> howto for running python as a port:
> http://wiki.trapexit.org/index.php/
> Writing_an_Erlang_Port_using_OTP_Principles
>
> The trouble is, I have no clue what mod_python for apache does. What
> info and structure from the http request am I supposed to pass on to
> the python process?

You definitely don't want to try and emulate mod_python. fastcgi or
reverse proxy to tracd would be significantly easier and more
flexible.

-bob

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Wed Aug 30, 2006 8:44 pm Reply with quote
Guest
ke han wrote:
> If its possible, I will integrate yaws to trac by starting with the
>

At my workplace (tail-f) we're succesfully running trac from yaws. Trac is
just a great tool b.t.w.

Here are the relevant snippets to get it going, appmods rock. Sebastian
Strollo did this.


1. yaws.conf

......

<server wiki.tail-f.com>
port = 443
listen = 192.168.1.43

appmods = </viewvc , viewvc> </trac , trac>
docroot = /store/wiki/wiki

<auth>
dir = /
realm = Tail-f-wiki
user ........




2.

# cat trac.erl

-module(trac).
-export([out/1]).

-include_lib("yaws/include/yaws_api.hrl").

out(Arg) ->
Pathinfo = Arg#arg.appmoddata,
RemoteUser = case (Arg#arg.headers)#headers.authorization of
{User, _Pass, _Type} ->
[{"REMOTE_USER", User}];
_ ->
[]
end,
Env = [{"SCRIPT_NAME", "/trac"},
{"TRAC_ENV", "/store/wiki/trac"}] ++ RemoteUser,
yaws_cgi:call_cgi(Arg, undefined, script(), Pathinfo, Env).

script() ->
"/usr/local/share/trac/cgi-bin/trac.cgi".
% "/home/seb/environment.cgi".




3.

# cat viewvc.erl
-module(viewvc).
-export([out/1]).

-include_lib("yaws/include/yaws_api.hrl").

out(Arg) ->
Pathinfo = Arg#arg.appmoddata,
Env = [{"SCRIPT_NAME", "/viewvc/"}],
yaws_cgi:call_cgi(Arg, undefined, script(), Pathinfo, Env).

script() ->
"/usr/local/viewvc-1.0-dev/bin/cgi/viewcvs.cgi".








-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Ke Han
Posted: Wed Aug 30, 2006 8:51 pm Reply with quote
User Joined: 02 Mar 2005 Posts: 107 Location: Shanghai
On Aug 31, 2006, at 4:32 AM, Bob Ippolito wrote:

> On 8/30/06, ke han <ke.han@redstarling.com> wrote:
>> Does anyone know how mod_python for apache works? If its not too
>> hard, I would like to make something like this for yaws...or at least
>> a special purpose interface for running trac through yaws.
>> My impetus for this is to use trac (trac.edgewall.com) served by
>> yaws.
>> Currently supported methods for serving trac pages are: cgi,
>> fast_cgi, mod_python and tracd (trac's standalone http server).
>>
>> If its possible, I will integrate yaws to trac by starting with the
>> howto for running python as a port:
>> http://wiki.trapexit.org/index.php/
>> Writing_an_Erlang_Port_using_OTP_Principles
>>
>> The trouble is, I have no clue what mod_python for apache does. What
>> info and structure from the http request am I supposed to pass on to
>> the python process?
>
> You definitely don't want to try and emulate mod_python. fastcgi or
> reverse proxy to tracd would be significantly easier and more
> flexible.

ok, so any pointers on where to start with fast_cgi or reverse proxy
to tracd?
I know that the point of fast_cgi is to keep the python process
running between calls. Seems like I can use the howto referenced
above for this. Wink But what do I actually pass from the http
request into python? I gues this is like saying what is the fast_cgi
protocol...but thats basically where I am.
Doing reverse proxy to tracd sounds straightforward but less
desirable in terms of performance and solution reuse for other types
of apps and for my purposes I need the requests coming through as
https. I've read quite a few problems exist when trying to proxy
into tracd with an https front end.

thanks for saving me some time on the mod_python attack...
Any more takers on my next steps?
ke han

>
> -bob


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message
Ke Han
Posted: Wed Aug 30, 2006 9:34 pm Reply with quote
User Joined: 02 Mar 2005 Posts: 107 Location: Shanghai
Claes,
fantastic!!! I'll try this first thing tomorrow...its 5:30 am now
and I best get to sleep so my wife can wake me up in 2 hours ;-(
Yes, trac is nice and each release (0.10 just came out) keeps getting
better. .. 0.10 is VCS agnostic...sort of, svn is still the standard.
Have you thought of using yaws + trac for yaws.hyber.org ? you could
dump sourceforge and switch from cvs to svn in one blow. Wink
thanks again, you've saved me lots of trial and error...I can live
without fast_cgi.
ke han


On Aug 31, 2006, at 4:39 AM, Claes Wikstrom wrote:

> ke han wrote:
>> If its possible, I will integrate yaws to trac by starting with the
>>
>
> At my workplace (tail-f) we're succesfully running trac from yaws.
> Trac is
> just a great tool b.t.w.
>
> Here are the relevant snippets to get it going, appmods rock.
> Sebastian
> Strollo did this.
>
>
> 1. yaws.conf
>
> ......
>
> <server wiki.tail-f.com>
> port = 443
> listen = 192.168.1.43
>
> appmods = </viewvc , viewvc> </trac , trac>
> docroot = /store/wiki/wiki
>
> <auth>
> dir = /
> realm = Tail-f-wiki
> user ........
>
>
>
>
> 2.
>
> # cat trac.erl
>
> -module(trac).
> -export([out/1]).
>
> -include_lib("yaws/include/yaws_api.hrl").
>
> out(Arg) ->
> Pathinfo = Arg#arg.appmoddata,
> RemoteUser = case (Arg#arg.headers)#headers.authorization of
> {User, _Pass, _Type} ->
> [{"REMOTE_USER", User}];
> _ ->
> []
> end,
> Env = [{"SCRIPT_NAME", "/trac"},
> {"TRAC_ENV", "/store/wiki/trac"}] ++ RemoteUser,
> yaws_cgi:call_cgi(Arg, undefined, script(), Pathinfo, Env).
>
> script() ->
> "/usr/local/share/trac/cgi-bin/trac.cgi".
> % "/home/seb/environment.cgi".
>
>
>
>
> 3.
>
> # cat viewvc.erl
> -module(viewvc).
> -export([out/1]).
>
> -include_lib("yaws/include/yaws_api.hrl").
>
> out(Arg) ->
> Pathinfo = Arg#arg.appmoddata,
> Env = [{"SCRIPT_NAME", "/viewvc/"}],
> yaws_cgi:call_cgi(Arg, undefined, script(), Pathinfo, Env).
>
> script() ->
> "/usr/local/viewvc-1.0-dev/bin/cgi/viewcvs.cgi".
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------------
> ---
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Erlyaws-list mailing list
> Erlyaws-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/erlyaws-list


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message

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 can attach files in this forum
You can download files in this forum