[[PageOutline]] = Setting up a development environment for the Collaborative Democracy Workshop software = The [wiki:internet_rights_workshop 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 [wiki:mfpl_certificate_authority 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): {{{ ServerAdmin webmaster@mayfirst.org ServerName ir.test DocumentRoot /srv/ir/web Options FollowSymLinks AllowOverride None 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 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 }}} 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, [/newticket 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 [http://www.wampserver.com/ 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 [http://tortoisesvn.tigris.org/ Tortoise SVN]. == Macintosh == This is a start for the Macintosh documentation. The first step is to download [http://www.mamp.info 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.