[erlang-questions] Yaws, ErlyWeb and Windows.

Bob Cowdery Bob.Cowdery@REDACTED
Thu Sep 13 09:00:06 CEST 2007


Robert

Thanks very much for that. I will have a go when I'm out the woods. At the moment the pre-built version is working ok. 

However, I wonder, do you use ErlyWeb because I'm having trouble with it. I posted a message on the forum yesterday but no replies yet. Essentially I can't get it to generate code for a MySQL table and it can't seem to find the controller that it generated anyway. In fact it dosn't seem think they are controllers and views.

Any help appreciated.

Bob 

-----Original Message-----
From: erlang-questions-bounces@REDACTED
[mailto:erlang-questions-bounces@REDACTED]On Behalf Of Robert Raschke
Sent: 11 September 2007 10:36
To: erlang-questions@REDACTED
Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows.


> Bob Cowdery wrote:
>> Hi All
>> 
>> Can someone give me the picture on Yaws and ErlyWeb under Windows please
> 
> I'm sorry about that - to my knowledge there is quite a lot
> of people running yaws under windows. I don't run windows at
> all any longer - and I'll just have to leave it up to the
> yaws/windows community to write e.g. a proper wiki entry on how to do 
> it. I know for sure that it atleast used to work - I made sure it
> worked once, but it might have gone bad.

Here's how I build yaws on Windows:

My source root is $ROOT.
Unpack yaws-1.68 into $ROOT/lib/yaws.
Have a folder called $ROOT/extra with the files yaws_generated.erl and
yaws.app (although I forget why I need yaws.app):

yaws_generated.erl:
%%%----------------------------------------------------------------------
%%% File    : yaws_generated.template
%%% Author  : Klacke <klacke@REDACTED>
%%% Purpose : 
%%% Created : 10 Jun 2002 by Klacke <klacke@REDACTED>
%%%----------------------------------------------------------------------

%% generated code from some environment variables
%% especially VARDIR is important since it controls
%% where the --hup and friends

-module(yaws_generated).
-author('klacke@REDACTED').

-compile(export_all).

version() -> "1.68".

vardir() ->  "C:/yaws/var".

ctldir() -> "C:/yaws/var/run/yaws".

etcdir() -> "C:/yaws/etc".
	  
% (Or whatever you want your defaults to be.)

yaws.app:
{application, yaws, [
	{description, "yaws WWW server"},
	{vsn, "1.68"},
	{modules, [
		yaws,
		yaws_app,
		yaws_ticker,
		yaws_config,
		yaws_server,
		yaws_sup,
		yaws_api,
		yaws_log,
		yaws_ls,
		yaws_debug,
		yaws_compile,
		yaws_ctl,
		yaws_cgi,
		yaws_zlib,
		yaws_generated,
		mime_type_c,
		mime_types,
		yaws_session_server,
		yaws_404,
		yaws_revproxy,
		yaws_html,
		yaws_log_file_h,
		yaws_rss,
		yaws_dav,
		yaws_pam,
		json,
		jsonrpc,
		yaws_jsonrpc,
		yaws_xmlrpc,
		haxe,
		yaws_rpc,
		yaws_soap_srv,
		yaws_soap_lib
	]},
	{registered, []},
	{mod, {yaws_app, []}},
	{env, []},
	{applications, [
		kernel,
		stdlib
	]}
]}.

And then I run this batch script:

build_yaws.bat:
@echo off
setlocal

copy /Y extra\yaws_generated.erl lib\yaws\src
cd lib\yaws\src

set ERLC="C:\Program Files\erl5.5.4\bin\erlc"
set ERL="C:\Program Files\erl5.5.4\bin\erl"

set ERLCOPTS=-W -pa .. -I../include -o ../ebin
set ERLOPTS=-noshell  -pa ../ebin


%ERLC% %ERLCOPTS% yaws.erl
%ERLC% %ERLCOPTS% yaws_app.erl
%ERLC% %ERLCOPTS% yaws_ticker.erl
%ERLC% %ERLCOPTS% yaws_config.erl
%ERLC% %ERLCOPTS% yaws_server.erl
%ERLC% %ERLCOPTS% yaws_sup.erl
%ERLC% %ERLCOPTS% yaws_api.erl
%ERLC% %ERLCOPTS% yaws_log.erl
%ERLC% %ERLCOPTS% yaws_ls.erl
%ERLC% %ERLCOPTS% yaws_debug.erl
%ERLC% %ERLCOPTS% yaws_compile.erl
%ERLC% %ERLCOPTS% yaws_ctl.erl
%ERLC% %ERLCOPTS% yaws_cgi.erl
%ERLC% %ERLCOPTS% yaws_zlib.erl
%ERLC% %ERLCOPTS% yaws_generated.erl
%ERLC% %ERLCOPTS% yaws_session_server.erl
%ERLC% %ERLCOPTS% yaws_404.erl
%ERLC% %ERLCOPTS% yaws_revproxy.erl
%ERLC% %ERLCOPTS% yaws_html.erl
%ERLC% %ERLCOPTS% yaws_log_file_h.erl
%ERLC% %ERLCOPTS% yaws_rss.erl
%ERLC% %ERLCOPTS% yaws_dav.erl
%ERLC% %ERLCOPTS% yaws_pam.erl
%ERLC% %ERLCOPTS% json.erl
%ERLC% %ERLCOPTS% jsonrpc.erl
%ERLC% %ERLCOPTS% yaws_jsonrpc.erl
%ERLC% %ERLCOPTS% yaws_xmlrpc.erl
%ERLC% %ERLCOPTS% haxe.erl
%ERLC% %ERLCOPTS% yaws_rpc.erl
%ERLC% %ERLCOPTS% yaws_soap_srv.erl
%ERLC% %ERLCOPTS% yaws_soap_lib.erl

del /F charset.def
echo. > charset.def

%ERLC% %ERLCOPTS% mime_type_c.erl
%ERL% %ERLOPTS% -s mime_type_c compile
%ERLC% %ERLCOPTS% mime_types.erl

pause
endlocal


I have also made a small attempt at writing a yaws.bat file, but I
haven't used this in a few years:

@echo off
setlocal

set HOME=C:/yaws
set yawsdir=C:/yaws/erlang/yaws-1.68

set erl=C:\Program Files\erl5.5.4\bin\erl.exe
set werl=C:\Program Files\erl5.5.4\bin\werl.exe

set debug=
set daemon=
set interactive=
set trace=
set conf=
set runmod=
set sname=
set heart=
set xpath=
set mnesia=
set id=default
set pdist=
set erlarg=

:NEXTARG
set arg=%1
shift
if "%arg%"=="" goto ENDARGS

if "%arg%"=="-i" goto INTERACT
if "%arg%"=="--interactive" goto INTERACT

if "%arg%"=="-w" goto WINTERACT
if "%arg%"=="--winteractive" goto WINTERACT

if "%arg%"=="-D" goto DAEMON
if "%arg%"=="--daemon" goto DAEMON

if "%arg%"=="-d" goto DEBUG
if "%arg%"=="--debug" goto DEBUG

if "%arg%"=="-t" goto TRACETR
if "%arg%"=="--tracetraf" goto TRACETR

if "%arg%"=="-T" goto TRACEHT
if "%arg%"=="--tracehttp" goto TRACEHT

if "%arg%"=="-I" goto ID
if "%arg%"=="--id" goto ID

if "%arg%"=="-x" goto TRACEOUT
if "%arg%"=="--traceout" goto TRACEOUT

if "%arg%"=="--trace" goto TRACE

if "%arg%"=="-M" goto MNESIADIR
if "%arg%"=="--mnesiadir" goto MNESIADIR

if "%arg%"=="-c" goto CONF
if "%arg%"=="--conf" goto CONF

if "%arg%"=="-pa" goto PA
if "%arg%"=="--pa" goto PA

if "%arg%"=="-r" goto RUNMOD
if "%arg%"=="--runmod" goto RUNMOD

if "%arg%"=="-h" goto HUP
if "%arg%"=="--hup" goto HUP

if "%arg%"=="-s" goto STOP
if "%arg%"=="--stop" goto STOP

if "%arg%"=="-ls" goto LS
if "%arg%"=="--ls" goto LS

if "%arg%"=="-S" goto STATUS
if "%arg%"=="--status" goto STATUS

if "%arg%"=="-load" goto LOAD
if "%arg%"=="--load" goto LOAD

if "%arg%"=="-j" goto CTLTRACE
if "%arg%"=="--ctltrace" goto CTLTRACE

if "%arg%"=="-v" goto VERSION
if "%arg%"=="--version" goto VERSION

if "%arg%"=="-sname" goto SNAME
if "%arg%"=="--sname" goto SNAME

if "%arg%"=="-name" goto NAME
if "%arg%"=="--name" goto NAME

if "%arg%"=="-heart" goto HEART
if "%arg%"=="--heart" goto HEART

if "%arg%"=="-proto_dist" goto PROTO
if "%arg%"=="--proto_dist" goto PROTO

if "%arg%"=="-erlarg" goto ERLARG
if "%arg%"=="--erlarg" goto ERLARG

if "%arg%"=="-check" goto CHECK
if "%arg%"=="--check" goto CHECK

goto HELP

:INTERACT
set interactive=true
set debug= -yaws debug 
set daemon=
goto NEXTARG

:WINTERACT
set interactive=true
set debug= -yaws debug 
set daemon=
set erl=%werl%
goto NEXTARG

:DAEMON
set daemon= -detached 
goto NEXTARG

:DEBUG
set debug= -boot start_sasl -yaws debug 
goto NEXTARG

:TRACETR
set trace= -yaws trace traffic 
goto NEXTARG

:TRACEHT
set trace= -yaws trace http 
goto NEXTARG

:ID
set id=%1
shift
goto NEXTARG

:TRACEOUT
set traceoutput= -yaws traceoutput 
goto NEXTARG

:TRACE
set traceoutput= -yaws traceoutput 
set trace= -yaws trace traffic 
goto NEXTARG

:MNESIADIR
set mnesia= -mnesia dir %1 -run mnesia start
shift
goto NEXTARG

:CONF
set conf= -conf %1 
shift
goto NEXTARG

:PA
set xpath= %xpath% -pa %1 
shift
goto NEXTARG

:RUNMOD
set runmod= -runmod %1 
shift
goto NEXTARG

:HUP
set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl hup 
goto NEXTARG

:STOP
set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl stop 
goto NEXTARG

:LS
set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl ls 
goto NEXTARG

:STATUS
set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl status 
goto NEXTARG

:LOAD
"%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl load %id% %1 %2 %3 %4 %5 %6 %7 %8 %9
goto END

:CTLTRACE
set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl trace %1 
shift
goto NEXTARG

:VERSION
"%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws printversion
goto END

:SNAME
set sname= -sname %1 
shift
goto NEXTARG

:NAME
set sname= -name %1 
shift
goto NEXTARG

:HEART
set heart= -heart 
goto NEXTARG

:PROTO
set pdist= -proto_dist %1 
shift
goto NEXTARG

:ERLARG
set erlarg=%erlarg% %1 
shift
goto NEXTARG

:CHECK
mkdir "%HOME%/.yaws/"
mkdir "%HOME%/.yaws/%id%"
"%erl%" -noshell -pa "%yawsdir%/ebin" %xpath% -s yaws_ctl check %id% %1 %2 %3 %4 %5 %6 %7 %8 %9
goto END

:ENDARGS

if NOT DEFINED ex goto NOEX
%ex% %id%
goto END
:NOEX

if "%id%"=="" goto NOID
set id=-yaws id %id%
:NOID

set trace=%trace% %traceoutput%

if "%daemon%%interactive%"=="" goto HELP

set XEC=%daemon% %heart% -pa "%yawsdir%/ebin" %xpath% %sname% %pdist% %erlarg% %debug% -s yaws %trace% %conf% %runmod% %mnesia% %id%

set HEART_COMMAND=
if "%heart%%daemon%"=="" goto NOHEART
echo set HEART_COMMAND="%erl%" %XEC%
set HEART_COMMAND="%erl%" %XEC%

:NOHEART
echo "%erl%" %XEC%
"%erl%" %XEC%
goto END

:HELP
echo "usage:  "
echo ""

echo "       yaws -i | --interactive         -- interactive (no daemon) mode"
echo "       yaws -w | --winteractive        -- interactive (werl) "
echo "       yaws --daemon                   -- daemon mode"

echo ""

echo ""
echo "       Auxilliary flags for the daemon: "
echo "            --id Id          --  Set system id"
echo "            --debug          --  debug mode "
echo "            --conf File      --  set config file"
echo "            --tracetraf      --  trace traffic"
echo "            --tracehttp      --  trace http traffic"
echo "            --traceout       --  trace output to stdout"
echo "            --version        --  print version"
echo "            --pa path        --  add load path"
echo "            --mnesiadir dir  --  start Mnesia in dir"
echo "            --proto_dist Mod     --  use Mod for distrib"
echo "            --sname xxx      --  start with sname xxx"
echo "            --name xxx       --  start with name xxx"
echo "            --runmod mod     --  call mod:start/0 at startup"
echo "            --heart          --  auto restart yaws if it crashes"
echo "            --erlarg X       --  pass argument X to $erl"

echo ""

echo "ctl functions ... "
echo "        yaws --hup [--id ID]       -- hup the daemon, reload conf"
echo "        yaws --stop [--id ID]     -- stop the daemon"
echo "        yaws --status [--id ID]    -- query the daemon status"
echo "        yaws --load Modules        -- load modules"
echo "        yaws --ls                  -- list Yaws nodes and their status"
echo "        yaws --ctltrace traffic|http    -- toggle trace of running daemon"
echo "        yaws --check YawsFile [IncDirs] -- test compile File"

:END
endlocal



Robby

--
r fullstop raschke around tombob fullstop com


_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list