Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 124 lines (80 sloc) 3.77 KB
* Email: angie@mysociety.org; WWW: http://www.mysociety.org
*
* $Id: INSTALL.txt,v 1.9 2009-03-12 11:58:53 tony Exp $
*
These instructions are based on getting the FOI site up and running on
Ubuntu and/or Debian.
It was last run using the Hardy Heron version of Ubuntu and on the
Parallels debian instance (2.6.18-4-686).
Commands are intended to be run via the terminal or over ssh.
1. Package Installation
-----------------------
Firstly, in terminal, navigate to the foi folder where this install guide lives.
Install the packages that are listed in config/packages using apt-get eg:
> sudo apt-get install `cat config/packages`
Some of the required packages only exist in the mysociety debian archive (or we
have updated versions there), so you will want to add that to your
/etc/apt/sources.list:
deb http://debian.mysociety.org etch main non-free contrib
deb-src http://debian.mysociety.org etch main non-free contrib
libgems-ruby1.8 has recently been replaced by rubygems1.8, so you may need to
update the packages file to reflect this, depending on your version.
2. Configure Database
---------------------
There has been a little work done in trying to make the code work with
other databases (e.g. SQLite), but the preferred database is PostgreSQL.
If you don't have it installed:
apt-get install postgresql postgresql-client
Now we need to set up the database config file to contain the name,
username and password of your postgres database.
* copy database.yml-example to database.yml in foi/config
* edit it to point to your local postgresql database in the development
and test sections and create the databases:
Become the 'postgres' user (sudo su - postgres)
psql template1
to get into command tool
\l to list databases
CREATE DATABASE foi_development encoding = 'SQL_ASCII';
CREATE DATABASE foi_test encoding = 'SQL_ASCII';
Make sure that the user specified in database.yml exists, and has full
permissions on this database. As they need the ability to turn off
constraints whilst running the tests they also need to be a superuser.
(See http://dev.rubyonrails.org/ticket/9981)
CREATE USER <username> WITH CREATEUSER;
ALTER USER <username> WITH PASSWORD '<password>';
GRANT ALL PRIVILEGES ON DATABASE foi_development TO <username>;
GRANT ALL PRIVILEGES ON DATABASE foi_test TO <username>;
3. Deployment
-------------
In the 'mysociety' directory above 'foi', run
> ./bin/rails-post-deploy foi
(This will need execute privs so chmod 755 if necessary)
This sets up directory structures, creates logs, etc.
Next, if you have a foi/config/rails_env.rb file, delete it, so that
tests run against our test database, rather than the development one.
(Otherwise, any data you create in development will be blown away every
time you run the tests.)
Next we need to create the index for the search engine (Xapian):
> ./script/rebuild-xapian-index
If this fails, the site should still mostly run, but it's a core
component so you should really try to get this working.
4. Run the Tests
----------------
Make sure everything looks OK:
> rake spec
If there are failures here, something has gone wrong with the preceeding
steps. You might be able to move on to the next step, depending on how
serious they are, but ideally you should try to find out what's gone
wrong.
5. Run the Server
-----------------
run the following to get the server running (may need to chmod 755 again)
> ./script/server --environment=development
or if you want the server to be available on the network and not just
on localhost tell it your ip address by running
> ./script/server --environment=development --binding=10.0.0.11
Obviously change 10.0.0.11 to your own IP address
5. Success
----------
The server should have told you the URL to access in your browser to see
the site in action.