Development

How to install your own version of GOV on your server

You will need:

Compatability with other operating systems

All Debian-based systems like for example Ubuntu should be mostly similar. Other brands of GNU/Linux will work, but you will have to modify the installation instructions for the differences. The same goes for other "Posix" variants like Mac os X, BSD, etc. It may even be possible to use the system om M$ Windows with some code modifications.

Questions and support

Questions will be answerd on the chat or forum. You can find us at #gov-online-voting on freenode.

Architecture overview

Application layer: GOV can use CAS and Json to connect to an external user database

Database layer: GOV uses Ritbase that implement an RDF-like interface to data, stored in a PostgreSQL database.

Web framework layer: Ritbase uses Paraframe that is built on Perl 5 with Template Toolkit and mod_perl.

Installation

Preparatory setup

Set up a working webserver, a working postgresql installation and a working MTA. Decide on a username to use for the installation. Your personal login account should be ok, or you can create one specifically for GOV. But do all your work logged in as the project user, except for the parts that need root access.

Apt is the system for installing components in a debian-based system. You may install some of the needed components by

govuser@mygov:~$ sudo apt-get install apache2 postgresql
govuser@mygov:~$ sudo apt-get install perl libapache2-mod-perl2 git

You may install GOV in a sub-directory on your web server or even in a user-directory. I will give examples for installation to the gov subdirectory to www.mygov.org pointing to the default document root of /var/www on your server. You should give yourself all the options by modifying /etc/apache2/sites-available/default replacing "AllowOverride None" with "AllowOverride All" in the "Directory /var/www/" section.

Create /var/www/gov and give ownership to your project user. You should be able to put up an index.html file (with any text content) in your directory and access it from your browser over the WWW. For example on www.mygov.org/gov/

Check that you can send emails using your MTA. You may check that by mailing yourself from the command line using the mail command.

Downloading the code

Give your project user write access in /usr/local. One way of doing this is adding your project user to the group staff and giving the group staff write access in /usr/local. Use git to download the needed projects to the directory:

govuser@mygov:/usr/local$ git clone git://para.se/paraframe
govuser@mygov:/usr/local$ git clone git://para.se/ritbase
govuser@mygov:/usr/local$ git clone git://para.se/email-classifier
govuser@mygov:/usr/local$ git clone git://para.se/gov

What the above means is that you in your shell console is logged in to your server mygov as your project user govuser and moved to the directory /usr/local. Standing in that directory you will run git with the given parameters as shown above. The project "email-classifier" is also downloaded here as it's one of the dependencies of ritbase.

Installation of Perl modules

GOV is using a whole lot of Perl modules. One exampleof a Perl module is Date::Manip. All Perl modules are availible on CPAN. You may search for and read Perl module documentation on search.cpan.org, but you should do the installation of Perl modules with Debian apt or the cpan command line program. Most installed perl modules comes with manual pages accessible through the man command, as in man Date::Manip.

Debian uses a naming standard for Perl module packages. For example, Date::Manip is packaged as libdate-manip-perl and the Perl module DateTime::Format::Pg is packaged as libdatetime-format-pg-perl. Not all Perl modules are packaged as debian packages. But you should use them if they exist.

The cpan command line program will download, compile, test and install any perl module for you. It will also download and isntall any dependencies. You may install all perl modules by using cpan, but you should use the debian packages if they are availible.

For a more pleasant cpan interface, you should install Term::ReadKey and Term::ReadLine::Perl by doing

govuser@mygov:~$ sudo apt-get install libterm-readline-perl-perl

Paraframe installation

Follow the instructions located in paraframe/INSTALL. In short:

  • Install the large amount of perl modules availible in Debian by using sudo apt-get install ...
  • Running perl Makefile.PL will trigger cpan to interactively install all the other needed modules.
  • Create the /etc/apache2/conf.d/paraframe configuration file.

You may run make test to see that everything was installed.

You may now continue with Ritbase.

Ritbase installation

Follow the instructions located in ritbase/README and ritbase/doc/INSTALL. In short:

  • Install the slightly less large amount of perl modules by using sudo apt-get install ...
  • You may skip the step abot setting up the DB. But do it if you want to run the tests.
  • Run perl Makefile.PL to make cpan install the rest of the dependencies.

The make test will actually create a database and run some tests on it. This is optional.

Email-Classifier installation

Follow the instructions located in email-classifier/README. In short:

  • perl Makefile.PL
  • sudo make install

The tests are not currently working. This is the only one of the four downloaded projects that should acctually be installed among your other Perl libraries.

GOV installation

/var/www/gov should be a symlink to /usr/local/gov/html. To do that:

$ cd /var/www

(The above '$' is just a symbol of the shell prompt. You should type what comes after that.)

Remove or move the gov dir if you created it before this.

$ mv gov gov.old
$ ln -s /usr/local/gov/html gov
$ cd /usr/local

Follow the instructions located in gov/INSTALL.

Those instructuctions should be sufficient. Please ask for help if needed.

 Documentation