| | 1 | [[PageOutline]] |
| | 2 | = Setting up a development environment for the Collaborative Democracy Workshop software = |
| | 3 | |
| | 4 | 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. It often assumes you're running a debian-derived variant of the GNU/Linux operating system. If you have another development environment you'd like to see documented, feel free to add instructions for that environment here. |
| | 5 | |
| | 6 | == setting up the dependencies == |
| | 7 | |
| | 8 | 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: |
| | 9 | |
| | 10 | {{{ |
| | 11 | sudo aptitude install libapache2-mod-php5 php5-sqlite subversion apache2 sqlite3 |
| | 12 | }}} |
| | 13 | |
| | 14 | == check out a working copy of the software == |
| | 15 | |
| | 16 | 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). |
| | 17 | |
| | 18 | {{{ |
| | 19 | sudo mkdir -p /srv/ir |
| | 20 | sudo chown $(whoami) /srv/ir |
| | 21 | svn co https://svn.mayfirst.org/mfpl/trunk/ir /srv/ir |
| | 22 | }}} |
| | 23 | |
| | 24 | (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`) |
| | 25 | |
| | 26 | == setting up a name-based virtual host == |
| | 27 | |
| | 28 | 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: |
| | 29 | |
| | 30 | {{{ |
| | 31 | sh -c 'echo 127.0.2.1 ir.test >> /etc/hosts' |
| | 32 | }}} |
| | 33 | |
| | 34 | 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): |
| | 35 | {{{ |
| | 36 | <VirtualHost *:80> |
| | 37 | ServerAdmin webmaster@mayfirst.org |
| | 38 | ServerName ir.test |
| | 39 | |
| | 40 | DocumentRoot /srv/ir/web |
| | 41 | <Directory /> |
| | 42 | Options FollowSymLinks |
| | 43 | AllowOverride None |
| | 44 | </Directory> |
| | 45 | <Directory /srv/ir/web> |
| | 46 | Options Indexes FollowSymLinks MultiViews |
| | 47 | AllowOverride None |
| | 48 | Order allow,deny |
| | 49 | allow from all |
| | 50 | </Directory> |
| | 51 | |
| | 52 | ErrorLog /var/log/apache2/error.log |
| | 53 | |
| | 54 | # Possible values include: debug, info, notice, warn, error, crit, |
| | 55 | # alert, emerg. |
| | 56 | LogLevel info |
| | 57 | |
| | 58 | CustomLog /var/log/apache2/access.log combined |
| | 59 | </VirtualHost> |
| | 60 | }}} |
| | 61 | |
| | 62 | On debian systems, you would enable this virtual host with: |
| | 63 | |
| | 64 | {{{ |
| | 65 | sudo a2ensite ir.test |
| | 66 | }}} |
| | 67 | |
| | 68 | == Create the sqlite database == |
| | 69 | |
| | 70 | The sqlite database needs to be in a directory writable by the web server. Here's a way to do that with debian: |
| | 71 | |
| | 72 | {{{ |
| | 73 | touch /srv/ir/db/db.sqlite |
| | 74 | sudo chgrp -R www-data /srv/ir/db |
| | 75 | chmod -R g+rwx /srv/ir/db |
| | 76 | }}} |
| | 77 | |
| | 78 | == Setting up the configuration == |
| | 79 | |
| | 80 | Now you need to configure the web application: |
| | 81 | |
| | 82 | {{{ |
| | 83 | cp /srv/ir/docs/conf.php.sample /srv/ir/conf.php |
| | 84 | }}} |
| | 85 | |
| | 86 | Edit the contents of `/srv/ir/conf.php` to point to the correct source directory, and the actual database you've set up. |
| | 87 | |