Edgewall Software

Changes between Initial Version and Version 1 of TracMultipleProjectsWindows


Ignore:
Timestamp:
May 12, 2005, 10:32:46 PM (19 years ago)
Author:
kevin.marino@…
Comment:

Multi Project Setup on Windows

Legend:

Unmodified
Added
Removed
Modified
  • TracMultipleProjectsWindows

    v1 v1  
     1Global – Window Setup ¶
     2This is the simplest case. With this procedure, you will be able to serve multiple Trac projects, using the same user accounts for every projects (permissions are still per project, but authentication is not). This procedure is based on the original procedure provided by the Trac team and the Initial install instructions at TracOnWindows.
     3
     4Note: *nix based directory references may not work for all settings. Often times a *nix relative or absolute reference needs to be replace with the drive letter and path for it to work in a Windows environment. Often times this can solve problems.
     5
     6Assumptions:
     7        Default install drive C:
     8        Directories as set in TracOnWindows install guide
     9        Configured not using a Virtual Host directive (am working on instructions for use of Virtual Host)
     10
     11Start out by creating a projects directory in your Document Root (C:/Program Files/Apache Group/Apache2/htdocs in this example). Projects will be accessed as http://hostname/projects/projectname. Create a directory in htdocs called, "projects". Copy trac.cgi to this projects/ directory together with a file named index.html (create if needed). This will be shown when users try to access nonexistent projects.
     12
     13Next create your Trac projects with trac-admin. In the original *nix multiple repositories install instructions the Trac projects need to reside in the same directory. The reference to the directory is the physical path, In this example we'll use c:/svn/ . Add the following to your Apache configuration:
     14
     15# RewriteCond removed at the moment since not needed
     16# Notice paths are physical location on hard drives
     17
     18RewriteEngine on
     19# Log settings uncomment these lines if you are having issues.
     20# RewriteLogLevel go from 0 to 9. 0 being off. Refer to Apache Docs on this
     21# RewriteLog should is physical location of log file
     22
     23# RewriteLogLevel 9
     24# RewriteLog "C:/Program Files/Apache Group/Apache2/logs/rewrite.log"
     25RewriteRule ^/projects/+$                       /projects/index.html [L]
     26#RewriteCond /var/lib/trac/$1                   -d   
     27RewriteRule ^/projects/([[:alnum:]]+)(/?.*)     /projects/trac.cgi$2 [S=1,E=TRAC_ENV:c:/svn/$1]
     28RewriteRule ^/projects/(.*)                     /projects/index.html
     29
     30Alias /trac "C:/Python23/share/trac/htdocs"
     31#or where you installed the trac htdocs
     32
     33#You have to allow people to read the files in htdocs
     34<Directory "C:/Program Files/Apache Group/Apache2/htdocs/projects/">
     35        AllowOverride None
     36        Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
     37        AddHandler cgi-script cgi
     38        Order allow,deny
     39        Allow from all
     40</Directory>
     41
     42<LocationMatch "/projects/[[:alnum:]]+/login">
     43        AuthType Basic
     44        AuthName "trac"
     45        AuthUserFile /path/to/trac.htpasswd
     46        Require valid-user
     47</LocationMatch>
     48Now, when you add another project, you don't need to edit any apache config. The only file you may want to edit is index.html to make it list the new project. If you think this is too much work, replace it with a python cgi script that does it for you.
     49tracd and TracModPython can also serve multiple projects.
     50Suggestion: In the second RewriteRule directive and in the LocationMatch directive, change [[:alnum:]] to [^/] because while [[:alnum:]] only matches an alpha-numeric character, [^/] matches any character that is not a slash. This change allows for, among other things, hyphens in project/directory names. Another possibility is to replace [[:alnum:]] with [[:alnum:]\-], which matches only an alphanumeric character or a hyphen (the backslash "escapes" the hyphen, which would otherwise have special meaning). The Apache 2.0 mod_rewrite documentation suggests referencing the Perl regular expression manual page (run perldoc perlre on a system where Perl is installed) for details on regular expressions. Note that it may be preferable to use a pattern that matches only characters suitable for directory names (and, thus, project names) that are valid for your particular installation.
     51