Re: [Erlangweb-users] [?] *.yaws and *.cgi and fossil
Brought to you by:
etcerlangweb,
paulgray
|
From: <erl...@au...> - 2009-09-01 22:29:34
|
Thank you, Michal.
I am having some small success. I will submit updated information
[and configuration] later when I get things working more suitably.
~Michael
On Tue, Sep 01, 2009 at 09:47:30AM +0200, Michal Zajda wrote:
> Hi,
> it is just theoretical because I never set up fossil, but I see several
> issues in Your config:
> 1. in yaws.conf place ErlangWeb appmod in a front of rest of them
> 2. place all fossil files in docroot (lets say in docroot/fossil)
> 3. dispatcher should return then {static, "^/fossil", enoent}
> 4. code from docroot should be executed
> In case You would like to have some authorisation (or similar action
> before serving content) :
> 1. write a controller to handle authorisation (lets give it a name
> c_fossil)
> 2. in case of yaws return from controller one of :
> {custom, {page, "/" ++ wpart:fget("__path")}} %% <-- so the
> same place
> or
> {template, "docroot/fossil/some_index.html"} %% <-- so it goes
> via out templating engine
> 3. dispatcher differs here:
> {dynamic, "^/fosill", {c_fossil, read}}
> 4. last but not least:
> 4.1 in case of {template.. } be careful with dispatcher rules and
> docroot (remember that static rules are matched in the first place)
> 4.2 in case of {custom.. } while the rule is dynamic it actually
> returns path /app/fossil/ (because of appmod) so You need to do symlink
> in docroot to the fossil directory. So, it fossil is placed in
> docroot/fossil then we need app/ directory in docroot and inside of
> that link to fossil dir
> {page.. } and 4.2 are not officialy supported ;) but it is good to know
> this is possible
> br
> Michal Z
>
> 2009/9/1 Michael McDaniel <[1]erl...@au...>
>
> Hi, List.
> I want to run *.yaws and *.cgi files via erlang-web.
> Well, actually, I want to be able to serve fossil
> [[2]http://fossil-scm.org] repositories from within
> erlang-web (using yaws as backend), I'm not particularly
> stuck on using *.yaws and *.cgi though that is how I ran
> fossil using yaws alone.
> If I am only running yaws then I can do, e.g. the following
> to display (and work with) a fossil repository :
> /usr/local/etc/yaws/yaws.conf
> ...
> <server localhost>
> port = 80
> listen = 127.0.0.1
> docroot = /usr/local/var/yaws/www
> appmods = <cgi-bin, yaws_appmod_cgi>
> </server>
> ---
> /usr/local/var/yaws/www/block_clone.yaws
> <erl>
> out(Arg) ->
> yaws_cgi:call_cgi(Arg,
> "/usr/local/var/yaws/www/cgi-bin/block_clone.cgi").
> </erl>
> ---
> /usr/local/var/yaws/www/cgi-bin/block_clone.cgi
> #!/usr/local/bin/fossil
> repository: /tmp/cloned_repositories/block_clone.fossil
> --
> and, when pointing browser at
> [3]http://localhost/block_clone.yaws/
> I get the fossil index page, and all the links work.
> ---
> and, for Erlang Web, I have tried various combinations
> of, e.g.
> templates/fossil.html
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "[4]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="[5]http://www.w3.org/1999/xhtml">
> <head>
> <title>Fossil repositories</title>
> <script src="cgi/foo.cgi" type="text/html"> </script>
> </head>
> </html>
> ^^^^^^^^^^^^^
> also changed this to "fossil.yaws"
> which calls the cgi file
> The cgi file is executable. The repository is readable.
> The cgi directory is a subdirectory of templates directory.
> So, how can I serve fossil repositories via erlang-web whether
> with *.yaws and cgi or not. Of course, using yaws as the
> backend web server for Erlang Web.
> I tried similar configuration and various combinations
> in dispatch.conf, e.g. {static, "^/fossil$", "fossil.yaws"}.
> but the best I can get is no error and a blank page in
> the browser.
> Please if you have a suggestion (especially one you have
> used successfully) to run *.yaws and *.cgi within
> Erlang Web, please provide it.
> If there is online documentation I have not found it so
> a pointer to docs which may help out would be appreciated
> as well.
> Also, the above is the simplest case of delivering a single
> fossil repository. I actually plan to provide multiple
> repositories (which I have done using yaws only) as described here,
> [6]http://www.fossil-scm.org/index.html/wiki?name=Cookbook#CGI
> I think I am missing something basic because even a simple
> hello.cgi gives a blank page
> #!/bin/bash
> echo "hello"
> ~Michael
> --------------------------------------------------------------------
> ----------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. [7]http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Erlangweb-users mailing list
> [8]Erl...@li...
> [9]https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> [10]http://www.erlang-web.org/
>
> References
>
> 1. mailto:erl...@au...
> 2. http://fossil-scm.org/
> 3. http://localhost/block_clone.yaws/
> 4. http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
> 5. http://www.w3.org/1999/xhtml
> 6. http://www.fossil-scm.org/index.html/wiki?name=Cookbook#CGI
> 7. http://p.sf.net/sfu/bobj-july
> 8. mailto:Erl...@li...
> 9. https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> 10. http://www.erlang-web.org/
|