notes on getting a local install of journalisted.com up and running...
Prequisites
-----------
apache
- version not too important
- need mod_rewrite, php
- other webservers might work (eg IIS)
postgresql
- not too fussy about version (Currently using 8.2)
php
- php5 (php4 _might_ work also...)
- postgresql bindings
- HTML_QuickForm (used by admin pages only)
- needs to be able to run from commandline, as well as webserver
python2.4
- psycopg postgresql bindings (we used to use PyPgSQL)
mySociety phplib and pylib
- available from their CVS
xapian (for the full text index)
- php5 bindings
- python bindings
On Ubuntu/Debian, this basically boils down to:
$ apt-get install apache2 cvs libapache2-mod-php5 postgresql php5 php5-cli php5-pgsql python2.4 python-psycopg2 php5-xapian python-xapian xapian-tools
$ svn checkout http://journa-list.googlecode.com/svn/trunk/ journa-list
$ cd journa-list
$ export CVSROOT=":pserver:anonymous@cvs.mysociety.org:/repos"
$ cvs checkout -d phplib mysociety/phplib
$ cvs checkout -d pylib mysociety/pylib
Setting up all this is much more fiddly under Windows and Mac, but can
definitely be done. Windows users can do the CVS parts by e.g. installing
TortoiseCVS and doing:
> path c:\Program Files\TortoiseCVS\;%PATH%
> set CVS_RSH=TortoisePlink.exe
> set CVSROOT=:pserver:anonymous@cvs.mysociety.org:/repos
> cvs checkout -d phplib mysociety/phplib
> cvs checkout -d pylib mysociety/pylib
DB Setup
--------
Note that the --no-superuser and --no-createrole flags are only available
in Postgres 8.2 and higher, omit them for older version.
$ sudo createuser -U postgres --no-superuser --createdb --no-createrole mst
$ sudo psql -U postgres -c "alter user mst with password 'mstPass'"
$ sudo pg_ctl reload -D /etc/postgresql/8.2/main/
(Windows: pg_ctl reload -D "C:\Program Files\PostgreSQL\8.2\data\")
Test:
$ psql -U mst -l
with password "mstPass".
Further info:
http://wiki.rubyonrails.org/rails/pages/PostgreSQL
http://webpy.org/install_macosx
DB Setup in Ubuntu 6.06 + Postgres 8.1
---------------------------------------
The above didn't work for me, here's what did after apt-get had performed
the initial install (also see https://help.ubuntu.com/community/PostgreSQL)
$ sudo -u postgres psql template1
ALTER USER postgres WITH ENCRYPTED PASSWORD ' <***password***> ';
\q
$ sudo -u postgres createuser -D -A -P mst
$ sudo -u postgres createdb -E latin-1 -O mst mst
groupadd msg
useradd -m -g mst -s /bin/bash mst
sudo -u postgres psql -c "CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;"
sudo -u mst psql mst -f schema.sql
sudo -u mst psql mst -f basedata.sql
the last commands produces some errors:
psql:basedata.sql:6: ERROR: parameter "standard_conforming_strings" cannot be changed
psql:basedata.sql:25: ERROR: relation "organisation" already exists
psql:basedata.sql:61: ERROR: multiple primary keys for table "organisation" are not allowed
Apache
------
Set up HOSTS file to map journalisted.dev to localhost.
(add the line "127.0.0.1 journalisted.dev" to
\WINDOWS\system32\drivers\etc\hosts on Windows, /etc/hosts on Unix.)
Add new file, /etc/apache2/sites-available/www.journalisted.dev:
ServerName www.journalisted.dev
ServerAlias journalisted.dev *.journalisted.dev
DocumentRoot /home/ben/proj/journa-list/jl/web
Additional settings you may need/want to add before :
# Allow using index.php
DirectoryIndex index.html index.php
# Seems to be needed to allow using mod_rewrite
Options All
AllowOverride All
# Where to store the logs
ErrorLog logs/journalisted-error_log
CustomLog logs/journalisted-access_log common
Enable the site with:
$ sudo a2ensite www.journa-listed.dev
Make sure mod_rewrite is enabled:
$ sudo a2enmod rewrite
Tell apache to reread the configuration:
$ sudo /etc/init.d/apache2 reload
PHP
---
Run "php --ini" to locate the configuration file to change.
Make sure it has these settings set:
; Enable the PHP scripting language engine under Apache.
engine = On
; Allow using "" to open PHP script blocks.
short_open_tag = On
; A deprecated feature that we use (pass-by-reference in function calls).
allow_call_time_pass_reference = On
; We don't currently support running in PHP's Safe Mode sandbox.
safe_mode = Off
Site Config
-----------
$ cd journa-list/jl
$ cp conf/general.example conf/general
$ cp conf/httpd.conf web/.htaccess
Check settings in conf/general. In particular, check the postgresql port
number against your postgresql.conf