Sunday, February 21, 2010

Setting Up Alice and Wonderland on Windows

At Sommet, we have been exploring several interesting technologies, some of which include Erlang and RabbitMQ.  RabbitMQ (An open source enterprise messaging system, built in Erlang, and based on the AMQP standard) has thus far turned out to be most of what we could ask for in a messaging solution.  One small concern with using RabbitMQ in the enterprise is that it does not come out of the box with a user interface.  While this is not a complete deal breaker, it makes the case for RabbitMQ a little bit harder to accept.  Luckily, others have also seen this need and have been working on solutions.  One such solution is called Alice (A monitoring and REST interface for RabbitMQ) and Wonderland  (The front-end for Alice).

This week, Jim Cowart (@ifandelse) and I set out to get Alice and Wonderland up and running on our development machines/environments.  While there is documentation on the Alice GitHub site for getting started on Linux, we were unable to find anything on getting things going on windows (we have a need for both).  After several rounds of trial and error, we came up with a Windows batch file that takes you from start to finish.  Enjoy.     

Setting Up Alice and Wonderland on Windows

Installation Prerequisites:

- Erlang
- Git
- RabbitMQ

Setup Prerequisites:

- RabbitMQ must be running

An End-To-End Batch File:

The following lines can be placed in a Windows batch file such as emake.bat. It will retrieve Alice and Wonderland from GitHub, make/configure the projects, and finally launch Alice. A few notes: A compressed copy of the complete batch file is available here.  ERLANG_HOME and GIT_HOME can be set directly in this batch file or setup as environment variables. Once everything has been built/setup for the first time, Alice can be started with the following line:

"C:\Program Files\erl5.7.4\bin\erl.exe" -pa ./ebin -pa ./deps/*/ebin -sname alice -s reloader -boot alice

Finally, once this original batch file runs and Alice starts successfully, navigate to to see the Wonderland UI.

REM Make sure that this batch file is in the desired parent directory for Alice

if "%ERLANG_HOME%"=="" (
    set ERLANG_HOME=C:\Program Files\erl5.7.4

if "%GIT_HOME%"=="" (
    set GIT_HOME=C:\Program Files\Git

REM Git Alice GitHub
"%GIT_HOME%\bin\git.exe" clone git://
REM Move to the Alice directory
cd alice
REM copy the Emakefile file from the alice directory to the mochiweb directory
copy .\emakefile deps\mochiweb
REM Make Alice
"%ERLANG_HOME%\bin\erl.exe" -make
REM Create the boot file.
"%ERLANG_HOME%\bin\erl.exe" -pa ebin -noshell -run make_boot write_scripts alice
REM Move to the deps\mochiweb directory
cd .\deps\mochiweb
REM Make Mochiweb
"%ERLANG_HOME%\bin\erl.exe" -make
REM Copy the Mochiweb beams to the alice ebin directory
copy .\ebin\*.* ..\..\ebin
REM Move back to the alice directory
cd ..\..
REM Make the alice\web directory
mkdir web
REM Move to the web directory
cd web
REM Git Wonderland
"%GIT_HOME%\bin\git.exe" clone git://
REM Move back to the alice directory
cd ..
REM Start Alice
"%ERLANG_HOME%\bin\erl.exe" -pa ./ebin -pa ./deps/*/ebin -sname alice -s reloader -boot alice