                  Archiwe Installation and Configuration

0. Hakmatak must be installed and configured first. It is available at
http://pypi.python.org/pypi/hakmatak

1. Installation

After obtaining archiwe-X.X.X.tar.gz, do the following:

$ tar zxvf archiwe-X.X.X.tar.gz
$ cd archiwe-X.X.X

As root, do

# python setup.py install

Besides modules, two command line tools are installed:
archiweread and archiwewrite.

To test, find a zip file under ./data/zip inside archiwe-X.X.X, and run

$ archiweread --type zip ./data/zip/simple.zip "/"

The zip file is parsed as w10n type "zip" and the
meta information of tree root is returned in JSON format.
For more about w10n, please read ./doc/w10n.txt in Hakmatak source package.

Currently Archiwe contains store readers and writers for two w10n types:
"zip" and "tar". File formats handled include
zip|jar|egg|tar|tgz|tar\.(gz|bz2)
For applications handling other w10n types, please check http://hakmatak.org.

2. Web Service Configuration

Included in Archiwe source are two web applications:
(a) archiwe/wsgi/index.py
a directory listing service application that checks for webifiable entries.
(b) archiwe/wsgi/webify.py
a w10n service application that webifies supported data stores.

Both can be set up as either CGI or WSGI application.
When configured for Apache web server, mod_rewrite is used to
rewrite w10n URLs into ones suitable for archiwe/wsgi/webify.py.

2.1 CGI on Apache

Warning: CGI and WSGI are mutually exclusive in operation.
If you want to set up WSGI, jump to Section 2.2 below directly.

Assuming a linux host with default Apache httpd installation,
listed below are the steps to configure archiwe-0.9.0. Please adjust
accordingly for a newer version of Archiwe.

(1) You must have properly installed/configured Hakmatak CGI.
Otherwise do that first.

(2) As user "webifier", create dir /home/webifier/wsgi/archiwe and
copy {index,webify}.py in Archiwe source to it,

$ mkdir -p /home/webifier/wsgi/archiwe
$ cp -avi archiwe-0.9.0/archiwe/wsgi/index.py /home/webifier/wsgi/archiwe/
$ cp -avi archiwe-0.9.0/archiwe/wsgi/webify.py /home/webifier/wsgi/archiwe/

Make sure dir /home/webifier/wsgi/ is recursively readable
by Apache web server owner/user, usually, called "apache".

(3) Copy cgi.archiwe.conf in Archiwe source to /etc/httpd/conf.d/,

# cp -avi archiwe-0.9.0/supp/cgi.archiwe.conf /etc/httpd/conf.d/

and modify it per your requirement by following inline comments inside.

(4) Copy test files to /var/www/html/test/data,

# mkdir -p /var/www/html/test/data
# cp -avi archiwe-0.9.0/data/zip /var/www/html/test/data/

(5) Restart the web server,

# /etc/init.d/httpd restart

(6) Point your browser to http://localhost/test/data/zip/,
you should be able to see a list of files, of which some are labeled
as "webifiable" with an folder icon. Click on any one of them,
you can browse inside the file as it is webified following the w10n
specification.

2.2 WSGI on Apache

Warning: CGI and WSGI are mutually exclusive in operation.
If you want to set up CGI, go back to Section 2.1 above.

WSGI is considered as CGI replacement.

Assuming an rpm-based linux host with default Apache httpd installation,
listed below are the steps to configure archiwe-0.9.0. Please adjust
accordingly for a newer version of Archiwe.

(1) You must have properly installed/configured Hakmatak WSGI.
Otherwise do that first.

(2) As user "webifier", create dir /home/webifier/wsgi/archiwe and
copy {index,webify}.py in Archiwe source to it,

$ mkdir -p /home/webifier/wsgi/archiwe
$ cp -avi archiwe-0.9.0/archiwe/wsgi/index.py /home/webifier/wsgi/archiwe/
$ cp -avi archiwe-0.9.0/archiwe/wsgi/webify.py /home/webifier/wsgi/archiwe/

Make sure dir /home/webifier/wsgi/ is recursively readable
by Apache web server owner/user, usually, called "apache".

(3) Copy wsgi.archiwe.conf in Archiwe source to /etc/httpd/conf.d/,

# cp -avi archiwe-0.9.0/supp/wsgi.archiwe.conf /etc/httpd/conf.d/

and modify it per your requirement by following inline comments inside.

(4) Copy test files to /var/www/html/test/data,

# mkdir -p /var/www/html/test/data
# cp -avi archiwe-0.9.0/data/zip /var/www/html/test/data/

(5) Restart the web server,

# /etc/init.d/httpd restart

(6) Point your browser to http://localhost/test/data/zip/,
you should be able to see a list of files, of which some are labeled
as "webifiable" with an folder icon. Click on any one of them,
you can browse inside the file as it is webified following the w10n
specification.
