wiki:internet_rights_workshop/setup

Setting up a development environment for the Collaborative Democracy Workshop software

The collaborative democracy workshop uses a web application to facilitate its process. That web application is under regular development, and we welcome contributions and collaboration from interested developers. This page describes how to set up a development environment.

Debian GNU/Linux

setting up the dependencies

Make sure you have installed subversion, php5, sqlite, and a web server of your choice (most folks use apache, but there are lots of other ways to go). On a debian-derived system, you could do:

sudo aptitude install libapache2-mod-php5 php5-sqlite subversion apache2 sqlite3

check out a working copy of the software

This example puts the software in /srv/ir, but you can put it wherever makes sense to you (remember that the web server should be able to get to it).

sudo mkdir -p /srv/ir
sudo chown $(whoami) /srv/ir
svn co https://svn.mayfirst.org/mfpl/trunk/ir /srv/ir

(note that the subversion repository's TLS certificate is currently signed by the May First/People Link certificate authority, and has an SHA1 fingerprint of 1D:88:9F:17:15:A1:B1:B6:11:FD:A5:67:08:D9:89:68:BD:C8:D0:DD)

setting up a name-based virtual host

pick a virtual host name where this software will run, and bind it to a local loopback IP address that your web server is listening on. I've chosen the name ir.test, and i'm binding to 127.0.2.1:

sh -c 'echo 127.0.2.1 ir.test >> /etc/hosts'

Tell your web server to respond to that hostname based on the filesystem tree found at /srv/ir/web. For apache2 on debian, you can do this by putting the following file in /etc/apache2/sites-available/ir.test (in other distributions, you may need to insert this information elsewhere into the apache config):

<VirtualHost *:80>
	ServerAdmin webmaster@mayfirst.org
	ServerName ir.test
	
	DocumentRoot /srv/ir/web
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /srv/ir/web>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all

		RewriteEngine on
		RewriteBase /

		RewriteRule ^json$ ?area=json&%{QUERY_STRING}
		RewriteRule ^state$ ?area=state
		RewriteRule ^board$ ?mode=board
		RewriteRule ^right([[:digit:]]*)$ ?area=right&mode=edit&rid=$1&%{QUERY_STRING}
		RewriteRule ^endorse$ ?area=right&mode=endorse
		RewriteRule ^rescind$ ?area=right&mode=rescind
		RewriteRule ^lang.([[:alpha:]_-]+)$ ?lang=$1

	</Directory>

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel info

	CustomLog /var/log/apache2/access.log combined
</VirtualHost>

On debian systems, you would enable this virtual host and make sure that mod_rewrite is working with:

sudo a2ensite ir.test
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

Create the sqlite database

The sqlite database needs to be in a directory writable by the web server. Here's a way to do that with debian:

touch /srv/ir/db/db.sqlite
sudo chgrp -R www-data /srv/ir/db
chmod -R g+rwx /srv/ir/db

Setting up the configuration

Now you need to configure the web application:

cp /srv/ir/docs/conf.php.sample /srv/ir/conf.php

Edit the contents of /srv/ir/conf.php to point to the correct source directory, and the actual database you've set up. You'll need to set an end time for your workshop, and choose distinct group and monkey passwords for each room you've designated.

Testing it out

Point your web browser at http://ir.test/ and run with it!

Following the development

As changes get pushed into the repository, you'll want to keep up with them. You can bring your local working copy up-to-date with:

svn update /srv/ir

Committing changes

The above setup gives you the ability to follow the course of development and to make changes to your working copy. If you've made changes that you think should be part of the main development branch, you'll need a commit access to the svn repository. If you don't have that access already, open a ticket requesting access to the MF/PL SVN repo. You'll need an SSH key for this. Once you've been granted access, switch your local working copy over to access the repository via ssh instead of https:

cd /srv/ir
svn switch --relocate https://svn.mayfirst.org/mfpl/trunk/ir svn+ssh://mfpl@svn.mayfirst.org/trunk/ir

Now you can commit your changes like this:

cd /srv/ir
svn commit

svn will pop up an editor for you to write notes about the changes you're making. This helps everyone else (and yourself, two months from now!) understand the intent behind the changes.

Microsoft Windows

This is a start for the Windows documentation. The first step is to download Wamp Server (which provides Apache, PHP, and MySQL). You won't actually need MySQL, however, I still think this package is probably the easiest was to get Apache and PHP and it should come with Sqlite support built-in.

To use subversion, you can download Tortoise SVN.

Macintosh

This is a start for the Macintosh documentation. The first step is to download Mamp Server (which provides Apache, PHP, and MySQL). You won't actually need MySQL, however, I still think this package is probably the easiest was to get Apache and PHP and it should come with Sqlite support built-in.

Last modified 11 years ago Last modified on Jan 27, 2009, 3:23:01 AM