Erlang for everyday use (2)

Posted by stoyan

Common Crap

After the first article there was more then 1500 hits. And interesting, maybe about 80% of them coming from RubyCorner ! Feedback: near to zero – just several comments on the blog and on reddit . Nothing to improve? Nothing to add? Hm, so it’s real:

Web 2.0 is about voting. It make you stupid!

OK. Cut the crap and let’s go on the topic

Install yaws

Hopefully you already have the CEAN installed . Next good thing is to install yawsHTTP high performance 1.1 webserver particularly well suited for dynamic-content webapplications (something like a mongrel for Erlang ;) )
1> cean:install(yaws).
+ ibrowse md5=<<212,78,39,29,222,40,222,24,91,65,162,253,27,109,180,42>>
+ compiler md5=<<19,177,55,189,37,11,164,23,75,115,129,152,51,24,167,234>>
+ inets md5=<<41,196,119,166,237,121,195,180,130,134,225,129,36,167,207,153>>
+ ssl md5=<<75,245,109,43,92,129,104,171,158,38,157,214,21,117,107,3>>
+ tools md5=<<15,253,151,211,133,14,99,68,114,47,193,244,20,251,111,76>>
+ xmerl md5=<<60,100,38,136,168,113,16,236,239,184,152,155,148,148,37,112>>
+ xmlrpc md5=<<158,3,240,16,89,215,193,84,48,248,191,58,98,30,54,53>>
+ yaws md5=<<88,53,90,204,22,201,30,118,182,116,117,36,67,251,39,191>>
ok
Create var/log , var/run and var/www INSIDE YOUR CEAN directory.
$ cd ~/cean
$ mkdir -p var/lib var/run var/www
Download the example config file and the yaws startup script (they are just modified versions from the Erlang sources, you can do this by yourself)
$ cd ~/cean
$ wget -O yaws.conf http://files.zhekov.net/yaws.conf.txt
$ cd ~/bin
$ wget -O yaws http://files.zhekov.net/yaws.txt && chmod 755 yaws
Correct the paths in the both files (##CEANDIR## , $CEANDIR, your $OSDIR – the default is linux-x86). Start yawsing
$ yaws -i -c ~/cean/yaws.conf 
Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.5.4  (abort with ^G)
1> 
=INFO REPORT==== 14-Jun-2007::12:45:01 ===
Yaws: Using config file /home/erl/cean/yaws.conf
yaws:Add path "/home/erl/cean/erlang/lib/yaws-1.68/ebin" 
yaws:Running with id=default
Running with debug checks turned on (slower server) 
Logging to directory "/home/erl/cean/var/log" 

=INFO REPORT==== 14-Jun-2007::12:45:01 ===
Yaws: Listening to 127.0.0.1:8080 for servers
 - http://localhost:8080 under /home/erl/cean/var/www

Next time: Erlang project directory structure and “makefile” a.k.a “Convention over Configuration”.

Comments

Leave a response

  1. ShaunJune 15, 2007 @ 05:33 AM

    Thanks for blogging about Erlang!

    I’m one of those 1,500 hits from RubyCorner who didn’t leave you any feedback on your first post. I’m a SQL Server DBA by background, with survival skills in VB and Perl. I liked Perl but it didn’t quite fit my brain. Dereferencing nested data structures was something I always had to look up.

    Right now I’m focused on getting spun up with PL/SQL (yuck) and Ruby (yeah). ANTLR will be probably be my next big skill set investment, since I keep finding myself doing parsing on every project.

    Erlang and Haskell are on my radar, so I enjoy reading about them, and letting code examples wash over me to get a feel for the languages. I’m planning to pick one of them to learn in 2008, and am casually reading about both to inform my decision.

    So, your posts are helpful to me, even though I’m not going to follow along at home.

    Thanks