wiki:SandBoxPac
Last modified 16 years ago Last modified on 07/09/09 14:36:37

This is just a page to practice and learn WikiFormatting.

Go ahead, edit it freely.

How to set up Trac

Installation

Currently we are using Trac 11.1 installed on a Debian OS.
First you need to install setuptools. After you download the .egg install it with:

sudo sh setuptools-0.6c9-py2.5.egg

Then you can install Trac executing:

sudo easy_install Trac
  • Usefull links

http://pypi.python.org/pypi/setuptools#installation-instructions
http://trac.edgewall.org/wiki/TracInstall
http://trac.edgewall.org/wiki/TracOnDebian

Setting up Postgresql

The trac database is under postgres with user "scs" and schema "trac".

  • Usefull links

http://www.postgresql.org/docs/7.4/interactive/user-manag.html
http://trac.edgewall.org/wiki/TracEnvironment

Setting up Plug-ins

  • Current Plug-ins

AdvancedTicketWorkflowPlugin http://trac-hacks.org/wiki/AdvancedTicketWorkflowPlugin
BackLinksMenu http://trac-hacks.org/wiki/BackLinksMenuMacro
HudsonTrac http://trac-hacks.org/wiki/HudsonTracPlugin
PrivateWikis http://trac-hacks.org/wiki/PrivateWikiPlugin
TicketSubmitPolicy http://trac-hacks.org/wiki/TicketModifiedFilesPlugin
TracAccountManager http://trac-hacks.org/wiki/AccountManagerPlugin
TracCustomRoadmap http://trac-hacks.org/wiki/CustomRoadmapPlugin
TracDiscussion http://trac-hacks.org/wiki/DiscussionPlugin
TracFullBlogPlugin http://trac-hacks.org/wiki/FullBlogPlugin
TracGoogleAnalytics http://trac-hacks.org/wiki/TracGoogleAnalyticsPlugin
TracIncludeMacro http://trac-hacks.org/wiki/IncludeMacro
TracRecaptchaRegister http://trac-hacks.org/wiki/RecaptchaRegisterPlugin
TracSpamFilter http://trac-hacks.org/wiki/SpamFilterPlugin
TracTicketDelete http://trac-hacks.org/wiki/TicketDeletePlugin
TracTocMacro http://trac-hacks.org/wiki/TocMacro
TypedTicketWorkflow http://trac-hacks.org/wiki/TypedTicketWorkflowPlugin

Current Trac configuration file attachment:trac.ini

Permissions and Authentication

anonymous - BLOG_VIEW BROWSER_VIEW CHANGESET_VIEW DISCUSSION_VIEW FILE_VIEW LOG_VIEW MILESTONE_VIEW REPORT_SQL_VIEW REPORT_VIEW ROADMAP_VIEW SEARCH_VIEW TICKET_VIEW TIMELINE_VIEW WIKI_VIEW
authenticated - BLOG_COMMENT BLOG_MODIFY_OWN DISCUSSION_APPEND TICKET_CREATE
team - BLOG_ADMIN DISCUSSION_ADMIN DISCUSSION_APPEND DISCUSSION_MODERATE TICKET_ADMIN WIKI_ADMIN

The authentication uses HtDigestStore with the acct_mgr.web_ui.loginmodule from the TracAccountManager plugin.

Backup Structure and Restoring a Backup

Backup Structure

The backup script is executed every Sunday at 3 Am. And two CD's are burned for safe keeping.

  • Backup catalog structure
    • apache - the /etc/apache2/sites-enabled/ contents - this is the file with the apache configuration for the trac environment.
    • build - the /home/build/ contents - these are all the files needed to restore the hudson server, except the downloaded trunk of the repository.
    • postgres - in here we keep the dump from the postgres database.
    • s2s - the /home/s2s/ contents - these are all the files needed to restore the s2s server.
    • scs - the /home/scs/ contents - these are all the files needed to restore the scs servers.
    • site-packages - the /usr/lib/python2.5/site-packages/ contents - here is the trac installation and some of the plug-ins we're using, also every change to the trac's look and feel are stored here.
  • Script
    #!/bin/bash
    dirname="/root/backup/`date +%Y-%m-%d`"
    
    mkdir $dirname
    mkdir $dirname/scs
    mkdir $dirname/build
    mkdir $dirname/build/.hudson
    mkdir $dirname/s2s
    mkdir $dirname/apache
    mkdir $dirname/postgres
    
    ## Trac, testlink, svn and python site packages
    cp -R /home/scs/svn/ $dirname/scs
    cp -R /home/scs/trac/ $dirname/scs
    cp -R /home/scs/testlink/ $dirname/scs
    cp -R /home/scs/nexus/ $dirname/scs
    cp -R /usr/lib/python2.5/site-packages/ $dirname
    
    
    ## Apache virtual host
    cp /etc/apache2/sites-available/trac $dirname/apache/
    
    ## PstgreSQL database
    pg_dumpall -U scs -c -d > $dirname/postgres/pgdump
    
    ## Build server
    copy() {
       for file in `ls "$1$2"`
       do
          if [ $file = 'Sophie' ]
          then
             file="Sophie 2.0"
          fi
          if [ `echo "$1$2$file" | grep /sophie2/ | wc -l` -eq 0 ]
          then
             if [ -d "$1$2$file" ]
             then
                mkdir "$dirname/build/$2$file"
                copy "$1" "$2$file/"
             else
                cp "$1$2$file" "$dirname/build/$2$file"
             fi
          else
          mkdir "$1$2$file"
          fi
       done
    }
    
    copy /home/build   /.hudson/
    
    ## S2S server
    cp -R /home/s2s/sophie2server $dirname/s2s
    
    tar -pczf "$dirname".tar.gz $dirname
    rm -Rf $dirname
    
    #mkisofs -r -o  "$dirname".iso "$dirname".tar.gz
    #wodim  "$dirname".iso
    

After copying all the needed data for the back up the catalog is compressed to tar.gz so when we create the .iso there are no conflicts with long file names and the data can be stored to one DVD.

Restoring a Backup

Restoring the scs, s2s and apache are as simple as copying the contents of the back-up to the corresponding catalogs in the Server. The build restore is a bit more tricky because you have to checkout the repository in the $HUDSON_HOME/".hudson/jobs/Sophie\ 2.0/sophie2/trunk" before the server can run properly. ( you also copy the contents of the catalog into the $HUDSON_HOME) The postgres database can be restored with the "pg_restore -c -f $FILE" command executed as root. Finally the trac environment can be restored on the Sophie2 server in the same manner, but if we have to move the servers to another machine, then only the files for the trac look and feel should be copied all the other things should be installed properly.

Attachments