Monday, December 24, 2012

Install and configure Trac in alwaysdata.com web site

I followed this steps to install Trac in the alwaysdata.com web site:

The main manual is from this page:

http://forum.alwaysdata.com/viewtopic.php?pid=3218#p3218

PYTHONPATH=~/modules easy_install-2.5 --install-dir ~/modules Genshi==0.6
PYTHONPATH=~/modules easy_install-2.5 --install-dir ~/modules Trac==1.0
./trac-admin /home//www/trac/myproject initenv
./trac-admin /home//www/trac/myproject deploy /tmp/deploy 
mv /tmp/deploy/* /home//www/trac
 
Section 5: Small modification
#!/usr/bin/eval PYTHONPATH=/home//modules TRAC_ENV=/home//www/trac/myproject python

Section 6: Small modification
AddHandler fcgid-script .fcgi

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/trac.fcgi/$1 [QSA,L] 

I also had to solve some issues reported here:
http://forum.alwaysdata.com/viewtopic.php?id=1601

To configure Trac authentication (Trac works with apache authentication) I followed:
http://trac.edgewall.org/wiki/TracModWSGI#ConfiguringAuthentication

$ htpasswd -c /somewhere/trac.htpasswd admin
New password: 
Re-type new password: 
Adding password for user admin


$ htpasswd /somewhere/trac.htpasswd john
New password: 
Re-type new password: 
Adding password for user john

The final .htaccess file is the following:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/trac.fcgi/$1 [QSA,L]

    AuthType Basic
    AuthName "trac"
    AuthUserFile /home//www/trac/trac.htpasswd
    Require valid-user