How to setup the PiVM

1. Lizenses
-----------
You can use the PiVM in terms of the GPL Version 3 or later.
The PiVM uses the Little Lexer from John Carter and Xenodot from Hagen Overdick as aggregates. Little Lexer can be used under the terms of the GPL version 2.1 or later and Xenodot can be uesed under the terms of the MIT license.

2. Basics
---------

The PiVM was constructed in a modular fashion. Most modules and classes of the PiVM are abstract calsses, the queue for example, and an backend have to be choosen, that implement these methods.
With this very first release, only one backend builded on top of xenodot is shipped. Xenodot realize a Document Object Model (DOM) in a persistent way and uses PostgreSQL as database backend. If you intend to use Xenodot the following prerequisites have to be fullfilled:

3. Requirements for Xenodot
---------------------
Dependencies

  Xenodot require the following packages to be installed:

   1. Postgresql 8.2 or greater
   2. Ruby 1.8.6 or greater
   3. Rubygems 0.9.0 or greater
   4. htree from here http://www.a-k-r.org/htree/htree-0.6.tar.gz
   5. plruby 0.5.0 or greater
          * can be downloaded from ftp://moulon.inra.fr/pub/ruby/plruby.tar.gz
          * plruby has to be build with the flag --with-safe-level=0 
   6. The following gems are needed
          * rake
          * rspec
          * activerecord 1.15.0 or greater, but less then 2.0.0
          * builder 2.0.0 or greater
          * ruby-postgres
          * cgi_multipart_eof_fix
          * mongrel 

  Setting up Postgresql

   1. Start postgresql (On Gentoo with '/etc/init.d/postgresql start')
   2. Login with 'psql -U postgres -d postgres'
   3. Create the user xenodot with 'create user xenodot superuser;'
   4. Quit with '\q' 

   Xenodot itself is included in the PiVM package

4. Installing PiVM
------------------
Get the PiVM via Subversion:

svn co svn://svn.hpi.uni-potsdam.de/pivm

Put the PiVM into the Ruby path. On linux put it here:

/usr/lib/ruby/site_ruby/1.8/pivm

Put the file pivm.rb from the pivm directory here:
/usr/lib/ruby/site_ruby/1.8/pivm.rb

Go to the pivm directory and initialize the database:
'rake cleandb'
'rake migrate'

To run some tests, use:
'rake spec'
and to start the server, type:
'rake server'
Per default it uses port 3000. To change the server settings edit the file lib/server.rb
The server loads the example described in the appendix of my master thesis.
After the server started, open your browser and try

http://localhost:3000/vm/broker

(substitute localhost when the name of the server, when is did not run on your local mashine)
Here you can register and deregister banks.
At startup, the server loads the π-process from the file 

test/server_data.pi


5. Trouble Shooting
-------------------
I have had problems with plruby compiled on a 'hardened' server. If you see something like:
'createdb: konnte nicht mit Datenbank postgres verbinden: FATAL:  das Datenbanksystem startet'
try to compile plrub on a non hardened system.

For any other problem or question, feel free to contact me at okax@gmx.de