Sections
In this section
Computational Science and Engineering

174 Geology/Physics
UC Davis
One Shields Avenue
Davis, CA 95616

(530) 752-6298 phone
(530) 752-8894 fax

 
Computational Science and Engineering > Help > How-tos > Setup a Subversion repository and Trac website
Personal tools

Setup a Subversion repository and Trac website

This document describes how to create a new Subversion repository with Trac at CSE

Purpose

This document is intended for CSE systems administrators and describes how to manage the CSE Subversion server.

Prerequisities

There are a few options that need to be known before a new repository is created.

  • Repository name (aka the project short name) : This must not contain spaces or special characters.
  • SVN Authentication type : The SVN server supports either CSE account or Campus Kerberos account authentication not both.
  • TRAC Authentication type : The TRAC server supports either CSE account or Campus Kerberos account authentication not both.
  • Trac Admins : A list of usernames that have full access to TRAC including deleting wiki pages, etc.
  • Trac Anonymous Permissions : What permissions should anonymous users have? Can they read source code?

Step by step

Configure the mod_cas module

LoadModule cas_module    /usr/lib/apache2/modules/mod_cas.so

<IfModule mod_cas.c>
CASHost cas.ucdavis.edu
CASPort 443
CASLoginURL https://cas.ucdavis.edu/cas/login
CASTrustedCerts /etc/ssl/certs/IPS-IPSCABUNDLE.CRT
CASMethod GET
CASValidate /cas/validate
</IfModule>

Create a Subversion Repository

Once you have the repository name (for example myproject) you are ready to create a repository. Use the following steps to create a new repo.

  1. Log in to the subversion server ssh root@svn.cse.ucdavis.edu
  2. Create a new repository under /svn:
     # svnadmin create /svn/myproject
  3. Change ownership to the web server user:
    # chown -R www-data /svn/myproject
  4. Edit the apache conf (/etc/apache/sites-enabled/svn.cse.ucdavis.edu) and add the following:
            <Location /repo/myproject>
    AuthType Kerberos
    AuthName "My Project Repo"
    KrbAuthRealm UCDAVIS.EDU
    KrbServiceName HTTP
    Krb5Keytab /etc/krb5.keytab
    KrbMethodNegotiate on
    KrbMethodK5Passwd on
    KrbSaveCredentials off
    require valid-user
    </Location>
  5. Check the config for syntax errors and restart apache:
     # apache2ctl configtest
    # apache2ctl restart
  6. Test login, create the default directories, and import the trunk:
     user@host $ svn co https://svn.cse.ucdavis.edu/repo/myproject .
    user@host $ svn mkdir trunk
    user@host $ svn mkdir tags
    user@host $ svn mkdir branches
    user@host $ svn commit -m "added base directories"
    user@host $ cd ../myprojectsourcedir
    user@host $ svn import -m "New import" . https://svn.cse.ucdavis.edu/repo/myproject/trunk

Create a new TRAC database (optional)

Trac is useful for browsing source code and project management. Here is how you create a trac database.

  1. Log in to the subversion server ssh root@svn.cse.ucdavis.edu
  2. Create a new trac db under /svn:
     # trac-admin /trac/myproject initenv myproject sqlite:db/trac.db svn /svn/myproject /usr/share/trac/templates
  3. Correct the permissions to make anonymous users read-only and give admin privs to others:
     # trac-admin /trac/myproject permission remove anonymous TICKET_CREATE WIKI_CREATE WIKI_MODIFY TICKET_MODIFY
    # trac-admin /trac/myproject permission add adminusername WIKI_CREATE WIKI_MODIFY TICKET_CREATE TICKET_MODIFY TICKET_CHGPROP TICKET_APPEND
  4. Change ownership to the web server user:
     # chown -R www-data /trac/myproject
  5. Edit the apache conf (/etc/apache/sites-enabled/svn.cse.ucdavis.edu) and add the following:
            Alias /trac/myproject "/usr/share/trac/cgi-bin/trac.cgi"
    <Location "/trac/myproject">
    SetEnv TRAC_ENV "/trac/myproject"
    </Location>
    <Location "/trac/myproject/login">
    AuthType CAS
    AuthName "My Project Trac"
    require valid-user
    </Location>
  6. Check the config for syntax errors and restart apache:
     # apache2ctl configtest
    # apache2ctl restart
  7. Test the trac configuration by going to the URL: https://svn.cse.ucdavis.edu/trac/myproject. You should be able to see the source code after you click on "Browse Source".

Further information

If you need more help look at the documentation for Subversion and Trac.