Gruta Installation Guide
========================

This document contains a brief guide for the installation of Gruta,
the web content management system.

Installation steps
------------------

Install the Artemus and Grutatxt modules, available from:

 - http://triptico.com/software/artemus.html
 - http://triptico.com/software/grutatxt.html

You'll need at least Artemus 5.0.2 and Grutatxt 2.0.16 (please take
note that these versions may be development ones, so you might need
to download them from the Git repository).

If you want to use the DBI source driver, you'll need DBI and a
corresponding DBD, of course. SQLite is fine and probably what
you want.

These other Perl modules will be used if installed:

 - Image::Size (to include image sizes in `img' tags)
 - RPC::XML::Client (to use blogspam.net comment spam checks)
 - Net::Akismet (to use Akismet comment spam checks)

Install Gruta's package:

    $ perl Makefile.PL && make && su -c "make install"

Execute the `gruta-mksite' script as the user the web server daemon runs
as, for example `www-data' under Debian. Answer all the questions and
a suitable directory tree will be created. If you answer affirmatively
to the 'static urls' question, be sure to include the URL rewriting
instructions suitable to your webserver (see below).

Now your web server daemon should be instructed to use `g.cgi' (the
Gruta entry CGI program) as the directory index. Again, see below for
webserver configuration examples.

Point your browser to the URL. As it's the first time, an `admin' user
with a random password has been created and the program flow redirected
to the administration page. Select the `admin' user from the _Users_ section
and set a new password. After that, move to the _Configuration_ section and
make all the changes you need.

Create some topics. New topics will appear in the top menu. Clicking on
them will allow you to create new stories. If you create a topic with the
topic id `info', the stories with ids `about' and `legal' will be magically
added to the top header. For the rest of your stories, create another topic.
One with id `main' will be OK.

Webserver configuration examples
--------------------------------

apache
~~~~~~

 
 # directory index
 DirectoryIndex g.cgi
 
 # protect the 'var' subdirectory (the Gruta raw
 # storage depot) from being served via web
 <Location /var>
     order allow,deny
     deny from all
 </Location>
 
 # static URL rewriting instructions
 RewriteRule ^/([0-9]+)\.html$          /?t=INDEX&offset=$1              [PT,L]
 RewriteRule ^/([0-9]+)-([0-9]+)\.html$ /?t=SEARCH_BY_DATE&from=$1&to=$2 [PT,L]
 RewriteRule ^/tag/(.+)\.html$          /?t=SEARCH_BY_TAG&tag=$1         [PT,L]
 RewriteRule ^/tag/$                    /?t=TAGS                         [PT,L]
 RewriteRule ^/top/$                    /?t=TOP_TEN                      [PT,L]
 RewriteRule ^/([0-9]{8})/$             /?t=SEARCH_BY_DATE;from=$1000000;to=$1235959 [PT,L]
 RewriteRule ^/(.+)/$                   /?t=TOPIC&topic=$1               [PT,L]
 RewriteRule ^/(.+)/index\.html$        /?t=TOPIC&topic=$1               [PT,L]
 RewriteRule ^/(.+)/~([0-9]+)\.html$    /?t=TOPIC&topic=$1&offset=$2     [PT,L]
 RewriteRule ^/(.+)/(.+)\.html$         /?t=STORY&topic=$1&id=$2         [PT,L]
 RewriteRule ^/rss\.xml$                /?t=RSS                          [PT,L]
 RewriteRule ^/rss-comments\.xml$       /?t=RSS_COMMENTS                 [PT,L]
 RewriteRule ^/sitemap\.xml$            /?t=SITEMAP                      [PT,L]
 RewriteRule ^/style\.css$              /?t=CSS                          [PT,L]

lighttpd
~~~~~~~~

 
 # activate CGIs and set g.cgi as index
 cgi.assign = ( ".cgi" => "" )
 index-file.names = ( "g.cgi" )
 
 # protect the 'var' subdirectory (the Gruta raw
 # storage depot) from being served via web
 url.access-deny = ( "/var" )
 
 # static URL rewriting instructions
 url.rewrite-once = (
    "^/([0-9]+)\.html$"          => "/?t=INDEX;offset=$1",
    "^/([0-9]+)-([0-9]+)\.html$" => "/?t=SEARCH_BY_DATE;from=$1;to=$2",
    "^/tag/(.+)\.html$"          => "/?t=SEARCH_BY_TAG;tag=$1",
    "^/tag/$"                    => "/?t=TAGS",
    "^/top/$"                    => "/?t=TOP_TEN",
    "^/([0-9]{8})/$"             => "/?t=SEARCH_BY_DATE;from=$1000000;to=$1235959",
    "^/(.+)/$"                   => "/?t=TOPIC;topic=$1",
    "^/(.+)/index\.html$"        => "/?t=TOPIC;topic=$1",
    "^/(.+)/~([0-9]+)\.html$"    => "/?t=TOPIC;topic=$1;offset=$2",
    "^/(.+)/(.+)\.html$"         => "/?t=STORY;topic=$1;id=$2",
    "^/rss\.xml$"                => "/?t=RSS",
    "^/rss-comments\.xml$"       => "/?t=RSS_COMMENTS",
    "^/sitemap\.xml$"            => "/?t=SITEMAP",
    "^/style\.css$"              => "/?t=CSS"
 )

---
Angel Ortega <angel@triptico.com>
