Micro and Nano Mechanics Group
Revision as of 17:58, 18 January 2008 by Kwkang (Talk)

Let's assume that we want to create more than one Subversion (SVN) repository and SVN users may or may not access to each repository depending on their authorization. This webpage will explain how to configure Subversion and ViewVC settings under the circumstance of Apache HTTP server.


For simplicity, let's say we have two repositories REPO_A and REPO_B. Now we start to edit couple of things in the ViewVC configuration file, viewvc.conf

  1. Specify svn_roots, which says the absolute path to each repository and assigns a name, such as
    svn_roots = REPO_A: /PATH/TO/REPO_A,
                REPO_B: /PATH/TO/REPO_B
    

    Here /PATH/TO/REPO_A and /PATH/TO/REPO_B should be replaced appropriately according as where each repository is located in your system. The repository name and the directory name of the repository do not need to be same.

  2. Comment out root_parents.
  3. Activate root_as_url_component, which interpretes the first path component <ref>To know what is the first path component in the URL after the script location, refer ViewVC 1.1 URL Reference. You can download url-reference.html from http://viewvc.tigris.org/source/browse/viewvc/branches/1.0.x/docs/</ref> in the URL after the script location as the root to use.
    root_as_url_component = 1     
    

    By activating this option, the website URL becomes natural. What it means by "natural" is, for example, I can view the REPO_A by typing http://micro.stanford.edu/ViewVC/REPO_A in the web browser. Otherwise, it would be like http://micro.stanford.edu/ViewVC/?root=REPO_A.

  4. Specify docroot, a web path to a directory that contains ViewVC static files (stylesheets, images, etc.).
    docroot = /viewvc/docroot
    

    Make sure that this is a (alias) web path which is defined in the HTTP configuration file, httpd.conf.

In httpd.conf, you also have a few things to change.

  1. Define an alias docroot and its absolute path, which will be used in viewvc.conf, by inserting
    Alias /viewvc/docroot /usr/local/viewvc-1.0.4/templates/docroot
    

    inside of the alias module <IfModule alias_module> ... </IfModule>. Then you have to provide a <Directory> section to allow access to the filesystem path.

    <Directory /usr/local/viewvc-1.0.4/templates/docroot>
        Order allow,deny
        Allow from all
    </Directory>
    
  2. Use ScriptAlias directive to map a URL to viewvc.cgi script which is not in the DocumentRoot directory.
    ScriptAlias /viewvc/REPO_A "/usr/local/viewvc-1.0.4/bin/cgi/viewvc.cgi/REPO_A"
    ScriptAlias /viewvc/REPO_B "/usr/local/viewvc-1.0.4/bin/cgi/viewvc.cgi/REPO_B"
    

    inside of the alias module <IfModule alias_module> ... </IfModule>. Again, you need to allow the access to the script directory.

    <Directory /usr/local/viewvc-1.0.4/bin/cgi>
        Order allow,deny
        Allow from all
    </Directory>
    

    Typing URL such as http://micro.stanford.edu/viewvc/REPO_A runs internally viewvc.cgi and opens the repo REPO_A in the browser. If you prefer lowercase URL, you may add the following line additionally.

    ScriptAlias /viewvc/repo_a "/usr/local/viewvc-1.0.4/bin/cgi/viewvc.cgi/REPO_A"
    

Notes

<references/>